2010-09-17 14:48:06 +00:00
|
|
|
<?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) {
|
2010-09-30 07:15:53 +00:00
|
|
|
if (isset($param['optional'])) {
|
2010-09-17 14:48:06 +00:00
|
|
|
$parameters.= '[';
|
|
|
|
}
|
2010-09-20 15:08:45 +00:00
|
|
|
$parameters.= '<i>' . $param['type'] . '</i>';
|
2010-09-17 14:48:06 +00:00
|
|
|
$parameters.= ' ';
|
2010-09-20 15:08:45 +00:00
|
|
|
$parameters.= '<b>' . $param['name'] . '</b>';
|
2010-09-17 14:48:06 +00:00
|
|
|
|
2010-09-30 07:15:53 +00:00
|
|
|
if (isset($param['optional'])) {
|
2010-09-17 14:48:06 +00:00
|
|
|
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>';
|
2010-09-17 14:48:06 +00:00
|
|
|
return $output;
|
|
|
|
}
|
|
|
|
}
|