mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-22 19:31:02 +08:00
finished offline template summaries
This commit is contained in:
@ -8,6 +8,10 @@
|
|||||||
namespace yii\apidoc\components;
|
namespace yii\apidoc\components;
|
||||||
|
|
||||||
|
|
||||||
|
use yii\apidoc\models\ConstDoc;
|
||||||
|
use yii\apidoc\models\EventDoc;
|
||||||
|
use yii\apidoc\models\MethodDoc;
|
||||||
|
use yii\apidoc\models\PropertyDoc;
|
||||||
use yii\base\ViewContextInterface;
|
use yii\base\ViewContextInterface;
|
||||||
use yii\console\Controller;
|
use yii\console\Controller;
|
||||||
use yii\helpers\Console;
|
use yii\helpers\Console;
|
||||||
@ -85,17 +89,50 @@ class OfflineRenderer extends BaseRenderer implements ViewContextInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* creates a link to an item
|
* creates a link to a type (class, interface or trait)
|
||||||
* @param ClassDoc|InterfaceDoc|TraitDoc $item
|
* @param ClassDoc|InterfaceDoc|TraitDoc $types
|
||||||
* @param string $title
|
* @param string $title
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function link($item, $title = null)
|
public function typeLink($types, $title = null)
|
||||||
|
{
|
||||||
|
if (!is_array($types)) {
|
||||||
|
$types = [$types];
|
||||||
|
}
|
||||||
|
$links = [];
|
||||||
|
foreach($types as $type) {
|
||||||
|
if (!is_object($type) && ($t = $this->context->getType($type)) !== null) {
|
||||||
|
$type = $t;
|
||||||
|
}
|
||||||
|
if (!is_object($type)) {
|
||||||
|
$links[] = $type;
|
||||||
|
} else {
|
||||||
|
$links[] = Html::a(
|
||||||
|
$title !== null ? $title : $type->name,
|
||||||
|
null,
|
||||||
|
['href' => $this->generateFileName($type->name)]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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) {
|
if ($title === null) {
|
||||||
$title = $item->name;
|
$title = $subject->name;
|
||||||
|
}
|
||||||
|
if (($type = $this->context->getType($subject->definedBy)) === null) {
|
||||||
|
return $subject->name;
|
||||||
|
} else {
|
||||||
|
return Html::a($title, null, ['href' => $this->generateFileName($type->name) . '#' . $subject->name . '-detail']);
|
||||||
}
|
}
|
||||||
return Html::a($title, null, ['href' => $this->generateFileName($item->name)]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -104,11 +141,11 @@ class OfflineRenderer extends BaseRenderer implements ViewContextInterface
|
|||||||
*/
|
*/
|
||||||
public function renderInheritance($class)
|
public function renderInheritance($class)
|
||||||
{
|
{
|
||||||
$parents[] = $this->link($class);
|
$parents[] = $this->typeLink($class);
|
||||||
while ($class->parentClass !== null) {
|
while ($class->parentClass !== null) {
|
||||||
if(isset($this->context->classes[$class->parentClass])) {
|
if(isset($this->context->classes[$class->parentClass])) {
|
||||||
$class = $this->context->classes[$class->parentClass];
|
$class = $this->context->classes[$class->parentClass];
|
||||||
$parents[] = $this->link($class);
|
$parents[] = $this->typeLink($class);
|
||||||
} else {
|
} else {
|
||||||
$parents[] = $class->parentClass; // TODO link to php.net
|
$parents[] = $class->parentClass; // TODO link to php.net
|
||||||
break;
|
break;
|
||||||
@ -118,15 +155,16 @@ class OfflineRenderer extends BaseRenderer implements ViewContextInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ClassDoc $class
|
* @param array $names
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function renderImplements($class)
|
public function renderInterfaces($names)
|
||||||
{
|
{
|
||||||
$interfaces = [];
|
$interfaces = [];
|
||||||
foreach($class->interfaces as $interface) {
|
sort($names, SORT_STRING);
|
||||||
|
foreach($names as $interface) {
|
||||||
if(isset($this->context->interfaces[$interface])) {
|
if(isset($this->context->interfaces[$interface])) {
|
||||||
$interfaces[] = $this->link($this->context->interfaces[$interface]);
|
$interfaces[] = $this->typeLink($this->context->interfaces[$interface]);
|
||||||
} else {
|
} else {
|
||||||
$interfaces[] = $interface; // TODO link to php.net
|
$interfaces[] = $interface; // TODO link to php.net
|
||||||
}
|
}
|
||||||
@ -135,15 +173,16 @@ class OfflineRenderer extends BaseRenderer implements ViewContextInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ClassDoc|TraitDoc $class
|
* @param array $names
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function renderTraitUses($class)
|
public function renderTraits($names)
|
||||||
{
|
{
|
||||||
$traits = [];
|
$traits = [];
|
||||||
foreach($class->traits as $trait) {
|
sort($names, SORT_STRING);
|
||||||
|
foreach($names as $trait) {
|
||||||
if(isset($this->context->traits[$trait])) {
|
if(isset($this->context->traits[$trait])) {
|
||||||
$traits[] = $this->link($this->context->traits[$trait]);
|
$traits[] = $this->typeLink($this->context->traits[$trait]);
|
||||||
} else {
|
} else {
|
||||||
$traits[] = $trait; // TODO link to php.net
|
$traits[] = $trait; // TODO link to php.net
|
||||||
}
|
}
|
||||||
@ -151,17 +190,22 @@ class OfflineRenderer extends BaseRenderer implements ViewContextInterface
|
|||||||
return implode(', ',$traits);
|
return implode(', ',$traits);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function renderSubclasses($class)
|
/**
|
||||||
|
* @param array $names
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function renderClasses($names)
|
||||||
{
|
{
|
||||||
$subclasses = [];
|
$classes = [];
|
||||||
foreach($class->subclasses as $subclass) {
|
sort($names, SORT_STRING);
|
||||||
if(isset($this->context->classes[$subclass])) {
|
foreach($names as $class) {
|
||||||
$subclasses[] = $this->link($this->context->classes[$subclass]);
|
if(isset($this->context->classes[$class])) {
|
||||||
|
$classes[] = $this->typeLink($this->context->classes[$class]);
|
||||||
} else {
|
} else {
|
||||||
$subclasses[] = $subclass; // TODO link to php.net
|
$classes[] = $class; // TODO link to php.net
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return implode(', ',$subclasses);
|
return implode(', ',$classes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,7 +22,13 @@ class ClassDoc extends TypeDoc
|
|||||||
// will be set by Context::updateReferences()
|
// will be set by Context::updateReferences()
|
||||||
public $subclasses = [];
|
public $subclasses = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var EventDoc[]
|
||||||
|
*/
|
||||||
public $events = [];
|
public $events = [];
|
||||||
|
/**
|
||||||
|
* @var ConstDoc[]
|
||||||
|
*/
|
||||||
public $constants = [];
|
public $constants = [];
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,6 +32,18 @@ class Context extends Component
|
|||||||
public $traits = [];
|
public $traits = [];
|
||||||
|
|
||||||
|
|
||||||
|
public function getType($type)
|
||||||
|
{
|
||||||
|
if (isset($this->classes[$type])) {
|
||||||
|
return $this->classes[$type];
|
||||||
|
} elseif (isset($this->interfaces[$type])) {
|
||||||
|
return $this->interfaces[$type];
|
||||||
|
} elseif (isset($this->traits[$type])) {
|
||||||
|
return $this->traits[$type];
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public function addFile($fileName)
|
public function addFile($fileName)
|
||||||
{
|
{
|
||||||
if (isset($this->files[$fileName])) {
|
if (isset($this->files[$fileName])) {
|
||||||
@ -107,7 +119,6 @@ class Context extends Component
|
|||||||
}
|
}
|
||||||
// update interfaces of subclasses
|
// update interfaces of subclasses
|
||||||
foreach($this->classes as $class) {
|
foreach($this->classes as $class) {
|
||||||
// TODO do the same for events, constants, methods, properties
|
|
||||||
$this->updateSubclassInferfacesTraits($class);
|
$this->updateSubclassInferfacesTraits($class);
|
||||||
}
|
}
|
||||||
// update implementedBy and usedBy for interfaces and traits
|
// update implementedBy and usedBy for interfaces and traits
|
||||||
@ -119,10 +130,17 @@ class Context extends Component
|
|||||||
}
|
}
|
||||||
foreach($class->traits as $trait) {
|
foreach($class->traits as $trait) {
|
||||||
if (isset($this->traits[$trait])) {
|
if (isset($this->traits[$trait])) {
|
||||||
$this->traits[$trait]->usedBy[] = $class->name;
|
$trait = $this->traits[$trait];
|
||||||
|
$trait->usedBy[] = $class->name;
|
||||||
|
$class->properties = array_merge($trait->properties, $class->properties); // TODO make unique
|
||||||
|
$class->methods = array_merge($trait->methods, $class->methods); // TODO make unique
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// update properties, methods, contants and events of subclasses
|
||||||
|
foreach($this->classes as $class) {
|
||||||
|
$this->updateSubclassInheritance($class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -135,7 +153,27 @@ class Context extends Component
|
|||||||
$subclass = $this->classes[$subclass];
|
$subclass = $this->classes[$subclass];
|
||||||
$subclass->interfaces = array_unique(array_merge($subclass->interfaces, $class->interfaces));
|
$subclass->interfaces = array_unique(array_merge($subclass->interfaces, $class->interfaces));
|
||||||
$subclass->traits = array_unique(array_merge($subclass->traits, $class->traits));
|
$subclass->traits = array_unique(array_merge($subclass->traits, $class->traits));
|
||||||
|
$subclass->events = array_merge($class->events, $subclass->events); // TODO make unique
|
||||||
|
$subclass->constants = array_merge($class->constants, $subclass->constants); // TODO make unique
|
||||||
|
$subclass->properties = array_merge($class->properties, $subclass->properties); // TODO make unique
|
||||||
|
$subclass->methods = array_merge($class->methods, $subclass->methods); // TODO make unique
|
||||||
$this->updateSubclassInferfacesTraits($subclass);
|
$this->updateSubclassInferfacesTraits($subclass);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add implemented interfaces and used traits to subclasses
|
||||||
|
* @param ClassDoc $class
|
||||||
|
*/
|
||||||
|
protected function updateSubclassInheritance($class)
|
||||||
|
{
|
||||||
|
foreach($class->subclasses as $subclass) {
|
||||||
|
$subclass = $this->classes[$subclass];
|
||||||
|
$subclass->events = array_merge($class->events, $subclass->events); // TODO make unique
|
||||||
|
$subclass->constants = array_merge($class->constants, $subclass->constants); // TODO make unique
|
||||||
|
$subclass->properties = array_merge($class->properties, $subclass->properties); // TODO make unique
|
||||||
|
$subclass->methods = array_merge($class->methods, $subclass->methods); // TODO make unique
|
||||||
|
$this->updateSubclassInheritance($subclass);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -13,9 +13,61 @@ use yii\base\Exception;
|
|||||||
class TypeDoc extends BaseDoc
|
class TypeDoc extends BaseDoc
|
||||||
{
|
{
|
||||||
public $authors = [];
|
public $authors = [];
|
||||||
|
/**
|
||||||
|
* @var MethodDoc[]
|
||||||
|
*/
|
||||||
public $methods = [];
|
public $methods = [];
|
||||||
|
/**
|
||||||
|
* @var PropertyDoc[]
|
||||||
|
*/
|
||||||
public $properties = [];
|
public $properties = [];
|
||||||
|
|
||||||
|
|
||||||
|
public function getPublicMethods()
|
||||||
|
{
|
||||||
|
return $this->getFilteredMethods('public');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getProtectedMethods()
|
||||||
|
{
|
||||||
|
return $this->getFilteredMethods('protected');
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getFilteredMethods($visibility)
|
||||||
|
{
|
||||||
|
$methods = [];
|
||||||
|
foreach($this->methods as $method) {
|
||||||
|
if ($method->visibility == $visibility) {
|
||||||
|
$methods[] = $method;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $methods;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPublicProperties()
|
||||||
|
{
|
||||||
|
return $this->getFilteredProperties('public');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getProtectedProperties()
|
||||||
|
{
|
||||||
|
return $this->getFilteredProperties('protected');
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getFilteredProperties($visibility)
|
||||||
|
{
|
||||||
|
if ($this->properties === null) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
$properties = [];
|
||||||
|
foreach($this->properties as $property) {
|
||||||
|
if ($property->visibility == $visibility) {
|
||||||
|
$properties[] = $property;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $properties;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \phpDocumentor\Reflection\InterfaceReflector $reflector
|
* @param \phpDocumentor\Reflection\InterfaceReflector $reflector
|
||||||
* @param array $config
|
* @param array $config
|
||||||
@ -48,6 +100,7 @@ class TypeDoc extends BaseDoc
|
|||||||
$method = new MethodDoc($methodReflector);
|
$method = new MethodDoc($methodReflector);
|
||||||
$method->definedBy = $this->name;
|
$method->definedBy = $this->name;
|
||||||
|
|
||||||
|
// TODO only set property when subclass of Object
|
||||||
if (!strncmp($method->name, 'set', 3)) {
|
if (!strncmp($method->name, 'set', 3)) {
|
||||||
$propertyName = lcfirst(substr($method->name, 3));
|
$propertyName = lcfirst(substr($method->name, 3));
|
||||||
if (isset($this->properties[$propertyName])) {
|
if (isset($this->properties[$propertyName])) {
|
||||||
|
@ -26,30 +26,36 @@ use yii\apidoc\models\TraitDoc;
|
|||||||
echo $item->name;
|
echo $item->name;
|
||||||
?></h1>
|
?></h1>
|
||||||
<div id="nav">
|
<div id="nav">
|
||||||
<a href="index.html">All Classes</a>
|
<a href="index.html">All Classes</a>
|
||||||
<?php if(!($item instanceof InterfaceDoc) && !empty($item->properties)): ?>
|
<?php if(!($item instanceof InterfaceDoc) && !empty($item->properties)): ?>
|
||||||
| <a href="#properties">Properties</a>
|
| <a href="#properties">Properties</a>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php if(!empty($item->methods)): ?>
|
<?php if(!empty($item->methods)): ?>
|
||||||
| <a href="#methods">Methods</a>
|
| <a href="#methods">Methods</a>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php if($item instanceof ClassDoc && !empty($item->events)): ?>
|
<?php if($item instanceof ClassDoc && !empty($item->events)): ?>
|
||||||
| <a href="#events">Events</a>
|
| <a href="#events">Events</a>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
<?php if($item instanceof ClassDoc && !empty($item->constants)): ?>
|
||||||
|
| <a href="#constants">Constants</a>
|
||||||
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?= $this->render('classSummary', ['item' => $item]); ?>
|
<?= $this->render('classSummary', ['item' => $item]) ?>
|
||||||
|
|
||||||
<a name="properties"></a>
|
<a name="properties"></a>
|
||||||
<?php //$this->renderPartial('propertySummary',array('class'=>$item,'protected'=>false)); ?>
|
<?= $this->render('propertySummary', ['item' => $item,'protected' => false]) ?>
|
||||||
<?php //$this->renderPartial('propertySummary',array('class'=>$item,'protected'=>true)); ?>
|
<?= $this->render('propertySummary', ['item' => $item,'protected' => true]) ?>
|
||||||
|
|
||||||
<a name="methods"></a>
|
<a name="methods"></a>
|
||||||
<?php //$this->renderPartial('methodSummary',array('class'=>$item,'protected'=>false)); ?>
|
<?= $this->render('methodSummary', ['item' => $item, 'protected' => false]) ?>
|
||||||
<?php //$this->renderPartial('methodSummary',array('class'=>$item,'protected'=>true)); ?>
|
<?= $this->render('methodSummary', ['item' => $item, 'protected' => true]) ?>
|
||||||
|
|
||||||
<a name="events"></a>
|
<a name="events"></a>
|
||||||
<?php //$this->renderPartial('eventSummary',array('class'=>$item)); ?>
|
<?= $this->render('eventSummary', ['item' => $item]) ?>
|
||||||
|
|
||||||
|
<a name="constants"></a>
|
||||||
|
<?= $this->render('constSummary', ['item' => $item]) ?>
|
||||||
|
|
||||||
<?php //$this->renderPartial('propertyDetails',array('class'=>$item)); ?>
|
<?php //$this->renderPartial('propertyDetails',array('class'=>$item)); ?>
|
||||||
<?php //$this->renderPartial('methodDetails',array('class'=>$item)); ?>
|
<?php //$this->renderPartial('methodDetails',array('class'=>$item)); ?>
|
||||||
|
@ -1,60 +1,49 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use yii\apidoc\components\OfflineRenderer;
|
||||||
use yii\apidoc\models\ClassDoc;
|
use yii\apidoc\models\ClassDoc;
|
||||||
use yii\apidoc\models\InterfaceDoc;
|
use yii\apidoc\models\InterfaceDoc;
|
||||||
use yii\apidoc\models\TraitDoc;
|
use yii\apidoc\models\TraitDoc;
|
||||||
/**
|
/**
|
||||||
* @var ClassDoc|InterfaceDoc|TraitDoc $item
|
* @var ClassDoc|InterfaceDoc|TraitDoc $item
|
||||||
* @var yii\web\View $this
|
* @var yii\web\View $this
|
||||||
|
* @var OfflineRenderer $renderer
|
||||||
*/
|
*/
|
||||||
|
$renderer = $this->context;
|
||||||
|
|
||||||
?><table class="summaryTable docClass">
|
?><table class="summaryTable docClass">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col class="col-name" />
|
<col class="col-name" />
|
||||||
<col class="col-value" />
|
<col class="col-value" />
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<?php if ($item instanceof ClassDoc): ?>
|
<?php if ($item instanceof ClassDoc): ?>
|
||||||
<tr>
|
<tr><th>Inheritance</th><td><?= $renderer->renderInheritance($item) ?></td></tr>
|
||||||
<th>Inheritance</th>
|
<?php endif; ?>
|
||||||
<td><?php echo $this->context->renderInheritance($item); ?></td>
|
<?php if ($item instanceof ClassDoc && !empty($item->interfaces)): ?>
|
||||||
</tr>
|
<tr><th>Implements</th><td><?= $renderer->renderInterfaces($item->interfaces) ?></td></tr>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php if(!empty($item->interfaces)): ?>
|
<?php if(!($item instanceof InterfaceDoc) && !empty($item->traits)): ?>
|
||||||
<tr>
|
<tr><th>Uses Traits</th><td><?= $renderer->renderTraits($item->traits) ?></td></tr>
|
||||||
<th>Implements</th>
|
<?php endif; ?>
|
||||||
<td><?php echo $this->context->renderImplements($item); ?></td>
|
<?php if($item instanceof ClassDoc && !empty($item->subclasses)): ?>
|
||||||
</tr>
|
<tr><th>Subclasses</th><td><?= $renderer->renderClasses($item->subclasses) ?></td></tr>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php if(!($item instanceof InterfaceDoc) && !empty($item->traits)): ?>
|
<?php if ($item instanceof InterfaceDoc && !empty($item->implementedBy)): ?>
|
||||||
<tr>
|
<tr><th>Implemented by</th><td><?= $renderer->renderClasses($item->implementedBy) ?></td></tr>
|
||||||
<th>Uses Traits</th>
|
<?php endif; ?>
|
||||||
<td><?php echo $this->context->renderTraitUses($item); ?></td>
|
<?php if ($item instanceof TraitDoc && !empty($item->usedBy)): ?>
|
||||||
</tr>
|
<tr><th>Implemented by</th><td><?= $renderer->renderClasses($item->usedBy) ?></td></tr>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php if($item instanceof ClassDoc && !empty($item->subclasses)): ?>
|
<?php if(!empty($item->since)): ?>
|
||||||
<tr>
|
<tr><th>Available since version</th><td><?= $item->since ?></td></tr>
|
||||||
<th>Subclasses</th>
|
<?php endif; ?>
|
||||||
<td><?php echo $this->context->renderSubclasses($item); ?></td>
|
<tr>
|
||||||
</tr>
|
<th>Source Code</th>
|
||||||
<?php endif; ?>
|
<td><?php // TODO echo $this->renderSourceLink($item->sourcePath) ?></td>
|
||||||
<?php if(!empty($item->since)): ?>
|
</tr>
|
||||||
<tr>
|
|
||||||
<th>Since</th>
|
|
||||||
<td><?php echo $item->since; ?></td>
|
|
||||||
</tr>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if(!empty($item->version)): ?>
|
|
||||||
<tr>
|
|
||||||
<th>Version</th>
|
|
||||||
<td><?php echo $item->version; ?></td>
|
|
||||||
</tr>
|
|
||||||
<?php endif; ?>
|
|
||||||
<tr>
|
|
||||||
<th>Source Code</th>
|
|
||||||
<!-- <td>--><?php //echo $this->renderSourceLink($item->sourcePath); ?><!--</td>-->
|
|
||||||
</tr>
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<div id="classDescription">
|
<div id="classDescription">
|
||||||
<?php echo $item->description; ?>
|
<strong><?= $item->shortDescription ?></strong>
|
||||||
|
<p><?= nl2br($item->description) ?></p>
|
||||||
</div>
|
</div>
|
34
extensions/yii/apidoc/views/constSummary.php
Normal file
34
extensions/yii/apidoc/views/constSummary.php
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\apidoc\models\ClassDoc;
|
||||||
|
/**
|
||||||
|
* @var ClassDoc $item
|
||||||
|
* @var yii\web\View $this
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (empty($item->constants)) {
|
||||||
|
return;
|
||||||
|
} ?>
|
||||||
|
<div class="summary docConst">
|
||||||
|
<h2>Constants</h2>
|
||||||
|
|
||||||
|
<p><a href="#" class="toggle">Hide inherited constants</a></p>
|
||||||
|
|
||||||
|
<table class="summaryTable">
|
||||||
|
<colgroup>
|
||||||
|
<col class="col-const" />
|
||||||
|
<col class="col-description" />
|
||||||
|
<col class="col-defined" />
|
||||||
|
</colgroup>
|
||||||
|
<tr>
|
||||||
|
<th>Constant</th><th>Description</th><th>Defined By</th>
|
||||||
|
</tr>
|
||||||
|
<?php foreach($item->constants as $constant): ?>
|
||||||
|
<tr<?= $constant->definedBy != $item->name ? ' class="inherited"' : '' ?> id="<?= $constant->name ?>">
|
||||||
|
<td><?= $this->context->subjectLink($constant) ?></td>
|
||||||
|
<td><?= $constant->shortDescription ?></td>
|
||||||
|
<td><?= $this->context->typeLink($constant->definedBy) ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</table>
|
||||||
|
</div>
|
34
extensions/yii/apidoc/views/eventSummary.php
Normal file
34
extensions/yii/apidoc/views/eventSummary.php
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\apidoc\models\ClassDoc;
|
||||||
|
/**
|
||||||
|
* @var ClassDoc $item
|
||||||
|
* @var yii\web\View $this
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (empty($item->events)) {
|
||||||
|
return;
|
||||||
|
} ?>
|
||||||
|
<div class="summary docEvent">
|
||||||
|
<h2>Events</h2>
|
||||||
|
|
||||||
|
<p><a href="#" class="toggle">Hide inherited events</a></p>
|
||||||
|
|
||||||
|
<table class="summaryTable">
|
||||||
|
<colgroup>
|
||||||
|
<col class="col-event" />
|
||||||
|
<col class="col-description" />
|
||||||
|
<col class="col-defined" />
|
||||||
|
</colgroup>
|
||||||
|
<tr>
|
||||||
|
<th>Event</th><th>Description</th><th>Defined By</th>
|
||||||
|
</tr>
|
||||||
|
<?php foreach($item->events as $event): ?>
|
||||||
|
<tr<?= $event->definedBy != $item->name ? ' class="inherited"' : '' ?> id="<?= $event->name ?>">
|
||||||
|
<td><?= $this->context->subjectLink($event) ?></td>
|
||||||
|
<td><?= $event->shortDescription ?></td>
|
||||||
|
<td><?= $this->context->typeLink($event->definedBy) ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</table>
|
||||||
|
</div>
|
@ -23,7 +23,7 @@ use yii\apidoc\models\TraitDoc;
|
|||||||
ksort($items);
|
ksort($items);
|
||||||
foreach($items as $i=>$class): ?>
|
foreach($items as $i=>$class): ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php echo $this->context->link($class, $class->name); ?></td>
|
<td><?php echo $this->context->typeLink($class, $class->name); ?></td>
|
||||||
<td><?php echo $class->shortDescription; ?></td>
|
<td><?php echo $class->shortDescription; ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
40
extensions/yii/apidoc/views/methodSummary.php
Normal file
40
extensions/yii/apidoc/views/methodSummary.php
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\apidoc\models\ClassDoc;
|
||||||
|
use yii\apidoc\models\InterfaceDoc;
|
||||||
|
use yii\apidoc\models\TraitDoc;
|
||||||
|
/**
|
||||||
|
* @var ClassDoc|InterfaceDoc|TraitDoc $item
|
||||||
|
* @var boolean $protected
|
||||||
|
* @var yii\web\View $this
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ($protected && count($item->getProtectedMethods()) == 0 || !$protected && count($item->getPublicMethods()) == 0) {
|
||||||
|
return;
|
||||||
|
} ?>
|
||||||
|
|
||||||
|
<div class="summary docMethod">
|
||||||
|
<h2><?= $protected ? 'Protected Methods' : 'Public Methods' ?></h2>
|
||||||
|
|
||||||
|
<p><a href="#" class="toggle">Hide inherited methods</a></p>
|
||||||
|
|
||||||
|
<table class="summaryTable">
|
||||||
|
<colgroup>
|
||||||
|
<col class="col-method" />
|
||||||
|
<col class="col-description" />
|
||||||
|
<col class="col-defined" />
|
||||||
|
</colgroup>
|
||||||
|
<tr>
|
||||||
|
<th>Method</th><th>Description</th><th>Defined By</th>
|
||||||
|
</tr>
|
||||||
|
<?php foreach($item->methods as $method): ?>
|
||||||
|
<?php if($protected && $method->visibility == 'protected' || !$protected && $method->visibility != 'protected'): ?>
|
||||||
|
<tr<?= $method->definedBy != $item->name ? ' class="inherited"' : '' ?> id="<?= $method->name ?>">
|
||||||
|
<td><?= $this->context->subjectLink($method, $method->name.'()') ?></td>
|
||||||
|
<td><?= $method->shortDescription ?></td>
|
||||||
|
<td><?= $this->context->typeLink($method->definedBy) ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</table>
|
||||||
|
</div>
|
42
extensions/yii/apidoc/views/propertySummary.php
Normal file
42
extensions/yii/apidoc/views/propertySummary.php
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\apidoc\models\ClassDoc;
|
||||||
|
use yii\apidoc\models\InterfaceDoc;
|
||||||
|
use yii\apidoc\models\TraitDoc;
|
||||||
|
/**
|
||||||
|
* @var ClassDoc|InterfaceDoc|TraitDoc $item
|
||||||
|
* @var boolean $protected
|
||||||
|
* @var yii\web\View $this
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ($protected && count($item->getProtectedProperties()) == 0 || !$protected && count($item->getPublicProperties()) == 0) {
|
||||||
|
return;
|
||||||
|
} ?>
|
||||||
|
|
||||||
|
<div class="summary docProperty">
|
||||||
|
<h2><?= $protected ? 'Protected Properties' : 'Public Properties' ?></h2>
|
||||||
|
|
||||||
|
<p><a href="#" class="toggle">Hide inherited properties</a></p>
|
||||||
|
|
||||||
|
<table class="summaryTable">
|
||||||
|
<colgroup>
|
||||||
|
<col class="col-property" />
|
||||||
|
<col class="col-type" />
|
||||||
|
<col class="col-description" />
|
||||||
|
<col class="col-defined" />
|
||||||
|
</colgroup>
|
||||||
|
<tr>
|
||||||
|
<th>Property</th><th>Type</th><th>Description</th><th>Defined By</th>
|
||||||
|
</tr>
|
||||||
|
<?php foreach($item->properties as $property): ?>
|
||||||
|
<?php if($protected && $property->visibility == 'protected' || !$protected && $property->visibility != 'protected'): ?>
|
||||||
|
<tr<?= $property->definedBy != $item->name ? ' class="inherited"' : '' ?> id="<?= $property->name ?>">
|
||||||
|
<td><?php echo $this->context->subjectLink($property); ?></td>
|
||||||
|
<td><?php echo $this->context->typeLink($property->types); ?></td>
|
||||||
|
<td><?php echo $property->shortDescription; ?></td>
|
||||||
|
<td><?php echo $this->context->typeLink($property->definedBy); ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</table>
|
||||||
|
</div>
|
Reference in New Issue
Block a user