Completed
Push — master ( f9dcdb...5d2770 )
by Enrico
02:49
created

HttpException::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 5
dl 0
loc 6
ccs 4
cts 4
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace uSILEX\Exception;
4
5
/**
6
 * HttpException.
7
 *
8
 * @author Kris Wallsmith <[email protected]>
9
 */
10
class HttpException extends \RuntimeException implements HttpExceptionInterface
11
{
12
    private $statusCode;
13
    private $headers;
14
15 2
    public function __construct(int $statusCode, string $message = null, \Exception $previous = null, array $headers = array(), ?int $code = 0)
16
    {
17 2
        $this->statusCode = $statusCode;
18 2
        $this->headers = $headers;
19
20 2
        parent::__construct($message, $code, $previous);
21 2
    }
22
23
    public function getStatusCode()
24
    {
25
        return $this->statusCode;
26
    }
27
28
    public function getHeaders()
29
    {
30
        return $this->headers;
31
    }
32
33
    /**
34
     * Set response headers.
35
     *
36
     * @param array $headers Response headers
37
     */
38
    public function setHeaders(array $headers)
39
    {
40
        $this->headers = $headers;
41
    }
42
}
43