Пример #1
0
 /**
  * Parse request
  *
  * @param \Zend\Http\Request $request
  * @param \Zend\Http\Response $request
  * @return string|null $error
  */
 public function parse(Request $request, Response $response)
 {
     $error = parent::parse($request, $response);
     if ($error) {
         return $error;
     }
     $body = json_decode($request->getContent());
     if (empty($body)) {
         return self::PARSE;
     }
     if (empty($body->method) || !isset($body->params)) {
         return self::INVALID_REQUEST;
     }
     $this->id = $body->id;
     $this->method = $body->method;
     $this->params = $body->params;
     return null;
 }
Пример #2
0
 /**
  * Parse request
  *
  * @param \Zend\Http\Request $request
  * @param \Zend\Http\Response $request
  * @return string|null $error
  */
 public function parse(Request $request, Response $response)
 {
     $error = parent::parse($request, $response);
     if ($error) {
         return $error;
     }
     $method = null;
     $params = xmlrpc_decode_request($request->getContent(), $method, 'utf-8');
     if (!$params) {
         return self::PARSE;
     }
     if (empty($method) || empty($params)) {
         return self::INVALID_REQUEST;
     }
     $this->method = $method;
     $this->params = $params;
     return null;
 }