methodDetails.php 2.24 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 11 12 13 14 15
/**
 * @var ClassDoc|TraitDoc $type
 * @var yii\web\View $this
 */

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

<?php foreach($methods as $method): ?>

23
	<div class="detailHeader h3" id="<?= $method->name . '()-detail' ?>">
24
		<?= $method->name ?>()
25
		<span class="detailHeaderTag small">
26
			<?= $method->visibility ?>
27 28
			method
			<?php if (!empty($method->since)): ?>
Alexander Mohorev committed
29
				(available since version <?= $method->since ?>)
30 31 32 33
			<?php endif; ?>
		</span>
	</div>

34
	<table class="summaryTable table table-striped table-bordered table-hover">
35
		<tr><td colspan="3">
36
			<div class="signature2"><?= $this->context->renderMethodSignature($method) ?></div>
37
		</td></tr>
38
		<?php if(!empty($method->params) || !empty($method->return) || !empty($method->exceptions)): ?>
39 40 41 42
			<?php foreach($method->params as $param): ?>
				<tr>
				  <td class="paramNameCol"><?= $param->name ?></td>
				  <td class="paramTypeCol"><?= $this->context->typeLink($param->types) ?></td>
43
				  <td class="paramDescCol"><?= ApiMarkdown::process($param->description, $type) ?></td>
44 45 46 47
				</tr>
			<?php endforeach; ?>
			<?php if(!empty($method->return)): ?>
				<tr>
48
				  <td class="paramNameCol"><?= 'return'; ?></td>
49
				  <td class="paramTypeCol"><?= $this->context->typeLink($method->returnTypes); ?></td>
50
				  <td class="paramDescCol"><?= ApiMarkdown::process($method->return, $type); ?></td>
51 52
				</tr>
			<?php endif; ?>
53 54 55 56
			<?php foreach($method->exceptions as $exception => $description): ?>
				<tr>
				  <td class="paramNameCol"><?= 'throws' ?></td>
				  <td class="paramTypeCol"><?= $this->context->typeLink($exception) ?></td>
57
				  <td class="paramDescCol"><?= ApiMarkdown::process($description, $type) ?></td>
58 59
				</tr>
			<?php endforeach; ?>
60 61 62 63 64
		<?php endif; ?>
	</table>

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

65 66
	<p><strong><?= ApiMarkdown::process($method->shortDescription, $type, true) ?></strong></p>
	<?= ApiMarkdown::process($method->description, $type) ?>
67 68 69 70

	<?= $this->render('seeAlso', ['object' => $method]); ?>

<?php endforeach; ?>