Example #1
0
 public function onRequestCompletion(Event $event)
 {
     $this->setResponse(Response::fromParent($event['response']));
     if (null === $this->exceptionHandler) {
         $this->setExceptionHandler();
     }
     $handlerResponse = $this->exceptionHandler->setRequest($event['request'])->setResponse($event['response'])->setExpectedResponse($this->expectedResponse)->handle();
     if ($handlerResponse instanceof RequestException) {
         throw $handlerResponse;
     } elseif (is_callable($handlerResponse)) {
         // @codeCoverageIgnoreStart
         return call_user_func($handlerResponse, $event['response']);
         // @codeCoverageIgnoreEnd
     }
 }