Files
yii2/extensions/apidoc/templates/html/views/methodDetails.php
Carsten Brandt 1b7e1cd027 Merge pull request #2605 branch 'feature' of https://github.com/mongosoft/yii2 into code-style
* 'feature' of https://github.com/mongosoft/yii2:
  returned back formatting language files
  code style. WHILE
  code style. FOR
  code style. FOREACH
  code style. operator IF
  @param, @var, @property and @return must declare types as boolean, integer, string, array or null
  short echo tags
  short array syntax

Conflicts:
	extensions/apidoc/commands/RenderController.php
	extensions/apidoc/models/BaseDoc.php
	extensions/apidoc/models/Context.php
	extensions/apidoc/templates/bootstrap/Renderer.php
	extensions/apidoc/templates/bootstrap/layouts/guide.php
	extensions/apidoc/templates/bootstrap/layouts/main.php
	extensions/apidoc/templates/bootstrap/views/index.php
	extensions/apidoc/templates/html/Renderer.php
	extensions/apidoc/templates/offline/views/index.php
	extensions/apidoc/templates/offline/views/offline.php
	extensions/apidoc/templates/online/views/index.php
	extensions/elasticsearch/Connection.php
	extensions/redis/ActiveQuery.php
	framework/base/ErrorException.php
	framework/helpers/BaseFileHelper.php
	tests/unit/framework/helpers/FileHelperTest.php
2014-03-07 21:54:44 +01:00

78 lines
2.6 KiB
PHP

<?php
use yii\apidoc\helpers\ApiMarkdown;
use yii\apidoc\models\ClassDoc;
use yii\apidoc\models\TraitDoc;
use yii\helpers\ArrayHelper;
/**
* @var ClassDoc|TraitDoc $type
* @var yii\web\View $this
* @var \yii\apidoc\templates\html\ApiRenderer $renderer
*/
$renderer = $this->context;
$methods = $type->getNativeMethods();
if (empty($methods)) {
return;
}
ArrayHelper::multisort($methods, 'name');
?>
<h2>Method Details</h2>
<?php foreach ($methods as $method): ?>
<div class="detailHeader h3" id="<?= $method->name . '()-detail' ?>">
<?= $method->name ?>()
<span class="detailHeaderTag small">
<?= $method->visibility ?>
method
<?php if (!empty($method->since)): ?>
(available since version <?= $method->since ?>)
<?php endif; ?>
</span>
</div>
<table class="summaryTable table table-striped table-bordered table-hover">
<tr><td colspan="3">
<div class="signature2"><?= $renderer->renderMethodSignature($method) ?></div>
</td></tr>
<?php if (!empty($method->params) || !empty($method->return) || !empty($method->exceptions)): ?>
<?php foreach ($method->params as $param): ?>
<tr>
<td class="paramNameCol"><?= $param->name ?></td>
<td class="paramTypeCol"><?= $renderer->createTypeLink($param->types) ?></td>
<td class="paramDescCol"><?= ApiMarkdown::process($param->description, $type) ?></td>
</tr>
<?php endforeach; ?>
<?php if (!empty($method->return)): ?>
<tr>
<td class="paramNameCol"><?= 'return'; ?></td>
<td class="paramTypeCol"><?= $renderer->createTypeLink($method->returnTypes); ?></td>
<td class="paramDescCol"><?= ApiMarkdown::process($method->return, $type); ?></td>
</tr>
<?php endif; ?>
<?php foreach ($method->exceptions as $exception => $description): ?>
<tr>
<td class="paramNameCol"><?= 'throws' ?></td>
<td class="paramTypeCol"><?= $renderer->createTypeLink($exception) ?></td>
<td class="paramDescCol"><?= ApiMarkdown::process($description, $type) ?></td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
<?php if(($sourceUrl = $renderer->getSourceUrl($method->definedBy, $method->startLine)) !== null): ?>
<tr>
<td colspan="3">Source Code: <a href="<?= $sourceUrl ?>"><?= $sourceUrl ?></a></td>
</tr>
<?php endif; ?>
</table>
<!-- --><?php //$this->renderPartial('sourceCode',array('object'=>$method)); ?>
<p><strong><?= ApiMarkdown::process($method->shortDescription, $type, true) ?></strong></p>
<?= ApiMarkdown::process($method->description, $type) ?>
<?= $this->render('seeAlso', ['object' => $method]); ?>
<?php endforeach; ?>