From f7e00887d6881b7c232e690e6fba1324cd434a32 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Mon, 6 Jan 2014 00:30:39 +0100 Subject: [PATCH] restructured apidoc templates --- extensions/yii/apidoc/README.md | 10 + extensions/yii/apidoc/apidoc | 2 +- extensions/yii/apidoc/assets/css/api.css | 105 ------- extensions/yii/apidoc/assets/css/style.css | 32 -- .../yii/apidoc/commands/RenderController.php | 36 ++- extensions/yii/apidoc/components/BaseRenderer.php | 37 --- .../yii/apidoc/components/OfflineRenderer.php | 311 ------------------ extensions/yii/apidoc/models/BaseDoc.php | 5 + extensions/yii/apidoc/models/ClassDoc.php | 4 +- extensions/yii/apidoc/models/ConstDoc.php | 5 + extensions/yii/apidoc/models/Context.php | 6 +- extensions/yii/apidoc/models/EventDoc.php | 5 + extensions/yii/apidoc/models/FunctionDoc.php | 5 + extensions/yii/apidoc/models/InterfaceDoc.php | 5 + extensions/yii/apidoc/models/MethodDoc.php | 5 + extensions/yii/apidoc/models/ParamDoc.php | 5 + extensions/yii/apidoc/models/PropertyDoc.php | 5 + extensions/yii/apidoc/models/TraitDoc.php | 5 + extensions/yii/apidoc/models/TypeDoc.php | 5 + extensions/yii/apidoc/templates/BaseRenderer.php | 32 ++ extensions/yii/apidoc/templates/html/README.md | 4 + extensions/yii/apidoc/templates/html/Renderer.php | 349 +++++++++++++++++++++ .../apidoc/templates/html/views/constSummary.php | 35 +++ .../apidoc/templates/html/views/eventDetails.php | 34 ++ .../apidoc/templates/html/views/eventSummary.php | 40 +++ .../apidoc/templates/html/views/methodDetails.php | 59 ++++ .../apidoc/templates/html/views/methodSummary.php | 40 +++ .../templates/html/views/propertyDetails.php | 38 +++ .../templates/html/views/propertySummary.php | 41 +++ .../yii/apidoc/templates/html/views/seeAlso.php | 26 ++ .../yii/apidoc/templates/html/views/type.php | 101 ++++++ .../yii/apidoc/templates/offline/Renderer.php | 44 +++ .../apidoc/templates/offline/assets/css/api.css | 105 +++++++ .../apidoc/templates/offline/assets/css/style.css | 32 ++ .../yii/apidoc/templates/offline/views/index.php | 30 ++ .../yii/apidoc/templates/offline/views/offline.php | 65 ++++ extensions/yii/apidoc/views/constSummary.php | 35 --- extensions/yii/apidoc/views/eventDetails.php | 34 -- extensions/yii/apidoc/views/eventSummary.php | 40 --- extensions/yii/apidoc/views/index.php | 30 -- extensions/yii/apidoc/views/layouts/offline.php | 64 ---- extensions/yii/apidoc/views/methodDetails.php | 59 ---- extensions/yii/apidoc/views/methodSummary.php | 40 --- extensions/yii/apidoc/views/propertyDetails.php | 38 --- extensions/yii/apidoc/views/propertySummary.php | 41 --- extensions/yii/apidoc/views/seeAlso.php | 26 -- extensions/yii/apidoc/views/type.php | 101 ------ 47 files changed, 1177 insertions(+), 999 deletions(-) delete mode 100644 extensions/yii/apidoc/assets/css/api.css delete mode 100644 extensions/yii/apidoc/assets/css/style.css delete mode 100644 extensions/yii/apidoc/components/BaseRenderer.php delete mode 100644 extensions/yii/apidoc/components/OfflineRenderer.php create mode 100644 extensions/yii/apidoc/templates/BaseRenderer.php create mode 100644 extensions/yii/apidoc/templates/html/README.md create mode 100644 extensions/yii/apidoc/templates/html/Renderer.php create mode 100644 extensions/yii/apidoc/templates/html/views/constSummary.php create mode 100644 extensions/yii/apidoc/templates/html/views/eventDetails.php create mode 100644 extensions/yii/apidoc/templates/html/views/eventSummary.php create mode 100644 extensions/yii/apidoc/templates/html/views/methodDetails.php create mode 100644 extensions/yii/apidoc/templates/html/views/methodSummary.php create mode 100644 extensions/yii/apidoc/templates/html/views/propertyDetails.php create mode 100644 extensions/yii/apidoc/templates/html/views/propertySummary.php create mode 100644 extensions/yii/apidoc/templates/html/views/seeAlso.php create mode 100644 extensions/yii/apidoc/templates/html/views/type.php create mode 100644 extensions/yii/apidoc/templates/offline/Renderer.php create mode 100644 extensions/yii/apidoc/templates/offline/assets/css/api.css create mode 100644 extensions/yii/apidoc/templates/offline/assets/css/style.css create mode 100644 extensions/yii/apidoc/templates/offline/views/index.php create mode 100644 extensions/yii/apidoc/templates/offline/views/offline.php delete mode 100644 extensions/yii/apidoc/views/constSummary.php delete mode 100644 extensions/yii/apidoc/views/eventDetails.php delete mode 100644 extensions/yii/apidoc/views/eventSummary.php delete mode 100644 extensions/yii/apidoc/views/index.php delete mode 100644 extensions/yii/apidoc/views/layouts/offline.php delete mode 100644 extensions/yii/apidoc/views/methodDetails.php delete mode 100644 extensions/yii/apidoc/views/methodSummary.php delete mode 100644 extensions/yii/apidoc/views/propertyDetails.php delete mode 100644 extensions/yii/apidoc/views/propertySummary.php delete mode 100644 extensions/yii/apidoc/views/seeAlso.php delete mode 100644 extensions/yii/apidoc/views/type.php diff --git a/extensions/yii/apidoc/README.md b/extensions/yii/apidoc/README.md index b733d7d..7d20c71 100644 --- a/extensions/yii/apidoc/README.md +++ b/extensions/yii/apidoc/README.md @@ -25,4 +25,14 @@ to the require section of your composer.json. Usage ----- +TDB + +Creating your own templates +--------------------------- + +TDB + +Using the model layer +--------------------- + TDB \ No newline at end of file diff --git a/extensions/yii/apidoc/apidoc b/extensions/yii/apidoc/apidoc index 91f7981..c19d642 100755 --- a/extensions/yii/apidoc/apidoc +++ b/extensions/yii/apidoc/apidoc @@ -32,7 +32,7 @@ foreach($yiiDirs as $dir) { } } if (!class_exists('Yii')) { - echo "\nThe Yii Framework 2.0 does not seem to be installed. Try running composer install.\n\n"; + echo PHP_EOL . "The Yii Framework 2.0 does not seem to be installed. Try running composer install." . PHP_EOL . PHP_EOL; exit(1); } diff --git a/extensions/yii/apidoc/assets/css/api.css b/extensions/yii/apidoc/assets/css/api.css deleted file mode 100644 index 482c04f..0000000 --- a/extensions/yii/apidoc/assets/css/api.css +++ /dev/null @@ -1,105 +0,0 @@ -pre { - color: #000000; - background-color: #FFF5E6; - font-family: "courier new", "times new roman", monospace; - line-height: 1.3em; - /* Put a nice border around it. */ - padding: 1px; - width: 90%; - /* Don't wrap its contents, and show scrollbars. */ - /* white-space: nowrap;*/ - overflow: auto; - /* Stop after about 24 lines, and just show a scrollbar. */ - /* max-height: 24em; */ - margin: 5px; - padding-left: 20px; - border: 1px solid #FFE6BF; - border-left: 6px solid #FFE6BF; -} - -div.code { - display: none; - color: #000000; - background-color: #FFF5E6; - font-family: "courier new", "times new roman", monospace; - line-height: 1.3em; - /* Put a nice border around it. */ - padding: 1px; - width: 90%; - /* Don't wrap its contents, and show scrollbars. */ - /* white-space: nowrap;*/ - overflow: auto; - /* Stop after about 24 lines, and just show a scrollbar. */ - /* max-height: 24em; */ - margin: 5px; - padding-left: 20px; - border-left: 6px solid #FFE6BF; -} - -table.summaryTable { - background: #E6ECFF; - border-collapse: collapse; - width: 100%; -} - -table.summaryTable th, table.summaryTable td { - border: 1px #BFCFFF solid; - padding: 0.2em; -} - -table.summaryTable th { - background: #CCD9FF; - text-align: left; -} - -#nav { - padding: 3px; - margin: 0 0 10px 0; - border-top: 1px #BFCFFF solid; -} - -#classDescription { - padding: 5px; - margin: 10px 0 20px 0; - border-bottom: 1px solid #BFCFFF; -} - -.detailHeader { - font-weight: bold; - font-size: 12pt; - margin: 30px 0 5px 0; - border-bottom: 1px solid #BFCFFF; -} - -.detailHeaderTag { - font-weight: normal; - font-size: 10pt; -} - -.signature, .signature2 { - padding: 3px; - color: #000000; - font-family: "courier new", "times new roman", monospace; - line-height: 1.3em; -} - -.signature { - margin: 10px 0 10px 0; - background: #E6ECFF; - border: 1px #BFCFFF solid; -} - -.paramNameCol { - width: 12%; - font-weight: bold; -} - -.paramTypeCol { - width: 12%; -} - -.sourceCode { - margin: 5px 0; - padding:5px; - background:#FFF5E6; -} \ No newline at end of file diff --git a/extensions/yii/apidoc/assets/css/style.css b/extensions/yii/apidoc/assets/css/style.css deleted file mode 100644 index 009c218..0000000 --- a/extensions/yii/apidoc/assets/css/style.css +++ /dev/null @@ -1,32 +0,0 @@ -body -{ -} - -body, div, span, p, input -{ - font-family: Verdana, Arial, sans-serif; - font-size: 10pt; - color: #333333; -} - -#apiPage { -} - -#apiHeader { - padding: 3px; - color: white; - background: #6078BF; - margin-bottom: 5px; - font-weight: bold; -} - -#apiHeader a { - color: white; -} - -#apiFooter { - margin-top: 5px; - padding: 3px; - border-top: 1px solid #BFCFFF; - text-align: center; -} diff --git a/extensions/yii/apidoc/commands/RenderController.php b/extensions/yii/apidoc/commands/RenderController.php index 33aee50..8a46de3 100644 --- a/extensions/yii/apidoc/commands/RenderController.php +++ b/extensions/yii/apidoc/commands/RenderController.php @@ -8,6 +8,8 @@ namespace yii\apidoc\commands; use phpDocumentor\Reflection\FileReflector; +use TokenReflection\ReflectionFile; +use yii\apidoc\templates\BaseRenderer; use yii\console\Controller; use yii\helpers\Console; use yii\helpers\FileHelper; @@ -23,6 +25,8 @@ use Yii; */ class RenderController extends Controller { + public $template = 'offline'; + /** * Renders API documentation files * @param array $sourceDirs @@ -31,7 +35,7 @@ class RenderController extends Controller */ public function actionIndex(array $sourceDirs, $targetDir) { - $targetDir = Yii::getAlias($targetDir); + $targetDir = rtrim(Yii::getAlias($targetDir), '\\/'); if (is_dir($targetDir) && !$this->confirm('TargetDirectory already exists. Overwrite?')) { return 2; } @@ -39,6 +43,9 @@ class RenderController extends Controller mkdir($targetDir); } + $renderer = $this->findRenderer(); + $renderer->targetDir = $targetDir; + $this->stdout('Searching files to process... '); $files = []; foreach($sourceDirs as $source) { @@ -88,11 +95,26 @@ class RenderController extends Controller $this->stdout('done.' . PHP_EOL, Console::FG_GREEN); // render models - $renderer = new OfflineRenderer(); - $renderer->targetDir = $targetDir; $renderer->render($context, $this); } + /** + * @return BaseRenderer + */ + protected function findRenderer() + { + $file = Yii::getAlias('@yii/apidoc/templates/' . $this->template . '/Renderer.php'); + $reflection = new FileReflector($file, true); + $reflection->process(); + $classes = $reflection->getClasses(); + if (empty($classes)) { + $this->stderr('Renderer not found.' . PHP_EOL); + } + $rendererClass = reset($classes)->getName(); + require($file); + return new $rendererClass(); + } + protected function findFiles($path, $except = []) { $path = FileHelper::normalizePath($path); @@ -115,4 +137,12 @@ class RenderController extends Controller ]; return FileHelper::findFiles($path, $options); } + + /** + * @inheritdoc + */ + public function globalOptions() + { + return array_merge(parent::globalOptions(), ['template']); + } } \ No newline at end of file diff --git a/extensions/yii/apidoc/components/BaseRenderer.php b/extensions/yii/apidoc/components/BaseRenderer.php deleted file mode 100644 index 5b8fb69..0000000 --- a/extensions/yii/apidoc/components/BaseRenderer.php +++ /dev/null @@ -1,37 +0,0 @@ -_view === null) { - $this->_view = new View(); - } - return $this->_view; - } - - /** - * @param Context $context - * @param Controller $controller - * @return mixed - */ - public abstract function render($context, $controller); - -} \ No newline at end of file diff --git a/extensions/yii/apidoc/components/OfflineRenderer.php b/extensions/yii/apidoc/components/OfflineRenderer.php deleted file mode 100644 index bb06141..0000000 --- a/extensions/yii/apidoc/components/OfflineRenderer.php +++ /dev/null @@ -1,311 +0,0 @@ -context = $context; - $dir = Yii::getAlias($this->targetDir); - if (!is_dir($dir)) { - mkdir($dir); - } - - $types = array_merge($context->classes, $context->interfaces, $context->traits); - $typeCount = count($types) + 1; - Console::startProgress(0, $typeCount, 'Rendering files: ', false); - $done = 0; - foreach($types as $type) { - $fileContent = $this->renderWithLayout($this->typeView, [ - 'type' => $type, - 'docContext' => $context, - ]); - file_put_contents($dir . '/' . $this->generateFileName($type->name), $fileContent); - Console::updateProgress(++$done, $typeCount); - } - $indexFileContent = $this->renderWithLayout($this->indexView, [ - 'docContext' => $context, - 'types' => $types, - ]); - file_put_contents($dir . '/index.html', $indexFileContent); - Console::updateProgress(++$done, $typeCount); - Console::endProgress(true); - $controller->stdout('done.' . PHP_EOL, Console::FG_GREEN); - - $controller->stdout('Copying asset files... '); - FileHelper::copyDirectory(__DIR__ . '/../assets/css', $dir . '/css'); - $controller->stdout('done.' . PHP_EOL, Console::FG_GREEN); - - } - - protected function renderWithLayout($viewFile, $params) - { - $output = $this->getView()->render($viewFile, $params, $this); - if ($this->layout !== false) { - $params['content'] = $output; - return $this->getView()->renderFile($this->layout, $params, $this); - } else { - return $output; - } - } - - /** - * creates a link to a type (class, interface or trait) - * @param ClassDoc|InterfaceDoc|TraitDoc $types - * @param string $title - * @return string - */ - public function typeLink($types, $context = null) - { - if (!is_array($types)) { - $types = [$types]; - } - $links = []; - foreach($types as $type) { - $postfix = ''; - if (!is_object($type)) { - if (substr($type, -2, 2) == '[]') { - $postfix = '[]'; - $type = substr($type, 0, -2); - } - - if (($t = $this->context->getType(ltrim($type, '\\'))) !== null) { - $type = $t; - } elseif ($type[0] !== '\\' && ($t = $this->context->getType($this->resolveNamespace($context) . '\\' . ltrim($type, '\\'))) !== null) { - $type = $t; - } else { - ltrim($type, '\\'); - } - } - if (!is_object($type)) { - $links[] = $type; - } else { - $links[] = Html::a( - $type->name, - null, - ['href' => $this->generateFileName($type->name)] - ) . $postfix; - } - } - return implode('|', $links); - } - - /** - * creates a link to a subject - * @param PropertyDoc|MethodDoc|ConstDoc|EventDoc $subject - * @param string $title - * @return string - */ - public function subjectLink($subject, $title = null) - { - if ($title === null) { - $title = $subject->name; - } - if (($type = $this->context->getType($subject->definedBy)) === null) { - return $subject->name; - } else { - $link = $this->generateFileName($type->name); - if ($subject instanceof MethodDoc) { - $link .= '#' . $subject->name . '()'; - } else { - $link .= '#' . $subject->name; - } - $link .= '-detail'; - return Html::a($title, null, ['href' => $link]); - } - } - - /** - * @param BaseDoc $context - */ - private function resolveNamespace($context) - { - if ($context === null) { - return ''; - } - if ($context instanceof TypeDoc) { - return $context->namespace; - } - if ($context->hasProperty('definedBy')) { - $type = $this->context->getType($context); - if ($type !== null) { - return $type->namespace; - } - } - return ''; - } - - /** - * @param ClassDoc $class - * @return string - */ - public function renderInheritance($class) - { - $parents[] = $this->typeLink($class); - while ($class->parentClass !== null) { - if(isset($this->context->classes[$class->parentClass])) { - $class = $this->context->classes[$class->parentClass]; - $parents[] = $this->typeLink($class); - } else { - $parents[] = $class->parentClass; // TODO link to php.net - break; - } - } - return implode(" »\n",$parents); - } - - /** - * @param array $names - * @return string - */ - public function renderInterfaces($names) - { - $interfaces = []; - sort($names, SORT_STRING); - foreach($names as $interface) { - if(isset($this->context->interfaces[$interface])) { - $interfaces[] = $this->typeLink($this->context->interfaces[$interface]); - } else { - $interfaces[] = $interface; // TODO link to php.net - } - } - return implode(', ',$interfaces); - } - - /** - * @param array $names - * @return string - */ - public function renderTraits($names) - { - $traits = []; - sort($names, SORT_STRING); - foreach($names as $trait) { - if(isset($this->context->traits[$trait])) { - $traits[] = $this->typeLink($this->context->traits[$trait]); - } else { - $traits[] = $trait; // TODO link to php.net - } - } - return implode(', ',$traits); - } - - /** - * @param array $names - * @return string - */ - public function renderClasses($names) - { - $classes = []; - sort($names, SORT_STRING); - foreach($names as $class) { - if(isset($this->context->classes[$class])) { - $classes[] = $this->typeLink($this->context->classes[$class]); - } else { - $classes[] = $class; // TODO link to php.net - } - } - return implode(', ',$classes); - } - - /** - * @param PropertyDoc $property - * @return string - */ - public function renderPropertySignature($property) - { - return $this->typeLink($property->types) . ' ' . $property->name . ' = ' . ($property->defaultValue === null ? 'null' : $property->defaultValue); - // TODO - if(!empty($property->signature)) - return $property->signature; - $sig=''; - if(!empty($property->getter)) - $sig=$property->getter->signature; - if(!empty($property->setter)) - { - if($sig!=='') - $sig.='
'; - $sig.=$property->setter->signature; - } - return $sig; - } - - /** - * @param MethodDoc $method - * @return string - */ - public function renderMethodSignature($method) - { - $params = []; - foreach($method->params as $param) { - $params[] = (empty($param->typeHint) ? '' : $param->typeHint . ' ') - . ($param->isPassedByReference ? '&' : '') - . $param->name - . ($param->isOptional ? ' = ' . $param->defaultValue : ''); - } - - //signature); - - return ($method->isReturnByReference ? '&' : '') - . ($method->returnType === null ? 'void' : $this->typeLink($method->returnTypes)) - . ' ' . $method->name . '( ' - . implode(', ', $params) - . ' )'; - } - - public function generateFileName($typeName) - { - return strtolower(str_replace('\\', '_', $typeName)) . '.html'; - } - - /** - * Finds the view file corresponding to the specified relative view name. - * @param string $view a relative view name. The name does NOT start with a slash. - * @return string the view file path. Note that the file may not exist. - */ - public function findViewFile($view) - { - return Yii::getAlias('@yii/apidoc/views/' . $view); - } -} \ No newline at end of file diff --git a/extensions/yii/apidoc/models/BaseDoc.php b/extensions/yii/apidoc/models/BaseDoc.php index d52011c..b595dcc 100644 --- a/extensions/yii/apidoc/models/BaseDoc.php +++ b/extensions/yii/apidoc/models/BaseDoc.php @@ -11,6 +11,11 @@ use phpDocumentor\Reflection\DocBlock\Tag\DeprecatedTag; use phpDocumentor\Reflection\DocBlock\Tag\SinceTag; use yii\base\Object; +/** + * + * @author Carsten Brandt + * @since 2.0 + */ class BaseDoc extends Object { public $name; diff --git a/extensions/yii/apidoc/models/ClassDoc.php b/extensions/yii/apidoc/models/ClassDoc.php index 82da1d5..a70ae85 100644 --- a/extensions/yii/apidoc/models/ClassDoc.php +++ b/extensions/yii/apidoc/models/ClassDoc.php @@ -8,7 +8,9 @@ namespace yii\apidoc\models; /** - * Class ClassDoc + * + * @author Carsten Brandt + * @since 2.0 */ class ClassDoc extends TypeDoc { diff --git a/extensions/yii/apidoc/models/ConstDoc.php b/extensions/yii/apidoc/models/ConstDoc.php index b1d3a93..a0fbf08 100644 --- a/extensions/yii/apidoc/models/ConstDoc.php +++ b/extensions/yii/apidoc/models/ConstDoc.php @@ -7,6 +7,11 @@ namespace yii\apidoc\models; +/** + * + * @author Carsten Brandt + * @since 2.0 + */ class ConstDoc extends BaseDoc { public $definedBy; diff --git a/extensions/yii/apidoc/models/Context.php b/extensions/yii/apidoc/models/Context.php index 549c318..5378195 100644 --- a/extensions/yii/apidoc/models/Context.php +++ b/extensions/yii/apidoc/models/Context.php @@ -7,11 +7,15 @@ namespace yii\apidoc\models; - use phpDocumentor\Reflection\FileReflector; use yii\base\Component; use yii\base\Exception; +/** + * + * @author Carsten Brandt + * @since 2.0 + */ class Context extends Component { /** diff --git a/extensions/yii/apidoc/models/EventDoc.php b/extensions/yii/apidoc/models/EventDoc.php index 78aee19..41771c5 100644 --- a/extensions/yii/apidoc/models/EventDoc.php +++ b/extensions/yii/apidoc/models/EventDoc.php @@ -10,6 +10,11 @@ namespace yii\apidoc\models; use phpDocumentor\Reflection\DocBlock\Tag\ParamTag; use phpDocumentor\Reflection\DocBlock\Tag\ReturnTag; +/** + * + * @author Carsten Brandt + * @since 2.0 + */ class EventDoc extends ConstDoc { public $type; diff --git a/extensions/yii/apidoc/models/FunctionDoc.php b/extensions/yii/apidoc/models/FunctionDoc.php index 30338a6..1120f77 100644 --- a/extensions/yii/apidoc/models/FunctionDoc.php +++ b/extensions/yii/apidoc/models/FunctionDoc.php @@ -13,6 +13,11 @@ use phpDocumentor\Reflection\DocBlock\Tag\ReturnTag; use phpDocumentor\Reflection\DocBlock\Tag\ThrowsTag; use yii\base\Exception; +/** + * + * @author Carsten Brandt + * @since 2.0 + */ class FunctionDoc extends BaseDoc { /** diff --git a/extensions/yii/apidoc/models/InterfaceDoc.php b/extensions/yii/apidoc/models/InterfaceDoc.php index 8aea744..57cd9ce 100644 --- a/extensions/yii/apidoc/models/InterfaceDoc.php +++ b/extensions/yii/apidoc/models/InterfaceDoc.php @@ -7,6 +7,11 @@ namespace yii\apidoc\models; +/** + * + * @author Carsten Brandt + * @since 2.0 + */ class InterfaceDoc extends TypeDoc { public $parentInterfaces = []; diff --git a/extensions/yii/apidoc/models/MethodDoc.php b/extensions/yii/apidoc/models/MethodDoc.php index 96ca5c3..0f7288f 100644 --- a/extensions/yii/apidoc/models/MethodDoc.php +++ b/extensions/yii/apidoc/models/MethodDoc.php @@ -7,6 +7,11 @@ namespace yii\apidoc\models; +/** + * + * @author Carsten Brandt + * @since 2.0 + */ class MethodDoc extends FunctionDoc { public $isAbstract; diff --git a/extensions/yii/apidoc/models/ParamDoc.php b/extensions/yii/apidoc/models/ParamDoc.php index da5127b..0d4c162 100644 --- a/extensions/yii/apidoc/models/ParamDoc.php +++ b/extensions/yii/apidoc/models/ParamDoc.php @@ -9,6 +9,11 @@ namespace yii\apidoc\models; use yii\base\Object; +/** + * + * @author Carsten Brandt + * @since 2.0 + */ class ParamDoc extends Object { public $name; diff --git a/extensions/yii/apidoc/models/PropertyDoc.php b/extensions/yii/apidoc/models/PropertyDoc.php index 68fc414..cf17b0d 100644 --- a/extensions/yii/apidoc/models/PropertyDoc.php +++ b/extensions/yii/apidoc/models/PropertyDoc.php @@ -9,6 +9,11 @@ namespace yii\apidoc\models; use phpDocumentor\Reflection\DocBlock\Tag\VarTag; +/** + * + * @author Carsten Brandt + * @since 2.0 + */ class PropertyDoc extends BaseDoc { public $visibility; diff --git a/extensions/yii/apidoc/models/TraitDoc.php b/extensions/yii/apidoc/models/TraitDoc.php index 347640a..37f1799 100644 --- a/extensions/yii/apidoc/models/TraitDoc.php +++ b/extensions/yii/apidoc/models/TraitDoc.php @@ -7,6 +7,11 @@ namespace yii\apidoc\models; +/** + * + * @author Carsten Brandt + * @since 2.0 + */ class TraitDoc extends TypeDoc { // classes using the trait diff --git a/extensions/yii/apidoc/models/TypeDoc.php b/extensions/yii/apidoc/models/TypeDoc.php index d892a3d..9ceaf26 100644 --- a/extensions/yii/apidoc/models/TypeDoc.php +++ b/extensions/yii/apidoc/models/TypeDoc.php @@ -11,6 +11,11 @@ use phpDocumentor\Reflection\DocBlock\Tag\AuthorTag; use yii\base\Exception; use yii\helpers\StringHelper; +/** + * + * @author Carsten Brandt + * @since 2.0 + */ class TypeDoc extends BaseDoc { public $authors = []; diff --git a/extensions/yii/apidoc/templates/BaseRenderer.php b/extensions/yii/apidoc/templates/BaseRenderer.php new file mode 100644 index 0000000..4f29e43 --- /dev/null +++ b/extensions/yii/apidoc/templates/BaseRenderer.php @@ -0,0 +1,32 @@ + + * @since 2.0 + */ +abstract class BaseRenderer extends Component +{ + /** + * Renders a given [[Context]]. + * + * @param Context $context the api documentation context to render. + * @param Controller $controller the apidoc controller instance. Can be used to control output. + */ + public abstract function render($context, $controller); +} \ No newline at end of file diff --git a/extensions/yii/apidoc/templates/html/README.md b/extensions/yii/apidoc/templates/html/README.md new file mode 100644 index 0000000..90e3b35 --- /dev/null +++ b/extensions/yii/apidoc/templates/html/README.md @@ -0,0 +1,4 @@ +The html API doc template +------------------------- + +This templates provides view files and a Renderer class that can be reused in other html templates. \ No newline at end of file diff --git a/extensions/yii/apidoc/templates/html/Renderer.php b/extensions/yii/apidoc/templates/html/Renderer.php new file mode 100644 index 0000000..bf730c7 --- /dev/null +++ b/extensions/yii/apidoc/templates/html/Renderer.php @@ -0,0 +1,349 @@ + + * @since 2.0 + */ +abstract class Renderer extends BaseRenderer implements ViewContextInterface +{ + /** + * @var string directory to use for output of html files. Can be a path alias. + */ + public $targetDir; + /** + * @var string string to use as the title of the generated page. + */ + public $pageTitle = 'Yii Framework 2.0 API Documentation'; + /** + * @var string path or alias of the layout file to use. + */ + public $layout; + /** + * @var string path or alias of the view file to use for rendering types (classes, interfaces, traits). + */ + public $typeView = '@yii/apidoc/templates/html/views/type.php'; + /** + * @var string path or alias of the view file to use for rendering the index page. + */ + public $indexView = '@yii/apidoc/templates/html/views/index.php'; + /** + * @var Context the [[Context]] currently being rendered. + */ + protected $context; + /** + * @var View + */ + private $_view; + + /** + * @return View the view instance + */ + public function getView() + { + if ($this->_view === null) { + $this->_view = new View(); + $assetPath = Yii::getAlias($this->targetDir) . '/assets'; + if (!is_dir($assetPath)) { + mkdir($assetPath); + } + $this->_view->assetManager = new AssetManager([ + 'basePath' => $assetPath, + 'baseUrl' => '/assets', + ]); + } + return $this->_view; + } + + /** + * Renders a given [[Context]]. + * + * @param Context $context the api documentation context to render. + * @param Controller $controller the apidoc controller instance. Can be used to control output. + */ + public function render($context, $controller) + { + $this->context = $context; + $dir = Yii::getAlias($this->targetDir); + if (!is_dir($dir)) { + mkdir($dir); + } + + $types = array_merge($context->classes, $context->interfaces, $context->traits); + $typeCount = count($types) + 1; + Console::startProgress(0, $typeCount, 'Rendering files: ', false); + $done = 0; + foreach($types as $type) { + $fileContent = $this->renderWithLayout($this->typeView, [ + 'type' => $type, + 'docContext' => $context, + ]); + file_put_contents($dir . '/' . $this->generateFileName($type->name), $fileContent); + Console::updateProgress(++$done, $typeCount); + } + $indexFileContent = $this->renderWithLayout($this->indexView, [ + 'docContext' => $context, + 'types' => $types, + ]); + file_put_contents($dir . '/index.html', $indexFileContent); + Console::updateProgress(++$done, $typeCount); + Console::endProgress(true); + $controller->stdout('done.' . PHP_EOL, Console::FG_GREEN); + } + + protected function renderWithLayout($viewFile, $params) + { + $output = $this->getView()->render($viewFile, $params, $this); + if ($this->layout !== false) { + $params['content'] = $output; + return $this->getView()->renderFile($this->layout, $params, $this); + } else { + return $output; + } + } + + /** + * creates a link to a type (class, interface or trait) + * @param ClassDoc|InterfaceDoc|TraitDoc $types + * @param BaseDoc $context + * @return string + */ + public function typeLink($types, $context = null) + { + if (!is_array($types)) { + $types = [$types]; + } + $links = []; + foreach($types as $type) { + $postfix = ''; + if (!is_object($type)) { + if (substr($type, -2, 2) == '[]') { + $postfix = '[]'; + $type = substr($type, 0, -2); + } + + if (($t = $this->context->getType(ltrim($type, '\\'))) !== null) { + $type = $t; + } elseif ($type[0] !== '\\' && ($t = $this->context->getType($this->resolveNamespace($context) . '\\' . ltrim($type, '\\'))) !== null) { + $type = $t; + } else { + ltrim($type, '\\'); + } + } + if (!is_object($type)) { + $links[] = $type; + } else { + $links[] = Html::a( + $type->name, + null, + ['href' => $this->generateFileName($type->name)] + ) . $postfix; + } + } + return implode('|', $links); + } + + /** + * creates a link to a subject + * @param PropertyDoc|MethodDoc|ConstDoc|EventDoc $subject + * @param string $title + * @return string + */ + public function subjectLink($subject, $title = null) + { + if ($title === null) { + $title = $subject->name; + } + if (($type = $this->context->getType($subject->definedBy)) === null) { + return $subject->name; + } else { + $link = $this->generateFileName($type->name); + if ($subject instanceof MethodDoc) { + $link .= '#' . $subject->name . '()'; + } else { + $link .= '#' . $subject->name; + } + $link .= '-detail'; + return Html::a($title, null, ['href' => $link]); + } + } + + /** + * @param BaseDoc $context + */ + private function resolveNamespace($context) + { + // TODO use phpdoc Context for this + if ($context === null) { + return ''; + } + if ($context instanceof TypeDoc) { + return $context->namespace; + } + if ($context->hasProperty('definedBy')) { + $type = $this->context->getType($context); + if ($type !== null) { + return $type->namespace; + } + } + return ''; + } + + /** + * @param ClassDoc $class + * @return string + */ + public function renderInheritance($class) + { + $parents[] = $this->typeLink($class); + while ($class->parentClass !== null) { + if(isset($this->context->classes[$class->parentClass])) { + $class = $this->context->classes[$class->parentClass]; + $parents[] = $this->typeLink($class); + } else { + $parents[] = $class->parentClass; // TODO link to php.net + break; + } + } + return implode(" »\n",$parents); + } + + /** + * @param array $names + * @return string + */ + public function renderInterfaces($names) + { + $interfaces = []; + sort($names, SORT_STRING); + foreach($names as $interface) { + if(isset($this->context->interfaces[$interface])) { + $interfaces[] = $this->typeLink($this->context->interfaces[$interface]); + } else { + $interfaces[] = $interface; // TODO link to php.net + } + } + return implode(', ',$interfaces); + } + + /** + * @param array $names + * @return string + */ + public function renderTraits($names) + { + $traits = []; + sort($names, SORT_STRING); + foreach($names as $trait) { + if(isset($this->context->traits[$trait])) { + $traits[] = $this->typeLink($this->context->traits[$trait]); + } else { + $traits[] = $trait; // TODO link to php.net + } + } + return implode(', ',$traits); + } + + /** + * @param array $names + * @return string + */ + public function renderClasses($names) + { + $classes = []; + sort($names, SORT_STRING); + foreach($names as $class) { + if(isset($this->context->classes[$class])) { + $classes[] = $this->typeLink($this->context->classes[$class]); + } else { + $classes[] = $class; // TODO link to php.net + } + } + return implode(', ',$classes); + } + + /** + * @param PropertyDoc $property + * @return string + */ + public function renderPropertySignature($property) + { + return $this->typeLink($property->types) . ' ' . $property->name . ' = ' . ($property->defaultValue === null ? 'null' : $property->defaultValue); + // TODO + if(!empty($property->signature)) + return $property->signature; + $sig=''; + if(!empty($property->getter)) + $sig=$property->getter->signature; + if(!empty($property->setter)) + { + if($sig!=='') + $sig.='
'; + $sig.=$property->setter->signature; + } + return $sig; + } + + /** + * @param MethodDoc $method + * @return string + */ + public function renderMethodSignature($method) + { + $params = []; + foreach($method->params as $param) { + $params[] = (empty($param->typeHint) ? '' : $param->typeHint . ' ') + . ($param->isPassedByReference ? '&' : '') + . $param->name + . ($param->isOptional ? ' = ' . $param->defaultValue : ''); + } + + return ($method->isReturnByReference ? '&' : '') + . ($method->returnType === null ? 'void' : $this->typeLink($method->returnTypes)) + . ' ' . $method->name . '( ' + . implode(', ', $params) + . ' )'; + } + + protected function generateFileName($typeName) + { + return strtolower(str_replace('\\', '_', $typeName)) . '.html'; + } + + /** + * Finds the view file corresponding to the specified relative view name. + * @param string $view a relative view name. The name does NOT start with a slash. + * @return string the view file path. Note that the file may not exist. + */ + public function findViewFile($view) + { + return Yii::getAlias('@yii/apidoc/templates/html/views/' . $view); + } +} \ No newline at end of file diff --git a/extensions/yii/apidoc/templates/html/views/constSummary.php b/extensions/yii/apidoc/templates/html/views/constSummary.php new file mode 100644 index 0000000..63dbbfb --- /dev/null +++ b/extensions/yii/apidoc/templates/html/views/constSummary.php @@ -0,0 +1,35 @@ +constants)) { + return; +} ?> +
+

Constants

+ +

Hide inherited constants

+ + ++ + + + + + + +constants as $constant): ?> + definedBy != $type->name ? ' class="inherited"' : '' ?> id="name ?>"> + + + + + + +
ConstantValueDescriptionDefined By
name ?>value ?>shortDescription . "\n" . $constant->description) ?>context->typeLink($constant->definedBy) ?>
+
\ No newline at end of file diff --git a/extensions/yii/apidoc/templates/html/views/eventDetails.php b/extensions/yii/apidoc/templates/html/views/eventDetails.php new file mode 100644 index 0000000..9ba925e --- /dev/null +++ b/extensions/yii/apidoc/templates/html/views/eventDetails.php @@ -0,0 +1,34 @@ +getNativeEvents(); +if (empty($events)) { + return; +} ?> +

Event Details

+ +
+ name; ?> + + event + since)): ?> + (available since version since ?>) + + +
+ + + trigger->signature; ?> + */ ?> + +

description; ?>

+ + render('seeAlso', ['object' => $event]); ?> + + diff --git a/extensions/yii/apidoc/templates/html/views/eventSummary.php b/extensions/yii/apidoc/templates/html/views/eventSummary.php new file mode 100644 index 0000000..56cb0fa --- /dev/null +++ b/extensions/yii/apidoc/templates/html/views/eventSummary.php @@ -0,0 +1,40 @@ +events)) { + return; +} ?> +
+

Events

+ +

Hide inherited events

+ + ++ + + + + + + +events as $event): ?> +definedBy != $type->name ? ' class="inherited"' : '' ?> id="name ?>"> + + + + + + +
EventTypeDescriptionDefined By
context->subjectLink($event) ?>context->typeLink($event->types) ?> + shortDescription ?> + since)): ?> + (available since version since; ?>) + + context->typeLink($event->definedBy) ?>
+
\ No newline at end of file diff --git a/extensions/yii/apidoc/templates/html/views/methodDetails.php b/extensions/yii/apidoc/templates/html/views/methodDetails.php new file mode 100644 index 0000000..e0c0dbe --- /dev/null +++ b/extensions/yii/apidoc/templates/html/views/methodDetails.php @@ -0,0 +1,59 @@ +getNativeMethods(); +if (empty($methods)) { + return; +} ?> +

Method Details

+ + + +
+ name ?>() + + method + since)): ?> + (available since version since; ?>) + + +
+ + + + params) || !empty($method->return)): ?> + params as $param): ?> + + + + + + + return)): ?> + + + + + + + +
+
+ context->renderMethodSignature($method) ?> +
+
name ?>context->typeLink($param->types) ?>description ?>
context->typeLink($method->returnTypes); ?>return; ?>
+ +renderPartial('sourceCode',array('object'=>$method)); ?> + +

shortDescription ?>

+

description) ?>

+ + render('seeAlso', ['object' => $method]); ?> + + \ No newline at end of file diff --git a/extensions/yii/apidoc/templates/html/views/methodSummary.php b/extensions/yii/apidoc/templates/html/views/methodSummary.php new file mode 100644 index 0000000..e597d53 --- /dev/null +++ b/extensions/yii/apidoc/templates/html/views/methodSummary.php @@ -0,0 +1,40 @@ +getProtectedMethods()) == 0 || !$protected && count($type->getPublicMethods()) == 0) { + return; +} ?> + +
+

+ +

Hide inherited methods

+ + ++ + + + + + + +methods as $method): ?> +visibility == 'protected' || !$protected && $method->visibility != 'protected'): ?> +definedBy != $type->name ? ' class="inherited"' : '' ?> id="name ?>()"> + + + + + + +
MethodDescriptionDefined By
context->subjectLink($method, $method->name.'()') ?>shortDescription ?>context->typeLink($method->definedBy) ?>
+
\ No newline at end of file diff --git a/extensions/yii/apidoc/templates/html/views/propertyDetails.php b/extensions/yii/apidoc/templates/html/views/propertyDetails.php new file mode 100644 index 0000000..80fb34a --- /dev/null +++ b/extensions/yii/apidoc/templates/html/views/propertyDetails.php @@ -0,0 +1,38 @@ +getNativeProperties(); +if (empty($properties)) { + return; +} ?> +

Property Details

+ + + +
+ name; ?> + + property + getIsReadOnly()) echo ' read-only '; ?> + getIsWriteOnly()) echo ' write-only '; ?> + since)): ?> + (available since version since; ?>) + + +
+ +
+ context->renderPropertySignature($property); ?> +
+ +

description) ?>

+ + render('seeAlso', ['object' => $property]); ?> + + diff --git a/extensions/yii/apidoc/templates/html/views/propertySummary.php b/extensions/yii/apidoc/templates/html/views/propertySummary.php new file mode 100644 index 0000000..ae95850 --- /dev/null +++ b/extensions/yii/apidoc/templates/html/views/propertySummary.php @@ -0,0 +1,41 @@ +getProtectedProperties()) == 0 || !$protected && count($type->getPublicProperties()) == 0) { + return; +} ?> + +
+

+ +

Hide inherited properties

+ + ++ + + + + + + + +properties as $property): ?> +visibility == 'protected' || !$protected && $property->visibility != 'protected'): ?> +definedBy != $type->name ? ' class="inherited"' : '' ?> id="name ?>"> + + + + + + + +
PropertyTypeDescriptionDefined By
context->subjectLink($property); ?>context->typeLink($property->types); ?>shortDescription; ?>context->typeLink($property->definedBy); ?>
+
\ No newline at end of file diff --git a/extensions/yii/apidoc/templates/html/views/seeAlso.php b/extensions/yii/apidoc/templates/html/views/seeAlso.php new file mode 100644 index 0000000..e955318 --- /dev/null +++ b/extensions/yii/apidoc/templates/html/views/seeAlso.php @@ -0,0 +1,26 @@ +tags as $tag) { + /** @var $tag phpDocumentor\Reflection\DocBlock\Tag\SeeTag */ + if (get_class($tag) == 'phpDocumentor\Reflection\DocBlock\Tag\SeeTag') { + $see[] = $tag->getReference(); + } +} +if (empty($see)) { + return; +} +?> +
+

See Also

+
    + +
  • + +
+
diff --git a/extensions/yii/apidoc/templates/html/views/type.php b/extensions/yii/apidoc/templates/html/views/type.php new file mode 100644 index 0000000..50959dc --- /dev/null +++ b/extensions/yii/apidoc/templates/html/views/type.php @@ -0,0 +1,101 @@ +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('@yii/apidoc/templates/html/views/propertySummary', ['type' => $type,'protected' => false]) ?> +render('@yii/apidoc/templates/html/views/propertySummary', ['type' => $type,'protected' => true]) ?> + + +render('@yii/apidoc/templates/html/views/methodSummary', ['type' => $type, 'protected' => false]) ?> +render('@yii/apidoc/templates/html/views/methodSummary', ['type' => $type, 'protected' => true]) ?> + + +render('@yii/apidoc/templates/html/views/eventSummary', ['type' => $type]) ?> + + +render('@yii/apidoc/templates/html/views/constSummary', ['type' => $type]) ?> + +render('@yii/apidoc/templates/html/views/propertyDetails', ['type' => $type]) ?> +render('@yii/apidoc/templates/html/views/methodDetails', ['type' => $type]) ?> + + render('@yii/apidoc/templates/html/views/eventDetails', ['type' => $type]) ?> + diff --git a/extensions/yii/apidoc/templates/offline/Renderer.php b/extensions/yii/apidoc/templates/offline/Renderer.php new file mode 100644 index 0000000..1e544b7 --- /dev/null +++ b/extensions/yii/apidoc/templates/offline/Renderer.php @@ -0,0 +1,44 @@ + + * @since 2.0 + */ +class Renderer extends \yii\apidoc\templates\html\Renderer +{ + public $layout = '@yii/apidoc/templates/offline/views/offline.php'; + public $indexView = '@yii/apidoc/templates/offline/views/index.php'; + + public $pageTitle = 'Yii Framework 2.0 API Documentation'; + + /** + * Renders a given [[Context]]. + * + * @param Context $context the api documentation context to render. + * @param Controller $controller the apidoc controller instance. Can be used to control output. + */ + public function render($context, $controller) + { + parent::render($context, $controller); + + $dir = Yii::getAlias($this->targetDir); + + $controller->stdout('Copying asset files... '); + FileHelper::copyDirectory(__DIR__ . '/assets/css', $dir . '/css'); + $controller->stdout('done.' . PHP_EOL, Console::FG_GREEN); + } + +} \ No newline at end of file diff --git a/extensions/yii/apidoc/templates/offline/assets/css/api.css b/extensions/yii/apidoc/templates/offline/assets/css/api.css new file mode 100644 index 0000000..482c04f --- /dev/null +++ b/extensions/yii/apidoc/templates/offline/assets/css/api.css @@ -0,0 +1,105 @@ +pre { + color: #000000; + background-color: #FFF5E6; + font-family: "courier new", "times new roman", monospace; + line-height: 1.3em; + /* Put a nice border around it. */ + padding: 1px; + width: 90%; + /* Don't wrap its contents, and show scrollbars. */ + /* white-space: nowrap;*/ + overflow: auto; + /* Stop after about 24 lines, and just show a scrollbar. */ + /* max-height: 24em; */ + margin: 5px; + padding-left: 20px; + border: 1px solid #FFE6BF; + border-left: 6px solid #FFE6BF; +} + +div.code { + display: none; + color: #000000; + background-color: #FFF5E6; + font-family: "courier new", "times new roman", monospace; + line-height: 1.3em; + /* Put a nice border around it. */ + padding: 1px; + width: 90%; + /* Don't wrap its contents, and show scrollbars. */ + /* white-space: nowrap;*/ + overflow: auto; + /* Stop after about 24 lines, and just show a scrollbar. */ + /* max-height: 24em; */ + margin: 5px; + padding-left: 20px; + border-left: 6px solid #FFE6BF; +} + +table.summaryTable { + background: #E6ECFF; + border-collapse: collapse; + width: 100%; +} + +table.summaryTable th, table.summaryTable td { + border: 1px #BFCFFF solid; + padding: 0.2em; +} + +table.summaryTable th { + background: #CCD9FF; + text-align: left; +} + +#nav { + padding: 3px; + margin: 0 0 10px 0; + border-top: 1px #BFCFFF solid; +} + +#classDescription { + padding: 5px; + margin: 10px 0 20px 0; + border-bottom: 1px solid #BFCFFF; +} + +.detailHeader { + font-weight: bold; + font-size: 12pt; + margin: 30px 0 5px 0; + border-bottom: 1px solid #BFCFFF; +} + +.detailHeaderTag { + font-weight: normal; + font-size: 10pt; +} + +.signature, .signature2 { + padding: 3px; + color: #000000; + font-family: "courier new", "times new roman", monospace; + line-height: 1.3em; +} + +.signature { + margin: 10px 0 10px 0; + background: #E6ECFF; + border: 1px #BFCFFF solid; +} + +.paramNameCol { + width: 12%; + font-weight: bold; +} + +.paramTypeCol { + width: 12%; +} + +.sourceCode { + margin: 5px 0; + padding:5px; + background:#FFF5E6; +} \ No newline at end of file diff --git a/extensions/yii/apidoc/templates/offline/assets/css/style.css b/extensions/yii/apidoc/templates/offline/assets/css/style.css new file mode 100644 index 0000000..009c218 --- /dev/null +++ b/extensions/yii/apidoc/templates/offline/assets/css/style.css @@ -0,0 +1,32 @@ +body +{ +} + +body, div, span, p, input +{ + font-family: Verdana, Arial, sans-serif; + font-size: 10pt; + color: #333333; +} + +#apiPage { +} + +#apiHeader { + padding: 3px; + color: white; + background: #6078BF; + margin-bottom: 5px; + font-weight: bold; +} + +#apiHeader a { + color: white; +} + +#apiFooter { + margin-top: 5px; + padding: 3px; + border-top: 1px solid #BFCFFF; + text-align: center; +} diff --git a/extensions/yii/apidoc/templates/offline/views/index.php b/extensions/yii/apidoc/templates/offline/views/index.php new file mode 100644 index 0000000..310e9af --- /dev/null +++ b/extensions/yii/apidoc/templates/offline/views/index.php @@ -0,0 +1,30 @@ +

Class Reference

+ + ++ + + + + + + +$class): ?> + + + + + +
ClassDescription
context->typeLink($class, $class->name); ?>shortDescription; ?>
diff --git a/extensions/yii/apidoc/templates/offline/views/offline.php b/extensions/yii/apidoc/templates/offline/views/offline.php new file mode 100644 index 0000000..36b2487 --- /dev/null +++ b/extensions/yii/apidoc/templates/offline/views/offline.php @@ -0,0 +1,65 @@ +beginPage(); +?> + + + + + + + + +head(); ?> +<?php echo $this->context->pageTitle; ?> + + + +beginBody(); ?> +
+ +
+Yii Framework v Class Reference +
+ +
+ +
+ +
+© 2008-2013 by Yii Software LLC
+All Rights Reserved.
+
+ + + + +
+endBody(); ?> + + +endPage(); ?> \ No newline at end of file diff --git a/extensions/yii/apidoc/views/constSummary.php b/extensions/yii/apidoc/views/constSummary.php deleted file mode 100644 index 63dbbfb..0000000 --- a/extensions/yii/apidoc/views/constSummary.php +++ /dev/null @@ -1,35 +0,0 @@ -constants)) { - return; -} ?> -
-

Constants

- -

Hide inherited constants

- - -- - - - - - - -constants as $constant): ?> - definedBy != $type->name ? ' class="inherited"' : '' ?> id="name ?>"> - - - - - - -
ConstantValueDescriptionDefined By
name ?>value ?>shortDescription . "\n" . $constant->description) ?>context->typeLink($constant->definedBy) ?>
-
\ No newline at end of file diff --git a/extensions/yii/apidoc/views/eventDetails.php b/extensions/yii/apidoc/views/eventDetails.php deleted file mode 100644 index 9ba925e..0000000 --- a/extensions/yii/apidoc/views/eventDetails.php +++ /dev/null @@ -1,34 +0,0 @@ -getNativeEvents(); -if (empty($events)) { - return; -} ?> -

Event Details

- -
- name; ?> - - event - since)): ?> - (available since version since ?>) - - -
- - - trigger->signature; ?> - */ ?> - -

description; ?>

- - render('seeAlso', ['object' => $event]); ?> - - diff --git a/extensions/yii/apidoc/views/eventSummary.php b/extensions/yii/apidoc/views/eventSummary.php deleted file mode 100644 index 56cb0fa..0000000 --- a/extensions/yii/apidoc/views/eventSummary.php +++ /dev/null @@ -1,40 +0,0 @@ -events)) { - return; -} ?> -
-

Events

- -

Hide inherited events

- - -- - - - - - - -events as $event): ?> -definedBy != $type->name ? ' class="inherited"' : '' ?> id="name ?>"> - - - - - - -
EventTypeDescriptionDefined By
context->subjectLink($event) ?>context->typeLink($event->types) ?> - shortDescription ?> - since)): ?> - (available since version since; ?>) - - context->typeLink($event->definedBy) ?>
-
\ No newline at end of file diff --git a/extensions/yii/apidoc/views/index.php b/extensions/yii/apidoc/views/index.php deleted file mode 100644 index 310e9af..0000000 --- a/extensions/yii/apidoc/views/index.php +++ /dev/null @@ -1,30 +0,0 @@ -

Class Reference

- - -- - - - - - - -$class): ?> - - - - - -
ClassDescription
context->typeLink($class, $class->name); ?>shortDescription; ?>
diff --git a/extensions/yii/apidoc/views/layouts/offline.php b/extensions/yii/apidoc/views/layouts/offline.php deleted file mode 100644 index 809de75..0000000 --- a/extensions/yii/apidoc/views/layouts/offline.php +++ /dev/null @@ -1,64 +0,0 @@ -beginPage(); -?> - - - - - - - - -head(); ?> -<?php echo $this->context->pageTitle; ?> - - - -beginBody(); ?> -
- -
-Yii Framework v Class Reference -
- -
- -
- -
-© 2008-2013 by Yii Software LLC
-All Rights Reserved.
-
- - - -
-endBody(); ?> - - -endPage(); ?> \ No newline at end of file diff --git a/extensions/yii/apidoc/views/methodDetails.php b/extensions/yii/apidoc/views/methodDetails.php deleted file mode 100644 index e0c0dbe..0000000 --- a/extensions/yii/apidoc/views/methodDetails.php +++ /dev/null @@ -1,59 +0,0 @@ -getNativeMethods(); -if (empty($methods)) { - return; -} ?> -

Method Details

- - - -
- name ?>() - - method - since)): ?> - (available since version since; ?>) - - -
- - - - params) || !empty($method->return)): ?> - params as $param): ?> - - - - - - - return)): ?> - - - - - - - -
-
- context->renderMethodSignature($method) ?> -
-
name ?>context->typeLink($param->types) ?>description ?>
context->typeLink($method->returnTypes); ?>return; ?>
- -renderPartial('sourceCode',array('object'=>$method)); ?> - -

shortDescription ?>

-

description) ?>

- - render('seeAlso', ['object' => $method]); ?> - - \ No newline at end of file diff --git a/extensions/yii/apidoc/views/methodSummary.php b/extensions/yii/apidoc/views/methodSummary.php deleted file mode 100644 index e597d53..0000000 --- a/extensions/yii/apidoc/views/methodSummary.php +++ /dev/null @@ -1,40 +0,0 @@ -getProtectedMethods()) == 0 || !$protected && count($type->getPublicMethods()) == 0) { - return; -} ?> - -
-

- -

Hide inherited methods

- - -- - - - - - - -methods as $method): ?> -visibility == 'protected' || !$protected && $method->visibility != 'protected'): ?> -definedBy != $type->name ? ' class="inherited"' : '' ?> id="name ?>()"> - - - - - - -
MethodDescriptionDefined By
context->subjectLink($method, $method->name.'()') ?>shortDescription ?>context->typeLink($method->definedBy) ?>
-
\ No newline at end of file diff --git a/extensions/yii/apidoc/views/propertyDetails.php b/extensions/yii/apidoc/views/propertyDetails.php deleted file mode 100644 index 80fb34a..0000000 --- a/extensions/yii/apidoc/views/propertyDetails.php +++ /dev/null @@ -1,38 +0,0 @@ -getNativeProperties(); -if (empty($properties)) { - return; -} ?> -

Property Details

- - - -
- name; ?> - - property - getIsReadOnly()) echo ' read-only '; ?> - getIsWriteOnly()) echo ' write-only '; ?> - since)): ?> - (available since version since; ?>) - - -
- -
- context->renderPropertySignature($property); ?> -
- -

description) ?>

- - render('seeAlso', ['object' => $property]); ?> - - diff --git a/extensions/yii/apidoc/views/propertySummary.php b/extensions/yii/apidoc/views/propertySummary.php deleted file mode 100644 index ae95850..0000000 --- a/extensions/yii/apidoc/views/propertySummary.php +++ /dev/null @@ -1,41 +0,0 @@ -getProtectedProperties()) == 0 || !$protected && count($type->getPublicProperties()) == 0) { - return; -} ?> - -
-

- -

Hide inherited properties

- - -- - - - - - - - -properties as $property): ?> -visibility == 'protected' || !$protected && $property->visibility != 'protected'): ?> -definedBy != $type->name ? ' class="inherited"' : '' ?> id="name ?>"> - - - - - - - -
PropertyTypeDescriptionDefined By
context->subjectLink($property); ?>context->typeLink($property->types); ?>shortDescription; ?>context->typeLink($property->definedBy); ?>
-
\ No newline at end of file diff --git a/extensions/yii/apidoc/views/seeAlso.php b/extensions/yii/apidoc/views/seeAlso.php deleted file mode 100644 index e955318..0000000 --- a/extensions/yii/apidoc/views/seeAlso.php +++ /dev/null @@ -1,26 +0,0 @@ -tags as $tag) { - /** @var $tag phpDocumentor\Reflection\DocBlock\Tag\SeeTag */ - if (get_class($tag) == 'phpDocumentor\Reflection\DocBlock\Tag\SeeTag') { - $see[] = $tag->getReference(); - } -} -if (empty($see)) { - return; -} -?> -
-

See Also

-
    - -
  • - -
-
diff --git a/extensions/yii/apidoc/views/type.php b/extensions/yii/apidoc/views/type.php deleted file mode 100644 index a911b63..0000000 --- a/extensions/yii/apidoc/views/type.php +++ /dev/null @@ -1,101 +0,0 @@ -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]) ?> - -render('propertyDetails', ['type' => $type]) ?> -render('methodDetails', ['type' => $type]) ?> - - render('eventDetails', ['type' => $type]) ?> -