Completed
Pull Request — master (#97)
by
unknown
03:44
created

DropboxRawResponse   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 69
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 5
lcom 0
cbo 0
dl 0
loc 69
ccs 12
cts 12
cp 1
rs 10
c 2
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 2
A getHeaders() 0 4 1
A getBody() 0 4 1
A getHttpResponseCode() 0 4 1
1
<?php
2
namespace Kunnu\Dropbox\Http;
3
4
/**
5
 * DropboxRawResponse
6
 */
7
class DropboxRawResponse
8
{
9
    /**
10
     * Response headers
11
     *
12
     * @var array
13
     */
14
    protected $headers;
15
16
    /**
17
     * Raw response body
18
     *
19
     * @var string
20
     */
21
    protected $body;
22
23
    /**
24
     * HTTP status response code
25
     *
26
     * @var int
27
     */
28
    protected $httpResponseCode;
29
30
    /**
31
     * Create a new GraphRawResponse instance
32
     *
33
     * @param array     $headers        Response headers
34
     * @param string    $body           Raw response body
35
     * @param int|null  $statusCode     HTTP response code
36
     */
37 48
    public function __construct($headers, $body, $statusCode = null)
38
    {
39 48
        if (is_numeric($statusCode)) {
40 48
            $this->httpResponseCode = (int) $statusCode;
41
        }
42 48
        $this->headers = $headers;
43 48
        $this->body = $body;
44 48
    }
45
46
    /**
47
     * Get the response headers
48
     *
49
     * @return array
50
     */
51 48
    public function getHeaders()
52
    {
53 48
        return $this->headers;
54
    }
55
56
    /**
57
     * Get the response body
58
     *
59
     * @return string
60
     */
61 47
    public function getBody()
62
    {
63 47
        return $this->body;
64
    }
65
66
    /**
67
     * Get the HTTP response code
68
     *
69
     * @return int
70
     */
71 48
    public function getHttpResponseCode()
72
    {
73 48
        return $this->httpResponseCode;
74
    }
75
}
76