CurlResponse   A
last analyzed

Complexity

Total Complexity 13

Size/Duplication

Total Lines 161
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 13
lcom 0
cbo 0
dl 0
loc 161
rs 10
c 0
b 0
f 0

13 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getRequestBody() 0 3 1
A getRequestHeader() 0 3 1
A getRequestUrl() 0 3 1
A getResponseBody() 0 3 1
A getResponseHeader() 0 3 1
A getResponseInfo() 0 3 1
A setRequestBody() 0 4 1
A setRequestHeader() 0 4 1
A setRequestUrl() 0 4 1
A setResponseBody() 0 4 1
A setResponseHeader() 0 4 1
A setResponseInfo() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the core-library package.
5
 *
6
 * (c) 2018 WEBEWEB
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace WBW\Library\Core\Network\CURL\Response;
13
14
use WBW\Library\Core\Network\CURL\API\CurlResponseInterface;
15
16
/**
17
 * cURL response.
18
 *
19
 * @author webeweb <https://github.com/webeweb/>
20
 * @package WBW\Library\Core\Network\CURL\Response
21
 */
22
class CurlResponse implements CurlResponseInterface {
23
24
    /**
25
     * Request body.
26
     *
27
     * @var string|null
28
     */
29
    private $requestBody;
30
31
    /**
32
     * Request header.
33
     *
34
     * @var array
35
     */
36
    private $requestHeader;
37
38
    /**
39
     * Request URL.
40
     *
41
     * @var string|null
42
     */
43
    private $requestUrl;
44
45
    /**
46
     * Response body.
47
     *
48
     * @var string|null
49
     */
50
    private $responseBody;
51
52
    /**
53
     * Response header.
54
     *
55
     * @var array
56
     */
57
    private $responseHeader;
58
59
    /**
60
     * Response info.
61
     *
62
     * @var array
63
     */
64
    private $responseInfo;
65
66
    /**
67
     * Constructor.
68
     */
69
    public function __construct() {
70
        $this->setRequestHeader([]);
71
        $this->setResponseHeader([]);
72
        $this->setResponseInfo([]);
73
    }
74
75
    /**
76
     * {@inheritDoc}
77
     */
78
    public function getRequestBody(): ?string {
79
        return $this->requestBody;
80
    }
81
82
    /**
83
     * {@inheritDoc}
84
     */
85
    public function getRequestHeader(): array {
86
        return $this->requestHeader;
87
    }
88
89
    /**
90
     * {@inheritDoc}
91
     */
92
    public function getRequestUrl(): ?string {
93
        return $this->requestUrl;
94
    }
95
96
    /**
97
     * {@inheritDoc}
98
     */
99
    public function getResponseBody(): ?string {
100
        return $this->responseBody;
101
    }
102
103
    /**
104
     * {@inheritDoc}
105
     */
106
    public function getResponseHeader(): array {
107
        return $this->responseHeader;
108
    }
109
110
    /**
111
     * {@inheritDoc}
112
     */
113
    public function getResponseInfo(): array {
114
        return $this->responseInfo;
115
    }
116
117
    /**
118
     * Set the request body.
119
     *
120
     * @param string|null $requestBody The request body.
121
     * @return CurlResponse Returns this CURL response.
122
     */
123
    public function setRequestBody(?string $requestBody): CurlResponse {
124
        $this->requestBody = $requestBody;
125
        return $this;
126
    }
127
128
    /**
129
     * Set the request header.
130
     *
131
     * @param array $requestHeader The request header.
132
     * @return CurlResponse Returns this CURL response.
133
     */
134
    public function setRequestHeader(array $requestHeader): CurlResponse {
135
        $this->requestHeader = $requestHeader;
136
        return $this;
137
    }
138
139
    /**
140
     * Set the request URL.
141
     *
142
     * @param string $requestUrl The request URL.
143
     * @return CurlResponse Returns this CURL response.
144
     */
145
    public function setRequestUrl(string $requestUrl): CurlResponse {
146
        $this->requestUrl = $requestUrl;
147
        return $this;
148
    }
149
150
    /**
151
     * Set the response body.
152
     *
153
     * @param string|null $responseBody The response body.
154
     * @return CurlResponse Returns this CURL response.
155
     */
156
    public function setResponseBody(?string $responseBody): CurlResponse {
157
        $this->responseBody = $responseBody;
158
        return $this;
159
    }
160
161
    /**
162
     * Set the response header.
163
     *
164
     * @param array $responseHeader The response header.
165
     * @return CurlResponse Returns this CURL response.
166
     */
167
    public function setResponseHeader(array $responseHeader): CurlResponse {
168
        $this->responseHeader = $responseHeader;
169
        return $this;
170
    }
171
172
    /**
173
     * Set the response info.
174
     *
175
     * @param array $responseInfo The response info.
176
     * @return CurlResponse Returns this CURL response.
177
     */
178
    public function setResponseInfo(array $responseInfo): CurlResponse {
179
        $this->responseInfo = $responseInfo;
180
        return $this;
181
    }
182
}
183