Response::getHeaders()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * WooCommerce REST API HTTP Client Response
4
 *
5
 * @category HttpClient
6
 * @package  Automattic/WooCommerce
7
 */
8
9
namespace Automattic\WooCommerce\HttpClient;
10
11
/**
12
 * REST API HTTP Client Response class.
13
 *
14
 * @package Automattic/WooCommerce
15
 */
16
class Response
17
{
18
19
    /**
20
     * Response code.
21
     *
22
     * @var int
23
     */
24
    private $code;
25
26
    /**
27
     * Response headers.
28
     *
29
     * @var array
30
     */
31
    private $headers;
32
33
    /**
34
     * Response body.
35
     *
36
     * @var string
37
     */
38
    private $body;
39
40
    /**
41
     * Initialize response.
42
     *
43
     * @param int    $code    Response code.
44
     * @param array  $headers Response headers.
45
     * @param string $body    Response body.
46
     */
47
    public function __construct($code = 0, $headers = [], $body = '')
48
    {
49
        $this->code    = $code;
50
        $this->headers = $headers;
51
        $this->body    = $body;
52
    }
53
54
    /**
55
     * Set code.
56
     *
57
     * @param int $code Response code.
58
     */
59
    public function setCode($code)
60
    {
61
        $this->code = (int) $code;
62
    }
63
64
    /**
65
     * Set headers.
66
     *
67
     * @param array $headers Response headers.
68
     */
69
    public function setHeaders($headers)
70
    {
71
        $this->headers = $headers;
72
    }
73
74
    /**
75
     * Set body.
76
     *
77
     * @param string $body Response body.
78
     */
79
    public function setBody($body)
80
    {
81
        $this->body = $body;
82
    }
83
84
    /**
85
     * Get code.
86
     *
87
     * @return int
88
     */
89
    public function getCode()
90
    {
91
        return $this->code;
92
    }
93
94
    /**
95
     * Get headers.
96
     *
97
     * @return array $headers Response headers.
98
     */
99
    public function getHeaders()
100
    {
101
        return $this->headers;
102
    }
103
104
    /**
105
     * Get body.
106
     *
107
     * @return string $body Response body.
108
     */
109
    public function getBody()
110
    {
111
        return $this->body;
112
    }
113
}
114