Test Failed
Push — master ( b600aa...6380c9 )
by Pavel
02:04
created

RestException::errors()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 3
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php namespace Pz\Doctrine\Rest;
2
3
use Symfony\Component\HttpFoundation\Response;
4
5
class RestException extends \HttpResponseException
6
{
7
    /**
8
     * @var int
9
     */
10
    protected $httpStatus = Response::HTTP_INTERNAL_SERVER_ERROR;
11
12
    /**
13
     * @var array
14
     */
15
    protected $errors = [];
16
17
    /**
18
     * RestException constructor.
19
     *
20
     * @param int             $httpStatus
21
     * @param string          $message
22
     * @param array           $errors
23
     * @param \Exception|null $previous
24
     */
25
    public function __construct($httpStatus, $message, array $errors = [], \Exception $previous = null)
26
    {
27
        parent::__construct($message, $httpStatus, $previous);
28
        $this->httpStatus = $httpStatus;
29
        $this->errors = $errors;
30
    }
31
32
    /**
33
     * @return array
34
     */
35
    public function errors()
36
    {
37
        return $this->errors;
38
    }
39
40
    /**
41
     * @return int
42
     */
43
    public function httpStatus()
44
    {
45
        return $this->httpStatus;
46
    }
47
}
48