seeAlso.php 939 Bytes
Newer Older
1 2 3 4 5 6 7
<?php

/**
 * @var yii\apidoc\models\BaseDoc $object
 * @var yii\web\View $this
 */

8 9
$type = $object instanceof \yii\apidoc\models\TypeDoc ? $object : $object->definedBy;

10
$see = [];
Alexander Mohorev committed
11
foreach ($object->tags as $tag) {
12 13 14 15 16 17
    /** @var $tag phpDocumentor\Reflection\DocBlock\Tag\SeeTag */
    if (get_class($tag) == 'phpDocumentor\Reflection\DocBlock\Tag\SeeTag') {
        $ref = $tag->getReference();
        if (strpos($ref, '://') === false) {
            $ref = '[[' . $ref . ']]';
        }
18
        $see[] = rtrim(\yii\apidoc\helpers\ApiMarkdown::process($ref . ' ' . $tag->getDescription(), $type, true), ". \r\n");
19
    }
20 21
}
if (empty($see)) {
22
    return;
Carsten Brandt committed
23
} elseif (count($see) == 1) {
24
    echo '<p>See also ' . reset($see) . '.</p>';
Carsten Brandt committed
25
} else {
26 27 28 29 30 31 32 33
    echo '<p>See also:</p><ul>';
    foreach ($see as $ref) {
        if (substr($ref, -1, 1) != '>') {
            $ref .= '.';
        }
        echo "<li>$ref</li>";
    }
    echo '</ul>';
34
}