1 | <?php |
||
26 | abstract class AbstractReportingCloud |
||
27 | { |
||
28 | /** |
||
29 | * Default date/time format of backend is 'ISO 8601' |
||
30 | * |
||
31 | * Note, last letter is 'P' and not 'O': |
||
32 | * |
||
33 | * O - Difference to Greenwich time (GMT) in hours (e.g. +0200) |
||
34 | * P - Difference to Greenwich time (GMT) with colon between hours and minutes (e.g. +02:00) |
||
35 | * |
||
36 | * Backend uses the 'P' variant |
||
37 | * |
||
38 | * @const DEFAULT_DATE_FORMAT |
||
39 | */ |
||
40 | const DEFAULT_DATE_FORMAT = 'Y-m-d\TH:i:sP'; |
||
41 | |||
42 | /** |
||
43 | * Default time zone of backend |
||
44 | * |
||
45 | * @const DEFAULT_TIME_ZONE |
||
46 | */ |
||
47 | const DEFAULT_TIME_ZONE = 'UTC'; |
||
48 | |||
49 | /** |
||
50 | * Default base URI of backend |
||
51 | * |
||
52 | * @const DEFAULT_BASE_URI |
||
53 | */ |
||
54 | const DEFAULT_BASE_URI = 'https://api.reporting.cloud'; |
||
55 | |||
56 | /** |
||
57 | * Default version string of backend |
||
58 | * |
||
59 | * @const DEFAULT_VERSION |
||
60 | */ |
||
61 | const DEFAULT_VERSION = 'v1'; |
||
62 | |||
63 | /** |
||
64 | * Default timeout of backend in seconds |
||
65 | * |
||
66 | * @const DEFAULT_TIMEOUT |
||
67 | */ |
||
68 | const DEFAULT_TIMEOUT = 120; // seconds |
||
69 | |||
70 | /** |
||
71 | * Default test flag of backend |
||
72 | * |
||
73 | * @const DEFAULT_TEST |
||
74 | */ |
||
75 | const DEFAULT_TEST = false; |
||
76 | |||
77 | /** |
||
78 | * Default debug flag of REST client |
||
79 | * |
||
80 | * @const DEFAULT_DEBUG |
||
81 | */ |
||
82 | const DEFAULT_DEBUG = false; |
||
83 | |||
84 | /** |
||
85 | * Backend username |
||
86 | * |
||
87 | * @var string |
||
88 | */ |
||
89 | protected $username; |
||
90 | |||
91 | /** |
||
92 | * Backend password |
||
93 | * |
||
94 | * @var string |
||
95 | */ |
||
96 | protected $password; |
||
97 | |||
98 | /** |
||
99 | * When true, backend prints "TEST MODE" water mark into output document, and API call does not count against quota |
||
100 | * |
||
101 | * @var boolean |
||
102 | */ |
||
103 | protected $test; |
||
104 | |||
105 | /** |
||
106 | * Backend base URI |
||
107 | * |
||
108 | * @var string |
||
109 | */ |
||
110 | protected $baseUri; |
||
111 | |||
112 | /** |
||
113 | * Backend version string |
||
114 | * |
||
115 | * @var string |
||
116 | */ |
||
117 | protected $version; |
||
118 | |||
119 | /** |
||
120 | * Backend timeout in seconds |
||
121 | * |
||
122 | * @var integer |
||
123 | */ |
||
124 | protected $timeout; |
||
125 | |||
126 | /** |
||
127 | * REST client to backend |
||
128 | * |
||
129 | * @var Client |
||
130 | */ |
||
131 | protected $client; |
||
132 | |||
133 | /** |
||
134 | * Debug flag of REST client |
||
135 | * |
||
136 | * @var boolean |
||
137 | */ |
||
138 | protected $debug; |
||
139 | |||
140 | /** |
||
141 | * AbstractReportingCloud constructor |
||
142 | * |
||
143 | * @param array $options |
||
144 | */ |
||
145 | 59 | public function __construct($options = []) |
|
175 | |||
176 | /** |
||
177 | * Return the REST client of the backend web service |
||
178 | * |
||
179 | * @return \GuzzleHttp\Client |
||
180 | */ |
||
181 | 18 | public function getClient() |
|
203 | |||
204 | /** |
||
205 | * Set the REST client of the backend web service |
||
206 | * |
||
207 | * @param Client $client REST client |
||
208 | * |
||
209 | * @return ReportingCloud |
||
210 | */ |
||
211 | 18 | public function setClient(Client $client) |
|
217 | |||
218 | /** |
||
219 | * Return the base URI of the backend web service |
||
220 | * |
||
221 | * @return string |
||
222 | */ |
||
223 | 22 | public function getBaseUri() |
|
231 | |||
232 | /** |
||
233 | * Set the base URI of the backend web service |
||
234 | * |
||
235 | * @param string $baseUri Base URI |
||
236 | * |
||
237 | * @return ReportingCloud |
||
238 | */ |
||
239 | 22 | public function setBaseUri($baseUri) |
|
245 | |||
246 | /** |
||
247 | * Get the timeout (in seconds) of the backend web service |
||
248 | * |
||
249 | * @return integer |
||
250 | */ |
||
251 | 21 | public function getTimeout() |
|
259 | |||
260 | /** |
||
261 | * Set the timeout (in seconds) of the backend web service |
||
262 | * |
||
263 | * @param integer $timeout Timeout |
||
264 | * |
||
265 | * @return ReportingCloud |
||
266 | */ |
||
267 | 21 | public function setTimeout($timeout) |
|
273 | |||
274 | /** |
||
275 | * Return the username |
||
276 | * |
||
277 | * @return string |
||
278 | */ |
||
279 | 21 | public function getUsername() |
|
283 | |||
284 | /** |
||
285 | * Set the username |
||
286 | * |
||
287 | * @param string $username Username |
||
288 | * |
||
289 | * @return ReportingCloud |
||
290 | */ |
||
291 | 56 | public function setUsername($username) |
|
297 | |||
298 | /** |
||
299 | * Return the password |
||
300 | * |
||
301 | * @return string |
||
302 | */ |
||
303 | 21 | public function getPassword() |
|
307 | |||
308 | /** |
||
309 | * Set the password |
||
310 | * |
||
311 | * @param string $password Password |
||
312 | * |
||
313 | * @return ReportingCloud |
||
314 | */ |
||
315 | 56 | public function setPassword($password) |
|
321 | |||
322 | /** |
||
323 | * Return the test flag |
||
324 | * |
||
325 | * @return mixed |
||
326 | */ |
||
327 | 19 | public function getTest() |
|
335 | |||
336 | /** |
||
337 | * Set the test flag |
||
338 | * |
||
339 | * @param boolean $test Test flag |
||
340 | * |
||
341 | * @return ReportingCloud |
||
342 | */ |
||
343 | 19 | public function setTest($test) |
|
349 | |||
350 | /** |
||
351 | * Return the debug flag |
||
352 | * |
||
353 | * @return mixed |
||
354 | */ |
||
355 | 21 | public function getDebug() |
|
363 | |||
364 | /** |
||
365 | * Set the debug flag |
||
366 | * |
||
367 | * @param boolean $debug Debug flag |
||
368 | * |
||
369 | * @return ReportingCloud |
||
370 | */ |
||
371 | 21 | public function setDebug($debug) |
|
377 | |||
378 | /** |
||
379 | * Get the version string of the backend web service |
||
380 | * |
||
381 | * @return string |
||
382 | */ |
||
383 | 20 | public function getVersion() |
|
391 | |||
392 | /** |
||
393 | * Set the version string of the backend web service |
||
394 | * |
||
395 | * @param string $version Version string |
||
396 | * |
||
397 | * @return ReportingCloud |
||
398 | */ |
||
399 | 2 | public function setVersion($version) |
|
405 | |||
406 | /** |
||
407 | * Request the URI with options |
||
408 | * |
||
409 | * @param string $method HTTP method |
||
410 | * @param string $uri URI |
||
411 | * @param array $options Options |
||
412 | * |
||
413 | * @return mixed|null|\Psr\Http\Message\ResponseInterface |
||
414 | * |
||
415 | * @throws RuntimeException |
||
416 | */ |
||
417 | 17 | protected function request($method, $uri, $options) |
|
449 | |||
450 | /** |
||
451 | * Construct URI with version number |
||
452 | * |
||
453 | * @param string $uri URI |
||
454 | * |
||
455 | * @return string |
||
456 | */ |
||
457 | 17 | protected function uri($uri) |
|
461 | |||
462 | } |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: