示例#1
0
 /**
  * Check if a request is sustainable (i.e. if method is registered)
  *
  * @param string $request_method
  *
  * @return \Comodojo\RpcServer\RpcMethod
  * @throws \Comodojo\Exception\RpcException
  */
 private function checkRequestSustainability($request_method)
 {
     $method = $this->parameters->methods()->get($request_method);
     if (is_null($method)) {
         throw new RpcException("Method not found", -32601);
     }
     return $method;
 }
示例#2
0
 /**
  * Execute call
  *
  * @param \Comodojo\RpcServer\Request\Parameters $params
  *
  * @return string
  */
 public static final function execute($params)
 {
     $asked_method = $params->get('method');
     $method = $params->methods()->get($asked_method);
     if (is_null($method)) {
         throw new RpcException("Method not found", -32601);
     }
     return $method->getDescription();
 }
示例#3
0
 /**
  * Execute call
  *
  * @param \Comodojo\RpcServer\Request\Parameters $params
  *
  * @return array
  */
 public static final function execute($params)
 {
     $asked_method = $params->get('method');
     $method = $params->methods()->get($asked_method);
     if (is_null($method)) {
         throw new RpcException("Method not found", -32601);
     }
     $signatures = $method->getSignatures();
     return sizeof($signatures) == 1 ? $signatures[0] : $signatures;
 }
示例#4
0
 /**
  * Execute call
  *
  * @param \Comodojo\RpcServer\Request\Parameters $params
  *
  * @return array
  */
 public static final function execute($params)
 {
     if ($params->protocol() != RpcServer::XMLRPC) {
         throw new RpcException($params->errors()->get(-31000), -31000);
     }
     $boxcarred_requests = $params->get('requests');
     $results = array();
     foreach ($boxcarred_requests as $position => $request) {
         $new_parameters = new Parameters($params->capabilities(), $params->methods(), $params->errors(), $params->logger(), $params->protocol());
         $results[$position] = self::singleCall($request, $new_parameters);
     }
     return $results;
 }
示例#5
0
 /**
  * Execute call
  *
  * @param \Comodojo\RpcServer\Request\Parameters $params
  *
  * @return array
  */
 public static final function execute($params)
 {
     $methods = $params->methods()->get();
     return array_keys($methods);
 }