當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_Server_Method_Definition::getName方法代碼示例

本文整理匯總了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;
 }
開發者ID:NerdGZ,項目名稱:icingaweb2,代碼行數:32,代碼來源:Definition.php

示例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);
 }
開發者ID:yonetici,項目名稱:pimcore-coreshop-demo,代碼行數:17,代碼來源:Server.php

示例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);
 }
開發者ID:roed,項目名稱:zend-mvc-extend,代碼行數:36,代碼來源:Server.php


注:本文中的Zend_Server_Method_Definition::getName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。