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

HttpException   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 45.45%

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 31
ccs 5
cts 11
cp 0.4545
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getStatusCode() 0 3 1
A setHeaders() 0 3 1
A getHeaders() 0 3 1
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