-
-
Notifications
You must be signed in to change notification settings - Fork 119
Expand file tree
/
Copy pathmethodDetails.php
More file actions
136 lines (115 loc) · 5.98 KB
/
methodDetails.php
File metadata and controls
136 lines (115 loc) · 5.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<?php
use Highlight\Highlighter;
use yii\apidoc\helpers\ApiMarkdown;
use yii\apidoc\models\ClassDoc;
use yii\apidoc\models\TraitDoc;
use yii\apidoc\templates\html\ApiRenderer;
use yii\helpers\ArrayHelper;
use yii\web\View;
/** @var View $this */
/** @var ClassDoc|TraitDoc $type */
/** @var Highlighter $highlighter */
/** @var ApiRenderer $renderer */
$renderer = $this->context;
$methods = $type->methods;
if (empty($methods)) {
return;
}
ArrayHelper::multisort($methods, 'name');
?>
<h2>Method Details</h2>
<div class="method-doc toggle-target-container">
<p><a href="#" class="toggle">Hide inherited methods</a></p>
<?php foreach ($methods as $method) { ?>
<div id="<?= $method->name . '()-detail' ?>"
class="<?= $method->definedBy !== $type->name ? 'inherited': '' ?>">
<div class="detail-header h3">
<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',
], $type) ?>
<?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 } ?>
<?= $method->name ?>()
<span class="detail-header-tag small">
<?= $method->visibility ?>
<?= $method->isAbstract ? 'abstract' : '' ?>
<?= $method->isStatic ? 'static' : '' ?>
method
<?= !empty($method->since) ? "(available since version $method->since)" : '' ?>
</span>
</div>
<?php if (!empty($method->deprecatedSince) || !empty($method->deprecatedReason)) { ?>
<div class="doc-description deprecated">
<strong>
Deprecated
<?php if (!empty($method->deprecatedSince)) {
echo 'since version ' . $method->deprecatedSince . ': ';
}
if (!empty($method->deprecatedReason)) {
echo ApiMarkdown::process($method->deprecatedReason, $method->definedBy, true);
} ?>
</strong>
</div>
<?php } ?>
<div class="doc-description">
<?php if ($type->name !== $method->definedBy) { ?>
<p>
<strong>Defined in:</strong>
<?= $renderer->createSubjectLink($method, $method->fullName . '()') ?>
</p>
<?php } ?>
<?php if ($method->shortDescription) : ?>
<p><strong><?= ApiMarkdown::process($method->shortDescription, $method->definedBy, true) ?></strong></p>
<?= ApiMarkdown::process($method->description, $method->definedBy) ?>
<?php endif; ?>
<?= $this->render('seeAlso', ['object' => $method]) ?>
</div>
<table class="detail-table table table-striped table-bordered table-hover">
<tr><td colspan="3" class="signature"><?= $renderer->renderMethodSignature($method, $type) ?></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->type, $method) ?></td>
<td class="param-desc-col">
<?= ApiMarkdown::process($param->description, $method->definedBy) ?>
</td>
</tr>
<?php } ?>
<?php if (!empty($method->return)) { ?>
<tr>
<th class="param-name-col">return</th>
<td class="param-type-col"><?= $renderer->createTypeLink($method->returnType, $method, null, [], $type) ?></td>
<td class="param-desc-col">
<?= ApiMarkdown::process($method->return, $method->definedBy) ?>
</td>
</tr>
<?php } ?>
<?php foreach ($method->exceptions as $exception) { ?>
<tr>
<th class="param-name-col">throws</th>
<td class="param-type-col"><?= $renderer->createTypeLink($exception->getType(), $method) ?></td>
<td class="param-desc-col">
<?= ApiMarkdown::process((string) $exception->getDescription(), $method->definedBy) ?>
</td>
</tr>
<?php } ?>
<?php } ?>
</table>
<?= $this->render('@yii/apidoc/templates/html/views/changelog', ['doc' => $method]) ?>
<?= $this->render('@yii/apidoc/templates/html/views/methodSourceCode',
['method' => $method, 'highlighter' => $highlighter]
) ?>
<?= $this->render('@yii/apidoc/templates/html/views/todos', ['doc' => $method]) ?>
</div>
<?php } ?>
</div>