RequestValidatorException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 20
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 1
A getErrors() 0 3 1
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