Exemplo n.º 1
0
 public function dispatch()
 {
     $providerSignature = ZendL_Tool_Rpc_Provider_Registry::getInstance()->getProviderSignature($this->_request->getProviderName());
     $provider = $providerSignature->getProvider();
     $actionName = $this->_request->getActionName();
     if (!($actionableMethod = $providerSignature->getActionableMethod($actionName))) {
         require_once 'ZendL/Tool/Rpc/Endpoint/Exception.php';
         throw new ZendL_Tool_Rpc_Endpoint_Exception('Dispatcher error - actionable method not found');
     }
     $methodName = $actionableMethod['methodName'];
     $methodParameters = $actionableMethod['parameterInfo'];
     $requestParameters = $this->_request->getProviderParameters();
     // @todo This seems hackish, determine if there is a better way
     $callParameters = array();
     foreach ($methodParameters as $methodParameterName => $methodParameterValue) {
         $callParameters[] = array_key_exists($methodParameterName, $requestParameters) ? $requestParameters[$methodParameterName] : $methodParameterValue['default'];
     }
     if (($specialtyName = $this->_request->getSpecialtyName()) != '_Global') {
         $methodName .= $specialtyName;
     }
     if (method_exists($provider, $methodName)) {
         call_user_func_array(array($provider, $methodName), $callParameters);
     } elseif (method_exists($provider, $methodName . 'Action')) {
         $method .= 'Action';
         call_user_func_array(array($provider, $methodName), $callParameters);
     } else {
         require_once 'ZendL/Tool/Rpc/Endpoint/Exception.php';
         throw new ZendL_Tool_Rpc_Endpoint_Exception('Not a supported method.');
     }
 }
Exemplo n.º 2
0
 public function dispatch()
 {
     $providerSignature = ZendL_Tool_Rpc_Provider_Registry::getInstance()->getProviderSignature($this->_request->getProviderName());
     $provider = $providerSignature->getProvider();
     $method = $this->_request->getActionName();
     $signatureParameters = $providerSignature->getActionableMethods();
     $signatureParametersLower = array_change_key_case($signatureParameters, CASE_LOWER);
     $methodParameters = $signatureParametersLower[strtolower($method)]['parameterInfo'];
     $requestParameters = $this->_request->getProviderParameters();
     // @todo This seems hackish, determine if there is a better way
     $callParameters = array();
     foreach ($methodParameters as $methodParameterName => $methodParameterValue) {
         $callParameters[] = array_key_exists($methodParameterName, $requestParameters) ? $requestParameters[$methodParameterName] : $methodParameterValue['default'];
     }
     if (($specialtyName = $this->_request->getSpecialtyName()) != '_Global') {
         $method .= $specialtyName;
     }
     if (method_exists($provider, $method)) {
         call_user_func_array(array($provider, $method), $callParameters);
     } elseif (method_exists($provider, $method . 'Action')) {
         $method .= 'Action';
         call_user_func_array(array($provider, $method), $callParameters);
     } else {
         throw new ZendL_Tool_Exception('Not a supported method.');
     }
 }