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

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

$see = [];
Alexander Mohorev committed
9
foreach ($object->tags as $tag) {
10 11 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 . ']]';
        }
        $see[] = rtrim(\yii\apidoc\helpers\ApiMarkdown::process($ref . ' ' . $tag->getDescription(), $object->definedBy, true), ". \r\n");
    }
18 19
}
if (empty($see)) {
20
    return;
Carsten Brandt committed
21
} elseif (count($see) == 1) {
22
    echo '<p>See also ' . reset($see) . '.</p>';
Carsten Brandt committed
23
} else {
24 25 26 27 28 29 30 31
    echo '<p>See also:</p><ul>';
    foreach ($see as $ref) {
        if (substr($ref, -1, 1) != '>') {
            $ref .= '.';
        }
        echo "<li>$ref</li>";
    }
    echo '</ul>';
32
}