Passed
Branch master (f24b8d)
by Pavel
01:56
created

RestException::httpStatus()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
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 \RuntimeException
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 5
    public function __construct($httpStatus, $message, array $errors = [], \Exception $previous = null)
26
    {
27 5
        parent::__construct($message, $httpStatus, $previous);
28 5
        $this->httpStatus = $httpStatus;
29 5
        $this->errors = $errors;
30 5
    }
31
32
    /**
33
     * @return array
34
     */
35 5
    public function errors()
36
    {
37 5
        return $this->errors;
38
    }
39
40
    /**
41
     * @return int
42
     */
43 5
    public function httpStatus()
44
    {
45 5
        return $this->httpStatus;
46
    }
47
}
48