seeAlso.php 997 Bytes
Newer Older
1 2
<?php

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

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

8
$see = [];
Alexander Mohorev committed
9
foreach ($object->tags as $tag) {
10 11 12 13 14 15
    /** @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 . ']]';
        }
16
        $see[] = rtrim(\yii\apidoc\helpers\ApiMarkdown::process($ref . ' ' . $tag->getDescription(), $type, true), ". \r\n");
17
    }
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
    echo '<p>See also:</p><ul>';
    foreach ($see as $ref) {
26 27 28 29 30
        if (!empty($ref)) {
            if (substr_compare($ref, '>', -1, 1)) {
                $ref .= '.';
            }
            echo "<li>$ref</li>";
31 32 33
        }
    }
    echo '</ul>';
34
}