methodSummary.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. use yii\apidoc\helpers\ApiMarkdown;
  3. use yii\apidoc\models\ClassDoc;
  4. use yii\apidoc\models\InterfaceDoc;
  5. use yii\apidoc\models\TraitDoc;
  6. use yii\helpers\ArrayHelper;
  7. /* @var $type ClassDoc|InterfaceDoc|TraitDoc */
  8. /* @var $protected boolean */
  9. /* @var $this yii\web\View */
  10. /* @var $renderer \yii\apidoc\templates\html\ApiRenderer */
  11. $renderer = $this->context;
  12. if ($protected && count($type->getProtectedMethods()) == 0 || !$protected && count($type->getPublicMethods()) == 0) {
  13. return;
  14. } ?>
  15. <div class="summary doc-method">
  16. <h2><?= $protected ? 'Protected Methods' : 'Public Methods' ?></h2>
  17. <p><a href="#" class="toggle">Hide inherited methods</a></p>
  18. <table class="summary-table table table-striped table-bordered table-hover">
  19. <colgroup>
  20. <col class="col-method" />
  21. <col class="col-description" />
  22. <col class="col-defined" />
  23. </colgroup>
  24. <tr>
  25. <th>Method</th><th>Description</th><th>Defined By</th>
  26. </tr>
  27. <?php
  28. $methods = $type->methods;
  29. ArrayHelper::multisort($methods, 'name');
  30. foreach ($methods as $method): ?>
  31. <?php if ($protected && $method->visibility == 'protected' || !$protected && $method->visibility != 'protected'): ?>
  32. <tr<?= $method->definedBy != $type->name ? ' class="inherited"' : '' ?> id="<?= $method->name ?>()">
  33. <td><?= $renderer->createSubjectLink($method, $method->name.'()') ?></td>
  34. <td><?= ApiMarkdown::process($method->shortDescription, $method->definedBy, true) ?></td>
  35. <td><?= $renderer->createTypeLink($method->definedBy, $type) ?></td>
  36. </tr>
  37. <?php endif; ?>
  38. <?php endforeach; ?>
  39. </table>
  40. </div>