methodSummary.php 1.56 KB
Newer Older
1 2
<?php

3
use yii\apidoc\helpers\ApiMarkdown;
4 5 6
use yii\apidoc\models\ClassDoc;
use yii\apidoc\models\InterfaceDoc;
use yii\apidoc\models\TraitDoc;
7 8
use yii\helpers\ArrayHelper;

9 10 11 12
/* @var $type ClassDoc|InterfaceDoc|TraitDoc */
/* @var $protected boolean */
/* @var $this yii\web\View */
/* @var $renderer \yii\apidoc\templates\html\ApiRenderer */
13

14 15
$renderer = $this->context;

Carsten Brandt committed
16
if ($protected && count($type->getProtectedMethods()) == 0 || !$protected && count($type->getPublicMethods()) == 0) {
17
    return;
18 19
} ?>

Carsten Brandt committed
20
<div class="summary doc-method">
21 22 23 24
<h2><?= $protected ? 'Protected Methods' : 'Public Methods' ?></h2>

<p><a href="#" class="toggle">Hide inherited methods</a></p>

Carsten Brandt committed
25
<table class="summary-table table table-striped table-bordered table-hover">
26
<colgroup>
27 28 29
    <col class="col-method" />
    <col class="col-description" />
    <col class="col-defined" />
30 31 32 33
</colgroup>
<tr>
  <th>Method</th><th>Description</th><th>Defined By</th>
</tr>
34 35 36
<?php
$methods = $type->methods;
ArrayHelper::multisort($methods, 'name');
Alexander Mohorev committed
37
foreach ($methods as $method): ?>
38 39 40 41 42 43 44
    <?php if ($protected && $method->visibility == 'protected' || !$protected && $method->visibility != 'protected'): ?>
    <tr<?= $method->definedBy != $type->name ? ' class="inherited"' : '' ?> id="<?= $method->name ?>()">
        <td><?= $renderer->createSubjectLink($method, $method->name.'()') ?></td>
        <td><?= ApiMarkdown::process($method->shortDescription, $method->definedBy, true) ?></td>
        <td><?= $renderer->createTypeLink($method->definedBy, $type) ?></td>
    </tr>
    <?php endif; ?>
45 46
<?php endforeach; ?>
</table>
47
</div>