Failed Conditions
Push — 0.2 ( 9080b3...48d4dc )
by Maximo
10:15 queued 04:56
created

HttpException   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 34
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getHttpCode() 0 3 1
A getHttpMessage() 0 3 1
A getData() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Canvas\Exception;
6
7
use Canvas\Http\Response;
8
9
class HttpException extends Exception
10
{
11
    protected $httpCode = Response::BAD_REQUEST;
12
    protected $httpMessage = 'Bad Request';
13
    protected $data;
14
15
    /**
16
     * Get the http status code of the exception.
17
     *
18
     * @return string
19
     */
20
    public function getHttpCode(): int
21
    {
22
        return $this->httpCode;
23
    }
24
25
    /**
26
     * Get the message string from the exception.
27
     *
28
     * @return string
29
     */
30
    public function getHttpMessage(): string
31
    {
32
        return $this->httpMessage;
33
    }
34
35
    /**
36
     * Get the message DATA from the exception.
37
     *
38
     * @return string|null
39
     */
40
    public function getData(): ?string
41
    {
42
        return $this->data;
43
    }
44
}
45