InternalHttpException.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace Dingo\Api\Exception;
  3. use Exception;
  4. use Symfony\Component\HttpFoundation\Response;
  5. use Symfony\Component\HttpKernel\Exception\HttpException;
  6. class InternalHttpException extends HttpException
  7. {
  8. /**
  9. * The response.
  10. *
  11. * @var \Illuminate\Http\Response
  12. */
  13. protected $response;
  14. /**
  15. * Create a new internal HTTP exception instance.
  16. *
  17. * @param \Symfony\Component\HttpFoundation\Response $response
  18. * @param string $message
  19. * @param \Exception $previous
  20. * @param array $headers
  21. * @param int $code
  22. * @return void
  23. */
  24. public function __construct(Response $response, $message = null, Exception $previous = null, array $headers = [], $code = 0)
  25. {
  26. $this->response = $response;
  27. parent::__construct($response->getStatusCode(), $message, $previous, $headers, $code);
  28. }
  29. /**
  30. * Get the response of the internal request.
  31. *
  32. * @return \Illuminate\Http\Response
  33. */
  34. public function getResponse()
  35. {
  36. return $this->response;
  37. }
  38. }