seeAlso.php 997 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. /* @var $object yii\apidoc\models\BaseDoc */
  3. /* @var $this yii\web\View */
  4. $type = $object instanceof \yii\apidoc\models\TypeDoc ? $object : $object->definedBy;
  5. $see = [];
  6. foreach ($object->tags as $tag) {
  7. /** @var $tag phpDocumentor\Reflection\DocBlock\Tag\SeeTag */
  8. if (get_class($tag) == 'phpDocumentor\Reflection\DocBlock\Tag\SeeTag') {
  9. $ref = $tag->getReference();
  10. if (strpos($ref, '://') === false) {
  11. $ref = '[[' . $ref . ']]';
  12. }
  13. $see[] = rtrim(\yii\apidoc\helpers\ApiMarkdown::process($ref . ' ' . $tag->getDescription(), $type, true), ". \r\n");
  14. }
  15. }
  16. if (empty($see)) {
  17. return;
  18. } elseif (count($see) == 1) {
  19. echo '<p>See also ' . reset($see) . '.</p>';
  20. } else {
  21. echo '<p>See also:</p><ul>';
  22. foreach ($see as $ref) {
  23. if (!empty($ref)) {
  24. if (substr_compare($ref, '>', -1, 1)) {
  25. $ref .= '.';
  26. }
  27. echo "<li>$ref</li>";
  28. }
  29. }
  30. echo '</ul>';
  31. }