Completed
Push — master ( 5d2770...16a580 )
by Enrico
02:38
created

HttpException   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 63.64%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A setHeaders() 0 3 1
A getHeaders() 0 3 1
A getStatusCode() 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 3
    public function __construct(int $statusCode, string $message = null, \Exception $previous = null, array $headers = array(), ?int $code = 0)
16
    {
17 3
        $this->statusCode = $statusCode;
18 3
        $this->headers = $headers;
19
20 3
        parent::__construct($message, $code, $previous);
21 3
    }
22
23 1
    public function getStatusCode()
24
    {
25 1
        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