本文整理汇总了PHP中Zend_Server_Method_Definition::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Server_Method_Definition::getName方法的具体用法?PHP Zend_Server_Method_Definition::getName怎么用?PHP Zend_Server_Method_Definition::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Server_Method_Definition
的用法示例。
在下文中一共展示了Zend_Server_Method_Definition::getName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addMethod
/**
* Add method to definition
*
* @param array|Zend_Server_Method_Definition $method
* @param null|string $name
* @return Zend_Server_Definition
* @throws Zend_Server_Exception if duplicate or invalid method provided
*/
public function addMethod($method, $name = null)
{
if (is_array($method)) {
$method = new Zend_Server_Method_Definition($method);
} elseif (!$method instanceof Zend_Server_Method_Definition) {
throw new Zend_Server_Exception('Invalid method provided');
}
if (is_numeric($name)) {
$name = null;
}
if (null !== $name) {
$method->setName($name);
} else {
$name = $method->getName();
}
if (null === $name) {
throw new Zend_Server_Exception('No method name provided');
}
if (!$this->_overwriteExistingMethods && array_key_exists($name, $this->_methods)) {
throw new Zend_Server_Exception(sprintf('Method by name of "%s" already exists', $name));
}
$this->_methods[$name] = $method;
return $this;
}
示例2: _addMethodServiceMap
/**
* Add service method to service map
*
* @param Zend_Server_Reflection_Function $method
* @return void
*/
protected function _addMethodServiceMap(Zend_Server_Method_Definition $method)
{
$serviceInfo = array('name' => $method->getName(), 'return' => $this->_getReturnType($method));
$params = $this->_getParams($method);
$serviceInfo['params'] = $params;
$serviceMap = $this->getServiceMap();
if (false !== $serviceMap->getService($serviceInfo['name'])) {
$serviceMap->removeService($serviceInfo['name']);
}
$serviceMap->addService($serviceInfo);
}
示例3: _dispatch
/**
* Dispatch method
*
* @param Zend_Server_Method_Definition $invocable
* @param array $params
* @return mixed
*/
protected function _dispatch(Zend_Server_Method_Definition $invocable, array $params)
{
$callback = $invocable->getCallback();
$type = $callback->getType();
if ('function' == $type) {
$function = $callback->getFunction();
return call_user_func_array($function, $params);
}
$class = $callback->getClass();
$method = $callback->getMethod();
if ('static' == $type) {
return call_user_func_array(array($class, $method), $params);
}
if (!isset($this->_instances[$invocable->getName()])) {
$object = $invocable->getObject();
if (!is_object($object)) {
$invokeArgs = $invocable->getInvokeArguments();
if (!empty($invokeArgs)) {
$reflection = new ReflectionClass($class);
$object = $reflection->newInstanceArgs($invokeArgs);
} else {
$object = new $class();
}
}
$this->_instances[$invocable->getName()] = $object;
}
$object = $this->_instances[$invocable->getName()];
return call_user_func_array(array($object, $method), $params);
}