summaryrefslogtreecommitdiff
path: root/src/Http/Exceptions/ValidationException.php
blob: e48fb0c394ca27d1ce09e08a672765a7adb6e08f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php

namespace Engelsystem\Http\Exceptions;

use Engelsystem\Http\Validation\Validator;
use RuntimeException;
use Throwable;

class ValidationException extends RuntimeException
{
    /** @var Validator */
    protected $validator;

    /**
     * @param Validator      $validator
     * @param string         $message
     * @param int            $code
     * @param Throwable|null $previous
     */
    public function __construct(
        Validator $validator,
        string $message = '',
        int $code = 0,
        Throwable $previous = null
    ) {
        $this->validator = $validator;
        parent::__construct($message, $code, $previous);
    }

    /**
     * @return Validator
     */
    public function getValidator(): Validator
    {
        return $this->validator;
    }
}