本文整理匯總了PHP中Zend_Server_Method_Definition::getPrototypes方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Server_Method_Definition::getPrototypes方法的具體用法?PHP Zend_Server_Method_Definition::getPrototypes怎麽用?PHP Zend_Server_Method_Definition::getPrototypes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend_Server_Method_Definition
的用法示例。
在下文中一共展示了Zend_Server_Method_Definition::getPrototypes方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _getReturnType
/**
* 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;
}
示例2: _getParams
/**
* 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;
}