44 lines
1.0 KiB
PHP
Raw Normal View History

<?php
class Zend_View_Helper_DocMethod extends Zend_View_Helper_Abstract
{
public function docMethod($method)
{
$output = '';
$returnType = $method['return'];
$methodName = $method['name'];
$cptParameters = 0;
$parameters = '';
foreach ($method['params'] as $param) {
if (isset($param['optional'])) {
$parameters.= '[';
}
2010-09-20 15:08:45 +00:00
$parameters.= '<i>' . $param['type'] . '</i>';
$parameters.= '&nbsp;';
2010-09-20 15:08:45 +00:00
$parameters.= '<b>' . $param['name'] . '</b>';
if (isset($param['optional'])) {
if (isset($param['defaultValue'])) {
$parameters.= ' = ';
if (is_bool($param['defaultValue'])){
$parameters.= ($param['defaultValue'] === false) ? 'false' : 'true' ;
} else {
$parameters.= $param['defaultValue'];
}
}
$parameters.= ']';
}
$cptParameters++;
if ($cptParameters < count($method['params'])){
$parameters.= ', ';
}
}
2010-09-20 15:08:45 +00:00
$output = '<i>' . $returnType . '</i>';
$output.= ' ';
$output.= '<b>' . $methodName . '</b>' . ' <b>(</b> ' . $parameters . ' <b>)</b>';
return $output;
}
}