Abstract Class yii\apidoc\renderers\ApiRenderer

Inheritanceyii\apidoc\renderers\ApiRenderer » yii\apidoc\renderers\BaseRenderer » yii\base\Component
Subclassesyii\apidoc\templates\bootstrap\ApiRenderer, yii\apidoc\templates\html\ApiRenderer, yii\apidoc\templates\json\ApiRenderer, yii\apidoc\templates\online\ApiRenderer, yii\apidoc\templates\project\ApiRenderer
Available since extension's version2.0
Source Code https://github.com/yiisoft/yii2-apidoc/blob/master/renderers/ApiRenderer.php

Base class for all API documentation renderers

Public Methods

Hide inherited methods

Method Description Defined By
createSubjectLink() Creates a link to a subject yii\apidoc\renderers\BaseRenderer
createTypeLink() Creates a link to a type (class, interface or trait) yii\apidoc\renderers\BaseRenderer
generateApiUrl() Generate an url to a type in apidocs yii\apidoc\renderers\BaseRenderer
generateGuideUrl() Generate an url to a guide page yii\apidoc\renderers\BaseRenderer
init() yii\apidoc\renderers\BaseRenderer
render() Renders a given yii\apidoc\models\Context. yii\apidoc\renderers\ApiRenderer

Protected Methods

Hide inherited methods

Method Description Defined By
generateLink() Generate link markup yii\apidoc\renderers\BaseRenderer

Constants

Hide inherited constants

Constant Value Description Defined By
PHPSTAN_TYPE_BASE_URL 'https://phpstan.org/writing-php-code/phpdoc-types#' yii\apidoc\renderers\BaseRenderer
PHP_CLASS_BASE_URL 'https://www.php.net/class.' yii\apidoc\renderers\BaseRenderer
PHP_TYPES [ 'callable', 'array', 'string', 'boolean', 'bool', 'integer', 'int', 'float', 'object', 'resource', 'null', 'false', 'true', 'iterable', 'mixed', 'never', 'void', ] yii\apidoc\renderers\BaseRenderer
PHP_TYPE_ALIASES [ 'true' => 'boolean', 'false' => 'boolean', 'bool' => 'boolean', 'int' => 'integer', ] yii\apidoc\renderers\BaseRenderer
PHP_TYPE_BASE_URL 'https://www.php.net/language.types.' yii\apidoc\renderers\BaseRenderer
PHP_TYPE_DISPLAY_ALIASES [ 'bool' => 'boolean', 'int' => 'integer', ] yii\apidoc\renderers\BaseRenderer
PSALM_TYPE_BASE_URL 'https://psalm.dev/docs/annotating_code/type_syntax/' yii\apidoc\renderers\BaseRenderer

Property Details

Method Details

Hide inherited methods

createSubjectLink() public method

Defined in: yii\apidoc\renderers\BaseRenderer::createSubjectLink()

Creates a link to a subject

public string createSubjectLink ( yii\apidoc\models\BaseDoc|yii\apidoc\models\PseudoTypeDoc|yii\apidoc\models\PseudoTypeImportDoc $subject, string|null $title null, array $options = [], yii\apidoc\models\TypeDoc|null $type null )
$subject yii\apidoc\models\BaseDoc|yii\apidoc\models\PseudoTypeDoc|yii\apidoc\models\PseudoTypeImportDoc
$title string|null
$options array

Additional HTML attributes for the link.

$type yii\apidoc\models\TypeDoc|null

createTypeLink() public method

Defined in: yii\apidoc\renderers\BaseRenderer::createTypeLink()

Creates a link to a type (class, interface or trait)

public string createTypeLink ( yii\apidoc\models\BaseDoc|yii\apidoc\models\BaseDoc[]|\phpDocumentor\Reflection\Type|\phpDocumentor\Reflection\Type[]|string|string[]|null $types, yii\apidoc\models\BaseDoc|null $context null, string|null $title null, array $options = [], ?\yii\apidoc\models\TypeDoc $currentTypeDoc null )
$types yii\apidoc\models\BaseDoc|yii\apidoc\models\BaseDoc[]|\phpDocumentor\Reflection\Type|\phpDocumentor\Reflection\Type[]|string|string[]|null
$context yii\apidoc\models\BaseDoc|null
$title string|null

A title to be used for the link TODO check whether [[yii...|Class]] is supported

$options array

Additional HTML attributes for the link.

$currentTypeDoc ?\yii\apidoc\models\TypeDoc

generateApiUrl() public abstract method

Defined in: yii\apidoc\renderers\BaseRenderer::generateApiUrl()

Generate an url to a type in apidocs

public abstract mixed generateApiUrl ( mixed $typeName )
$typeName mixed

                abstract public function generateApiUrl($typeName);

            
generateGuideUrl() public method

Defined in: yii\apidoc\renderers\BaseRenderer::generateGuideUrl()

Generate an url to a guide page

public string generateGuideUrl ( string $file )
$file string

                public function generateGuideUrl($file)
{
    //skip parsing external url
    if ((str_contains($file, 'https://')) || (str_contains($file, 'http://'))) {
        return $file;
    }
    $hash = '';
    if (($pos = strpos($file, '#')) !== false) {
        $hash = substr($file, $pos);
        $file = substr($file, 0, $pos);
    }
    return rtrim((string) $this->guideUrl, '/') . '/' . $this->guidePrefix . basename($file, '.md') . '.html' . $hash;
}

            
generateLink() protected abstract method

Defined in: yii\apidoc\renderers\BaseRenderer::generateLink()

Generate link markup

protected abstract mixed generateLink ( mixed $text, mixed $href, array $options = [] )
$text mixed
$href mixed
$options array

Additional HTML attributes for the link.

init() public method
public mixed init ( )

                public function init()
{
    ApiMarkdown::$renderer = $this;
    ApiMarkdownLaTeX::$renderer = $this;
}

            
render() public abstract method

Renders a given yii\apidoc\models\Context.

public abstract mixed render ( yii\apidoc\models\Context $context, mixed $targetDir )
$context yii\apidoc\models\Context

The api documentation context to render.

$targetDir mixed

                abstract public function render($context, $targetDir);