/** * Get method return type * * @param Zend_Server_Reflection_Function_Abstract $method * @return string|array */ protected function _getReturnType(Zend_Server_Method_Definition $method) { $return = array(); foreach ($method->getPrototypes() as $prototype) { $return[] = $prototype->getReturnType(); } if (1 == count($return)) { return $return[0]; } return $return; }
/** * Get method param type * * @param Zend_Server_Reflection_Function_Abstract $method * @return string|array */ protected function _getParams(Zend_Server_Method_Definition $method) { $params = array(); foreach ($method->getPrototypes() as $prototype) { foreach ($prototype->getParameterObjects() as $key => $parameter) { if (!isset($params[$key])) { $params[$key] = array('type' => $parameter->getType(), 'name' => $parameter->getName(), 'optional' => $parameter->isOptional()); if (null !== ($default = $parameter->getDefaultValue())) { $params[$key]['default'] = $default; } $description = $parameter->getDescription(); if (!empty($description)) { $params[$key]['description'] = $description; } continue; } $newType = $parameter->getType(); if (!is_array($params[$key]['type'])) { if ($params[$key]['type'] == $newType) { continue; } $params[$key]['type'] = (array) $params[$key]['type']; } elseif (in_array($newType, $params[$key]['type'])) { continue; } array_push($params[$key]['type'], $parameter->getType()); } } return $params; }