/**
  * Since the Response is immutable, each behaviour has to return a new
  *  Response instance
  *
  * @param Response $response
  * @return Response
  * @throws Exception|RuntimeException
  */
 public function behave(Response $response)
 {
     $statusCodeIsToHigh = $response->statusCode() > $this->statusCode;
     if ($statusCodeIsToHigh) {
         throw new RuntimeException('limit of status code exceeded. dumping response: ' . implode(', ', $response->convertIntoAnArray()));
     }
     return $response;
 }
コード例 #2
0
 /**
  * Since the Response is immutable, each behaviour has to return a new
  *  Response instance
  *
  * @param Response $response
  * @return Response
  * @throws Exception
  */
 public function behave(Response $response)
 {
     return new Response(json_decode($response->content(), true), $response->contentType(), $response->error(), $response->errorCode(), $response->headerLines(), $response->statusCode());
 }