Response   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 61
rs 10
c 0
b 0
f 0
wmc 7
lcom 2
cbo 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A getHeaders() 0 4 1
A getBody() 0 4 1
A hasBody() 0 4 1
A getError() 0 4 1
A getHttpResponseCode() 0 8 2
1
<?php
2
3
namespace Facade\FlareClient\Http;
4
5
class Response
6
{
7
    private $headers;
8
9
    private $body;
10
11
    private $error;
12
13
    public function __construct($headers, $body, $error)
14
    {
15
        $this->headers = $headers;
16
17
        $this->body = $body;
18
19
        $this->error = $error;
20
    }
21
22
    /**
23
     * @return mixed
24
     */
25
    public function getHeaders()
26
    {
27
        return $this->headers;
28
    }
29
30
    /**
31
     * @return mixed
32
     */
33
    public function getBody()
34
    {
35
        return $this->body;
36
    }
37
38
    /**
39
     * @return bool
40
     */
41
    public function hasBody()
42
    {
43
        return $this->body != false;
44
    }
45
46
    /**
47
     * @return mixed
48
     */
49
    public function getError()
50
    {
51
        return $this->error;
52
    }
53
54
    /**
55
     * @return null|int
56
     */
57
    public function getHttpResponseCode()
58
    {
59
        if (! isset($this->headers['http_code'])) {
60
            return;
61
        }
62
63
        return (int) $this->headers['http_code'];
64
    }
65
}
66