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

3
use yii\apidoc\helpers\Markdown;
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
use yii\apidoc\models\ClassDoc;
use yii\apidoc\models\TraitDoc;
/**
 * @var ClassDoc|TraitDoc $type
 * @var yii\web\View $this
 */

$methods = $type->getNativeMethods();
if (empty($methods)) {
	return;
} ?>
<h2>Method Details</h2>

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

	<div class="detailHeader" id="<?= $method->name . '()-detail' ?>">
		<?= $method->name ?>()
		<span class="detailHeaderTag">
			method
			<?php if (!empty($method->since)): ?>
				(available since version <?php echo $method->since; ?>)
			<?php endif; ?>
		</span>
	</div>

	<table class="summaryTable">
		<tr><td colspan="3">
			<div class="signature2">
			<?= $this->context->renderMethodSignature($method) ?>
			</div>
		</td></tr>
35
		<?php if(!empty($method->params) || !empty($method->return) || !empty($method->exceptions)): ?>
36 37 38 39
			<?php foreach($method->params as $param): ?>
				<tr>
				  <td class="paramNameCol"><?= $param->name ?></td>
				  <td class="paramTypeCol"><?= $this->context->typeLink($param->types) ?></td>
40
				  <td class="paramDescCol"><?= Markdown::process($param->description, $type) ?></td>
41 42 43 44
				</tr>
			<?php endforeach; ?>
			<?php if(!empty($method->return)): ?>
				<tr>
45
				  <td class="paramNameCol"><?= 'return'; ?></td>
46
				  <td class="paramTypeCol"><?= $this->context->typeLink($method->returnTypes); ?></td>
47
				  <td class="paramDescCol"><?= Markdown::process($method->return, $type); ?></td>
48 49
				</tr>
			<?php endif; ?>
50 51 52 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>
				  <td class="paramDescCol"><?= Markdown::process($description, $type) ?></td>
				</tr>
			<?php endforeach; ?>
57 58 59 60 61
		<?php endif; ?>
	</table>

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

62 63
	<p><?= Markdown::process($method->shortDescription, $type) ?></strong></p>
	<p><?= Markdown::process($method->description, $type) ?></p>
64 65 66 67

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

<?php endforeach; ?>