Beispiel #1
0
 /**
  * Validate $request object.
  *
  * @throws \Josser\Exception\InvalidRequestException
  * @param \Josser\Client\Request\RequestInterface $request
  * @return \Josser\Client\Request\RequestInterface
  */
 private function validateRequest(RequestInterface $request)
 {
     $this->validateRequestMethod($request->getMethod());
     $this->validateRequestParams($request->getParams());
     if (!$this->isNotification($request)) {
         $this->validateRequestId($request->getId());
     }
     return $request;
 }
Beispiel #2
0
 /**
  * Check whether $request is a notification.
  *
  * @param \Josser\Client\Request\RequestInterface $request
  * @return boolean
  */
 public function isNotification(RequestInterface $request)
 {
     return $request->getId() === null;
 }
 public function __construct(RequestInterface $request, ResponseInterface $response)
 {
     $error = sprintf('Response id (%s) does not match request id (%s).', (string) $response->getId(), (string) $request->getId());
     parent::__construct($error);
 }