Trait yii\apidoc\templates\bootstrap\RendererTrait
Common methods for renderers
Public Properties
| Property | Type | Description | Defined By |
|---|---|---|---|
| $extensions | array | Official Yii extensions | yii\apidoc\templates\bootstrap\RendererTrait |
Public Methods
| Method | Description | Defined By |
|---|---|---|
| getNavTypes() | Returns nav TypeDocs | yii\apidoc\templates\bootstrap\RendererTrait |
Protected Methods
| Method | Description | Defined By |
|---|---|---|
| filterTypes() | Returns types of a given class | yii\apidoc\templates\bootstrap\RendererTrait |
| getTypeCategory() | Returns category of TypeDoc | yii\apidoc\templates\bootstrap\RendererTrait |
Property Details
Official Yii extensions
public array $extensions = [
'apidoc',
'authclient',
'bootstrap',
'codeception',
'composer',
'debug',
'elasticsearch',
'faker',
'gii',
'httpclient',
'imagine',
'jui',
'mongodb',
'redis',
'shell',
'smarty',
'sphinx',
'swiftmailer',
'twig',
]
'apidoc',
'authclient',
'bootstrap',
'codeception',
'composer',
'debug',
'elasticsearch',
'faker',
'gii',
'httpclient',
'imagine',
'jui',
'mongodb',
'redis',
'shell',
'smarty',
'sphinx',
'swiftmailer',
'twig',
]
Method Details
Returns types of a given class
| protected array filterTypes ( yii\apidoc\models\TypeDoc[] $types, string $navClasses ) | ||
| $types | yii\apidoc\models\TypeDoc[] | |
| $navClasses | string | |
protected function filterTypes($types, $navClasses)
{
switch ($navClasses) {
case 'app':
$types = array_filter($types, fn($val) => !str_starts_with((string) $val->name, 'yii\\'));
break;
case 'yii':
$self = $this;
$types = array_filter($types, function ($val) use ($self) {
if ($val->name == 'Yii' || $val->name == 'YiiRequirementChecker') {
return true;
}
if (strlen((string) $val->name) < 5) {
return false;
}
$subName = substr((string) $val->name, 4, strpos((string) $val->name, '\\', 5) - 4);
return str_starts_with((string) $val->name, 'yii\\') && !in_array($subName, $self->extensions);
});
break;
default:
$types = array_filter($types, fn($val) => str_starts_with((string) $val->name, "yii\\$navClasses\\"));
}
return $types;
}
Returns category of TypeDoc
| protected string getTypeCategory ( yii\apidoc\models\TypeDoc|null $type ) | ||
| $type | yii\apidoc\models\TypeDoc|null | |
protected function getTypeCategory($type)
{
$extensions = $this->extensions;
$navClasses = 'app';
if (isset($type)) {
if ($type->name == 'Yii' || $type->name == 'YiiRequirementChecker') {
$navClasses = 'yii';
} elseif (str_starts_with((string) $type->name, 'yii\\')) {
$navClasses = 'yii';
$subName = substr((string) $type->name, 4);
if (($pos = strpos($subName, '\\')) !== false) {
$subNamespace = substr($subName, 0, $pos);
if (in_array($subNamespace, $extensions)) {
$navClasses = $subNamespace;
}
}
}
}
return $navClasses;
}