methodDetails.php 3.51 KB
Newer Older
1 2
<?php

3
use yii\apidoc\helpers\ApiMarkdown;
4 5
use yii\apidoc\models\ClassDoc;
use yii\apidoc\models\TraitDoc;
6 7
use yii\helpers\ArrayHelper;

8 9 10
/* @var $type ClassDoc|TraitDoc */
/* @var $this yii\web\View */
/* @var $renderer \yii\apidoc\templates\html\ApiRenderer */
11

12 13
$renderer = $this->context;

14 15
$methods = $type->getNativeMethods();
if (empty($methods)) {
16
    return;
17 18 19
}
ArrayHelper::multisort($methods, 'name');
?>
20 21
<h2>Method Details</h2>

Carsten Brandt committed
22
<div class="method-doc">
Alexander Mohorev committed
23
<?php foreach ($methods as $method): ?>
24

25 26 27 28 29 30
    <div class="detail-header h3" id="<?= $method->name . '()-detail' ?>">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <?= $renderer->createSubjectLink($method, '<span class="glyphicon icon-hash"></span>', [
            'title' => 'direct link to this method',
            'class' => 'tool-link hash',
        ]) ?>
Carsten Brandt committed
31

32 33 34 35
        <?php if (($sourceUrl = $renderer->getSourceUrl($method->definedBy, $method->startLine)) !== null): ?>
            <a href="<?= str_replace('/blob/', '/edit/', $sourceUrl) ?>" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="<?= $sourceUrl ?>" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        <?php endif; ?>
Carsten Brandt committed
36

37 38 39 40 41 42 43 44 45
        <?= $method->name ?>()
        <span class="detail-header-tag small">
            <?= $method->visibility ?>
            method
            <?php if (!empty($method->since)): ?>
                (available since version <?= $method->since ?>)
            <?php endif; ?>
        </span>
    </div>
46

47 48
    <div class="doc-description">
        <p><strong><?= ApiMarkdown::process($method->shortDescription, $type, true) ?></strong></p>
Carsten Brandt committed
49

50
        <?= ApiMarkdown::process($method->description, $type) ?>
Carsten Brandt committed
51

52 53
        <?= $this->render('seeAlso', ['object' => $method]) ?>
    </div>
Carsten Brandt committed
54

55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><?= $renderer->renderMethodSignature($method) ?></td></tr>
        <?php if (!empty($method->params) || !empty($method->return) || !empty($method->exceptions)): ?>
            <?php foreach ($method->params as $param): ?>
                <tr>
                  <td class="param-name-col"><?= ApiMarkdown::highlight($param->name, 'php') ?></td>
                  <td class="param-type-col"><?= $renderer->createTypeLink($param->types) ?></td>
                  <td class="param-desc-col"><?= ApiMarkdown::process($param->description, $type) ?></td>
                </tr>
            <?php endforeach; ?>
            <?php if (!empty($method->return)): ?>
                <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><?= $renderer->createTypeLink($method->returnTypes) ?></td>
                  <td class="param-desc-col"><?= ApiMarkdown::process($method->return, $type) ?></td>
                </tr>
            <?php endif; ?>
            <?php foreach ($method->exceptions as $exception => $description): ?>
                <tr>
                  <th class="param-name-col">throws</th>
                  <td class="param-type-col"><?= $renderer->createTypeLink($exception) ?></td>
                  <td class="param-desc-col"><?= ApiMarkdown::process($description, $type) ?></td>
                </tr>
            <?php endforeach; ?>
        <?php endif; ?>
    </table>
81 82 83

<!--	--><?php //$this->renderPartial('sourceCode',array('object'=>$method)); ?>

Luciano Baraglia committed
84
<?php endforeach; ?>
Carsten Brandt committed
85
</div>