Completed
Pull Request — develop (#20)
by Johan
03:38 queued 01:50
created

Response   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 67
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 81.82%

Importance

Changes 5
Bugs 0 Features 4
Metric Value
wmc 4
c 5
b 0
f 4
lcom 0
cbo 0
dl 0
loc 67
ccs 9
cts 11
cp 0.8182
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getBody() 0 4 1
A getStatus() 0 4 1
A getHeaders() 0 4 1
1
<?php
2
3
namespace Artstorm\MonkeyLearn\HttpClient;
4
5
class Response
6
{
7
    /**
8
     * HTTP Status code
9
     *
10
     * @int
11
     */
12
    protected $status;
13
14
    /**
15
     * Headers.
16
     *
17
     * @var array
18
     */
19
    protected $headers;
20
21
    /**
22
     * Contents.
23
     *
24
     * @var string
25
     */
26
    protected $body;
27
28
    /**
29
     * Assign dependencies.
30
     *
31
     * @param int    $status
32
     * @param array  $headers
33
     * @param string $body
34
     */
35 12
    public function __construct($status = 200, array $headers = [], $body = null)
36
    {
37 12
        $this->status = $status;
38 12
        $this->headers = $headers;
39 12
        $this->body = $body;
40 12
    }
41
42
    /**
43
     * Get body.
44
     *
45
     * @return string
46
     */
47 8
    public function getBody()
48
    {
49 8
        return $this->body;
50
    }
51
52
    /**
53
     * Get HTTP status code.
54
     *
55
     * @return string
56
     */
57 2
    public function getStatus()
58
    {
59 2
        return $this->status;
60
    }
61
62
    /**
63
     * Get response headers.
64
     *
65
     * @return string
66
     */
67
    public function getHeaders()
68
    {
69
        return $this->headers;
70
    }
71
}
72