/** * 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(); }
/** * 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; }
/** * 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; }
/** * Perform a single call * * @param array $request * @param \Comodojo\RpcServer\Request\Parameters $parameters_object * * @return mixed */ private static function singleCall($request, $parameters_object) { if (!isset($request[0]) || !isset($request[1])) { return self::packError(-32600, $parameters_object->errors()->get(-32600)); } if ($request[0] == 'system.multicall') { return self::packError(-31001, $parameters_object->errors()->get(-31001)); } $payload = array($request[0], $request[1]); try { $result = XmlProcessor::process($payload, $parameters_object, $parameters_object->logger()); } catch (RpcException $re) { return self::packError($re->getCode(), $re->getMessage()); } catch (Exception $e) { return self::packError(-32500, $re->getMessage()); } return $result; }
/** * Execute call * * @param \Comodojo\RpcServer\Request\Parameters $params * * @return array */ public static final function execute($params) { return $params->capabilities()->get(); }
/** * Execute call * * @param \Comodojo\RpcServer\Request\Parameters $params * * @return array */ public static final function execute($params) { $methods = $params->methods()->get(); return array_keys($methods); }