1 | <?php |
||
10 | abstract class AbstractRequest implements RequestInterface { |
||
11 | |||
12 | const STATUS_INIT = 'initialized'; |
||
13 | const STATUS_SENT = 'sent'; |
||
14 | const STATUS_CLOSED = 'closed'; |
||
15 | |||
16 | /** |
||
17 | * The HTTP Request Type |
||
18 | * @var string |
||
19 | */ |
||
20 | protected static $_TYPE = ''; |
||
21 | |||
22 | /** |
||
23 | * The Default Curl Options |
||
24 | * @var array |
||
25 | */ |
||
26 | protected static $_DEFAULT_OPTIONS = array( |
||
27 | CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_0, |
||
28 | CURLOPT_HEADER => TRUE, |
||
29 | CURLOPT_SSL_VERIFYPEER => FALSE, |
||
30 | CURLOPT_RETURNTRANSFER => TRUE, |
||
31 | CURLOPT_FOLLOWLOCATION => FALSE, |
||
32 | CURLOPT_USERAGENT => 'SugarAPI-SDK-PHP' |
||
33 | ); |
||
34 | |||
35 | /** |
||
36 | * The default HTTP Headers to be added to Curl Request |
||
37 | * @var array |
||
38 | */ |
||
39 | protected static $_DEFAULT_HEADERS = array(); |
||
40 | |||
41 | /** |
||
42 | * The Curl Resource used to actually send data to Sugar API |
||
43 | * @var - Curl Resource |
||
44 | */ |
||
45 | protected $CurlResponse; |
||
46 | |||
47 | /** |
||
48 | * The raw response from curl_exec |
||
49 | * @var - Curl Response |
||
50 | */ |
||
51 | protected $CurlRequest; |
||
52 | |||
53 | /** |
||
54 | * List of Headers for Request |
||
55 | * @var array |
||
56 | */ |
||
57 | protected $headers = array(); |
||
58 | |||
59 | /** |
||
60 | * The body of the request or payload. JSON Encoded |
||
61 | * @var string |
||
62 | */ |
||
63 | protected $body = ''; |
||
64 | |||
65 | /** |
||
66 | * The URL the Request is sent to |
||
67 | * @var string |
||
68 | */ |
||
69 | protected $url = ''; |
||
70 | |||
71 | /** |
||
72 | * @var null |
||
73 | */ |
||
74 | protected $status = NULL; |
||
75 | |||
76 | /** |
||
77 | * The Request Type |
||
78 | * @var |
||
79 | */ |
||
80 | protected $type; |
||
81 | |||
82 | /** |
||
83 | * The options configured on the Curl Resource object |
||
84 | * @var array |
||
85 | */ |
||
86 | protected $options = array(); |
||
87 | |||
88 | 1 | public function __construct($url = NULL){ |
|
100 | |||
101 | /** |
||
102 | * Always make sure to destroy Curl Resource |
||
103 | */ |
||
104 | 1 | public function __destruct() { |
|
109 | |||
110 | /** |
||
111 | * @inheritdoc |
||
112 | */ |
||
113 | 1 | public function setURL($url){ |
|
118 | |||
119 | /** |
||
120 | * @inheritdoc |
||
121 | */ |
||
122 | 1 | public function getURL(){ |
|
125 | |||
126 | /** |
||
127 | * @inheritdoc |
||
128 | */ |
||
129 | 1 | public function addHeader($name, $value){ |
|
134 | |||
135 | /** |
||
136 | * @inheritdoc |
||
137 | */ |
||
138 | 1 | public function setHeaders(array $array = array()){ |
|
151 | |||
152 | /** |
||
153 | * @inheritdoc |
||
154 | */ |
||
155 | 1 | public function getHeaders(){ |
|
158 | |||
159 | /** |
||
160 | * @inheritdoc |
||
161 | */ |
||
162 | 1 | public function setBody($body){ |
|
167 | |||
168 | /** |
||
169 | * @inheritdoc |
||
170 | */ |
||
171 | 1 | public function getBody(){ |
|
174 | |||
175 | /** |
||
176 | * @inheritdoc |
||
177 | */ |
||
178 | 2 | public function getCurlObject(){ |
|
181 | |||
182 | /** |
||
183 | * @inheritdoc |
||
184 | */ |
||
185 | 1 | public function setOption($option, $value){ |
|
190 | |||
191 | /** |
||
192 | * @inheritdoc |
||
193 | */ |
||
194 | 1 | public function getOptions() { |
|
197 | |||
198 | /** |
||
199 | * @inheritdoc |
||
200 | */ |
||
201 | 1 | public function send(){ |
|
207 | |||
208 | /** |
||
209 | * @inheritdoc |
||
210 | */ |
||
211 | 1 | public function getCurlResponse(){ |
|
214 | |||
215 | /** |
||
216 | * @inheritdoc |
||
217 | */ |
||
218 | 1 | public function setType($type){ |
|
223 | |||
224 | /** |
||
225 | * Configure the Curl Options based on Request Type |
||
226 | */ |
||
227 | 1 | protected function configureType(){ |
|
238 | |||
239 | /** |
||
240 | * @inheritdoc |
||
241 | */ |
||
242 | 1 | public function getType(){ |
|
245 | |||
246 | /** |
||
247 | * @inheritdoc |
||
248 | */ |
||
249 | 1 | public function reset(){ |
|
256 | |||
257 | /** |
||
258 | * @inheritdoc |
||
259 | */ |
||
260 | 2 | public function start(){ |
|
265 | |||
266 | /** |
||
267 | * @inheritdoc |
||
268 | */ |
||
269 | 1 | public function close(){ |
|
275 | |||
276 | /** |
||
277 | * @inheritdoc |
||
278 | */ |
||
279 | 2 | public function getCurlStatus(){ |
|
282 | } |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..