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

RestException   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 41
ccs 0
cts 13
cp 0
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

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