SergiX44/XBackBone

View on GitHub
app/Exceptions/ValidationException.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php


namespace App\Exceptions;

use Exception;
use Psr\Http\Message\ResponseInterface as Response;
use Throwable;

class ValidationException extends Exception
{
    /**
     * @var Response
     */
    private $response;

    public function __construct(Response $response, $message = "", Throwable $previous = null)
    {
        parent::__construct($message, $response->getStatusCode(), $previous);
        $this->response = $response;
    }

    /**
     * @return Response
     */
    public function response(): Response
    {
        return $this->response;
    }
}