diff --git a/extensions/yii/apidoc/components/OfflineRenderer.php b/extensions/yii/apidoc/components/OfflineRenderer.php index a3660f7..3f2df90 100644 --- a/extensions/yii/apidoc/components/OfflineRenderer.php +++ b/extensions/yii/apidoc/components/OfflineRenderer.php @@ -28,7 +28,7 @@ class OfflineRenderer extends BaseRenderer implements ViewContextInterface public $targetDir; public $layout = '@yii/apidoc/views/layouts/offline.php'; - public $itemView = '@yii/apidoc/views/class.php'; + public $typeView = '@yii/apidoc/views/type.php'; public $indexView = '@yii/apidoc/views/index.php'; public $pageTitle = 'Yii Framework 2.0 API Documentation'; @@ -50,24 +50,24 @@ class OfflineRenderer extends BaseRenderer implements ViewContextInterface mkdir($dir); } - $items = array_merge($context->classes, $context->interfaces, $context->traits); - $itemCount = count($items) + 1; - Console::startProgress(0, $itemCount, 'Rendering files: ', false); + $types = array_merge($context->classes, $context->interfaces, $context->traits); + $typeCount = count($types) + 1; + Console::startProgress(0, $typeCount, 'Rendering files: ', false); $done = 0; - foreach($items as $item) { - $fileContent = $this->renderWithLayout($this->itemView, [ - 'item' => $item, + foreach($types as $type) { + $fileContent = $this->renderWithLayout($this->typeView, [ + 'type' => $type, 'docContext' => $context, ]); - file_put_contents($dir . '/' . $this->generateFileName($item->name), $fileContent); - Console::updateProgress(++$done, $itemCount); + file_put_contents($dir . '/' . $this->generateFileName($type->name), $fileContent); + Console::updateProgress(++$done, $typeCount); } $indexFileContent = $this->renderWithLayout($this->indexView, [ 'docContext' => $context, - 'items' => $items, + 'types' => $types, ]); file_put_contents($dir . '/index.html', $indexFileContent); - Console::updateProgress(++$done, $itemCount); + Console::updateProgress(++$done, $typeCount); Console::endProgress(true); $controller->stdout('done.' . PHP_EOL, Console::FG_GREEN); @@ -209,9 +209,9 @@ class OfflineRenderer extends BaseRenderer implements ViewContextInterface } - public function generateFileName($itemName) + public function generateFileName($typeName) { - return strtolower(str_replace('\\', '_', $itemName)) . '.html'; + return strtolower(str_replace('\\', '_', $typeName)) . '.html'; } /** diff --git a/extensions/yii/apidoc/views/class.php b/extensions/yii/apidoc/views/class.php deleted file mode 100644 index f3db8cf..0000000 --- a/extensions/yii/apidoc/views/class.php +++ /dev/null @@ -1,61 +0,0 @@ - -

isFinal) { - echo 'Final '; - } - if ($item->isAbstract) { - echo 'Abstract '; - } - echo 'Class '; - } - echo $item->name; -?>

- - -render('classSummary', ['item' => $item]) ?> - - -render('propertySummary', ['item' => $item,'protected' => false]) ?> -render('propertySummary', ['item' => $item,'protected' => true]) ?> - - -render('methodSummary', ['item' => $item, 'protected' => false]) ?> -render('methodSummary', ['item' => $item, 'protected' => true]) ?> - - -render('eventSummary', ['item' => $item]) ?> - - -render('constSummary', ['item' => $item]) ?> - -renderPartial('propertyDetails',array('class'=>$item)); ?> -renderPartial('methodDetails',array('class'=>$item)); ?> diff --git a/extensions/yii/apidoc/views/classSummary.php b/extensions/yii/apidoc/views/classSummary.php deleted file mode 100644 index 2de3811..0000000 --- a/extensions/yii/apidoc/views/classSummary.php +++ /dev/null @@ -1,49 +0,0 @@ -context; - -?> - - - - - - - - interfaces)): ?> - - - traits)): ?> - - - subclasses)): ?> - - - implementedBy)): ?> - - - usedBy)): ?> - - - since)): ?> - - - - - - -
InheritancerenderInheritance($item) ?>
ImplementsrenderInterfaces($item->interfaces) ?>
Uses TraitsrenderTraits($item->traits) ?>
SubclassesrenderClasses($item->subclasses) ?>
Implemented byrenderClasses($item->implementedBy) ?>
Implemented byrenderClasses($item->usedBy) ?>
Available since versionsince ?>
Source CoderenderSourceLink($item->sourcePath) ?>
- -
- shortDescription ?> -

description) ?>

-
\ No newline at end of file diff --git a/extensions/yii/apidoc/views/constSummary.php b/extensions/yii/apidoc/views/constSummary.php index 7ed2d1a..abac8c4 100644 --- a/extensions/yii/apidoc/views/constSummary.php +++ b/extensions/yii/apidoc/views/constSummary.php @@ -2,11 +2,11 @@ use yii\apidoc\models\ClassDoc; /** - * @var ClassDoc $item + * @var ClassDoc $type * @var yii\web\View $this */ -if (empty($item->constants)) { +if (empty($type->constants)) { return; } ?>
@@ -23,8 +23,8 @@ if (empty($item->constants)) { ConstantDescriptionDefined By -constants as $constant): ?> -definedBy != $item->name ? ' class="inherited"' : '' ?> id="name ?>"> +constants as $constant): ?> +definedBy != $type->name ? ' class="inherited"' : '' ?> id="name ?>"> context->subjectLink($constant) ?> shortDescription ?> context->typeLink($constant->definedBy) ?> diff --git a/extensions/yii/apidoc/views/eventSummary.php b/extensions/yii/apidoc/views/eventSummary.php index 72ebafa..9493846 100644 --- a/extensions/yii/apidoc/views/eventSummary.php +++ b/extensions/yii/apidoc/views/eventSummary.php @@ -2,11 +2,11 @@ use yii\apidoc\models\ClassDoc; /** - * @var ClassDoc $item + * @var ClassDoc $type * @var yii\web\View $this */ -if (empty($item->events)) { +if (empty($type->events)) { return; } ?>
@@ -23,8 +23,8 @@ if (empty($item->events)) { EventDescriptionDefined By -events as $event): ?> -definedBy != $item->name ? ' class="inherited"' : '' ?> id="name ?>"> +events as $event): ?> +definedBy != $type->name ? ' class="inherited"' : '' ?> id="name ?>"> context->subjectLink($event) ?> shortDescription ?> context->typeLink($event->definedBy) ?> diff --git a/extensions/yii/apidoc/views/index.php b/extensions/yii/apidoc/views/index.php index bdaa548..310e9af 100644 --- a/extensions/yii/apidoc/views/index.php +++ b/extensions/yii/apidoc/views/index.php @@ -4,7 +4,7 @@ use yii\apidoc\models\ClassDoc; use yii\apidoc\models\InterfaceDoc; use yii\apidoc\models\TraitDoc; /** - * @var ClassDoc[]|InterfaceDoc[]|TraitDoc[] $items + * @var ClassDoc[]|InterfaceDoc[]|TraitDoc[] $types * @var yii\web\View $this */ @@ -20,8 +20,8 @@ use yii\apidoc\models\TraitDoc; ClassDescription $class): ?> +ksort($types); +foreach($types as $i=>$class): ?> context->typeLink($class, $class->name); ?> shortDescription; ?> diff --git a/extensions/yii/apidoc/views/methodSummary.php b/extensions/yii/apidoc/views/methodSummary.php index 81a2c41..19f3e61 100644 --- a/extensions/yii/apidoc/views/methodSummary.php +++ b/extensions/yii/apidoc/views/methodSummary.php @@ -4,12 +4,12 @@ use yii\apidoc\models\ClassDoc; use yii\apidoc\models\InterfaceDoc; use yii\apidoc\models\TraitDoc; /** - * @var ClassDoc|InterfaceDoc|TraitDoc $item + * @var ClassDoc|InterfaceDoc|TraitDoc $type * @var boolean $protected * @var yii\web\View $this */ -if ($protected && count($item->getProtectedMethods()) == 0 || !$protected && count($item->getPublicMethods()) == 0) { +if ($protected && count($type->getProtectedMethods()) == 0 || !$protected && count($type->getPublicMethods()) == 0) { return; } ?> @@ -27,9 +27,9 @@ if ($protected && count($item->getProtectedMethods()) == 0 || !$protected && cou MethodDescriptionDefined By -methods as $method): ?> +methods as $method): ?> visibility == 'protected' || !$protected && $method->visibility != 'protected'): ?> -definedBy != $item->name ? ' class="inherited"' : '' ?> id="name ?>"> +definedBy != $type->name ? ' class="inherited"' : '' ?> id="name ?>"> context->subjectLink($method, $method->name.'()') ?> shortDescription ?> context->typeLink($method->definedBy) ?> diff --git a/extensions/yii/apidoc/views/propertySummary.php b/extensions/yii/apidoc/views/propertySummary.php index be6af10..4b1e935 100644 --- a/extensions/yii/apidoc/views/propertySummary.php +++ b/extensions/yii/apidoc/views/propertySummary.php @@ -4,12 +4,12 @@ use yii\apidoc\models\ClassDoc; use yii\apidoc\models\InterfaceDoc; use yii\apidoc\models\TraitDoc; /** - * @var ClassDoc|InterfaceDoc|TraitDoc $item + * @var ClassDoc|InterfaceDoc|TraitDoc $type * @var boolean $protected * @var yii\web\View $this */ -if ($protected && count($item->getProtectedProperties()) == 0 || !$protected && count($item->getPublicProperties()) == 0) { +if ($protected && count($type->getProtectedProperties()) == 0 || !$protected && count($type->getPublicProperties()) == 0) { return; } ?> @@ -28,9 +28,9 @@ if ($protected && count($item->getProtectedProperties()) == 0 || !$protected && PropertyTypeDescriptionDefined By -properties as $property): ?> +properties as $property): ?> visibility == 'protected' || !$protected && $property->visibility != 'protected'): ?> -definedBy != $item->name ? ' class="inherited"' : '' ?> id="name ?>"> +definedBy != $type->name ? ' class="inherited"' : '' ?> id="name ?>"> context->subjectLink($property); ?> context->typeLink($property->types); ?> shortDescription; ?> diff --git a/extensions/yii/apidoc/views/type.php b/extensions/yii/apidoc/views/type.php new file mode 100644 index 0000000..2c20197 --- /dev/null +++ b/extensions/yii/apidoc/views/type.php @@ -0,0 +1,98 @@ +context; +?> +

isFinal) { + echo 'Final '; + } + if ($type->isAbstract) { + echo 'Abstract '; + } + echo 'Class '; + } + echo $type->name; +?>

+ + + + + + + + + + + interfaces)): ?> + + + traits)): ?> + + + subclasses)): ?> + + + implementedBy)): ?> + + + usedBy)): ?> + + + since)): ?> + + + + + + +
InheritancerenderInheritance($type) ?>
ImplementsrenderInterfaces($type->interfaces) ?>
Uses TraitsrenderTraits($type->traits) ?>
SubclassesrenderClasses($type->subclasses) ?>
Implemented byrenderClasses($type->implementedBy) ?>
Implemented byrenderClasses($type->usedBy) ?>
Available since versionsince ?>
Source CoderenderSourceLink($type->sourcePath) ?>
+ +
+ shortDescription ?> +

description) ?>

+
+ + +render('propertySummary', ['type' => $type,'protected' => false]) ?> +render('propertySummary', ['type' => $type,'protected' => true]) ?> + + +render('methodSummary', ['type' => $type, 'protected' => false]) ?> +render('methodSummary', ['type' => $type, 'protected' => true]) ?> + + +render('eventSummary', ['type' => $type]) ?> + + +render('constSummary', ['type' => $type]) ?> + +renderPartial('propertyDetails',array('type'=>$type)); ?> +renderPartial('methodDetails',array('type'=>$type)); ?>