Determines the method help/description text from the function DocBlock comment. Determines method signatures using a combination of ReflectionFunction and parsing of DocBlock
263 $signatures = array();
265 $paramCount = $function->getNumberOfParameters();
266 $paramCountRequired = $function->getNumberOfRequiredParameters();
267 $parameters = $function->getParameters();
268 $docBlock = $function->getDocComment();
270 if (!empty($docBlock)) {
272 if (preg_match(
':/\*\*\s*\r?\n\s*\*\s(.*?)\r?\n\s*\*(\s@|/):s', $docBlock, $matches))
274 $helpText = $matches[1];
275 $helpText = preg_replace(
'/(^\s*\*\s)/m',
'', $helpText);
276 $helpText = preg_replace(
'/\r?\n\s*\*\s*(\r?\n)*/s',
"\n", $helpText);
277 $helpText = trim($helpText);
282 if (preg_match(
'/@return\s+(\S+)/', $docBlock, $matches)) {
283 $return = explode(
'|', $matches[1]);
284 if (preg_match(
'/@return\s+\S+\s+(.*?)(@|\*\/)/s', $docBlock, $matches))
289 $returnDesc = trim(
$value);
294 if (preg_match_all(
'/@param\s+([^\s]+)/m', $docBlock, $matches)) {
295 $paramTypesTmp = $matches[1];
296 if (preg_match_all(
'/@param\s+\S+\s+(\$\S+)\s+(.*?)(?=@|\*\/)/s', $docBlock, $matches))
298 $paramDesc = $matches[2];
299 foreach ($paramDesc as $key =>
$value) {
302 $paramDesc[$key] = trim(
$value);
307 $helpText = $function->getName();
311 $paramTypesTmp = array();
312 foreach ($parameters as
$i => $param) {
313 $paramType =
'mixed';
314 if ($param->isArray()) {
315 $paramType =
'array';
317 $paramTypesTmp[
$i] = $paramType;
325 if (!isset($paramTypesTmp) && (0 < $paramCount)) {
326 $paramTypesTmp = array_fill(0, $paramCount,
'mixed');
327 }
elseif (!isset($paramTypesTmp)) {
328 $paramTypesTmp = array();
329 }
elseif (count($paramTypesTmp) < $paramCount) {
330 $start = $paramCount - count($paramTypesTmp);
332 $paramTypesTmp[
$i] =
'mixed';
337 if (!isset($paramDesc) && (0 < $paramCount)) {
338 $paramDesc = array_fill(0, $paramCount,
'');
339 }
elseif (!isset($paramDesc)) {
340 $paramDesc = array();
341 }
elseif (count($paramDesc) < $paramCount) {
342 $start = $paramCount - count($paramDesc);
348 if (count($paramTypesTmp) != $paramCount) {
349 #require_once 'Zend/Server/Reflection/Exception.php'; 351 'Variable number of arguments is not supported for services (except optional parameters). ' 352 .
'Number of function arguments in ' . $function->getDeclaringClass()->getName() .
'::' 353 . $function->getName() .
'() must correspond to actual number of arguments described in the ' 357 $paramTypes = array();
358 foreach ($paramTypesTmp as
$i => $param) {
359 $tmp = explode(
'|', $param);
360 if ($parameters[
$i]->isOptional()) {
361 array_unshift($tmp,
null);
363 $paramTypes[] = $tmp;
elseif(isset( $params[ 'redirect_parent']))
_buildSignatures($return, $returnDesc, $paramTypes, $paramDesc)