RequestValidatorException::getErrors()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
/**
4
 * This file is part of the bugloos/error-response-bundle project.
5
 * (c) Bugloos <https://bugloos.com/>
6
 * For the full copyright and license information, please view
7
 * the LICENSE file that was distributed with this source code.
8
 */
9
10
namespace Bugloos\ErrorResponseBundle\Exception;
11
12
use Symfony\Component\HttpFoundation\Response;
13
use Symfony\Component\HttpKernel\Exception\HttpException;
14
15
/**
16
 * @author Mojtaba Gheytasi <[email protected]>
17
 */
18
class RequestValidatorException extends HttpException
19
{
20
    protected array $errors;
21
22
    public function __construct(
23
        array $errors,
24
        string $message = 'Invalid Data',
25
        int $statusCode = Response::HTTP_UNPROCESSABLE_ENTITY,
26
        \Exception $previous = null,
27
        array $headers = [],
28
        ?int $code = 0
29
    ) {
30
        parent::__construct($statusCode, $message, $previous, $headers, $code);
31
32
        $this->errors = $errors;
33
    }
34
35
    public function getErrors(): array
36
    {
37
        return $this->errors;
38
    }
39
}
40