|
1
|
|
|
<?php |
|
2
|
|
|
namespace Datatrics\API; |
|
3
|
|
|
|
|
4
|
|
|
use Datatrics\API\Modules\Apikey; |
|
5
|
|
|
use Datatrics\API\Modules\Behavior; |
|
6
|
|
|
use Datatrics\API\Modules\Billing; |
|
7
|
|
|
use Datatrics\API\Modules\Box; |
|
8
|
|
|
use Datatrics\API\Modules\Bucket; |
|
9
|
|
|
use Datatrics\API\Modules\Campaign; |
|
10
|
|
|
use Datatrics\API\Modules\Card; |
|
11
|
|
|
use Datatrics\API\Modules\Channel; |
|
12
|
|
|
use Datatrics\API\Modules\Content; |
|
13
|
|
|
use Datatrics\API\Modules\Geo; |
|
14
|
|
|
use Datatrics\API\Modules\Goal; |
|
15
|
|
|
use Datatrics\API\Modules\Interaction; |
|
16
|
|
|
use Datatrics\API\Modules\Journey; |
|
17
|
|
|
use Datatrics\API\Modules\Link; |
|
18
|
|
|
use Datatrics\API\Modules\NextBestAction; |
|
19
|
|
|
use Datatrics\API\Modules\Profile; |
|
20
|
|
|
use Datatrics\API\Modules\Project; |
|
21
|
|
|
use Datatrics\API\Modules\Sale; |
|
22
|
|
|
use Datatrics\API\Modules\Scorecard; |
|
23
|
|
|
use Datatrics\API\Modules\Segment; |
|
24
|
|
|
use Datatrics\API\Modules\Subscription; |
|
25
|
|
|
use Datatrics\API\Modules\Template; |
|
26
|
|
|
use Datatrics\API\Modules\Theme; |
|
27
|
|
|
use Datatrics\API\Modules\Touchpoint; |
|
28
|
|
|
use Datatrics\API\Modules\Tracker; |
|
29
|
|
|
use Datatrics\API\Modules\Tric; |
|
30
|
|
|
use Datatrics\API\Modules\Trigger; |
|
31
|
|
|
use Datatrics\API\Modules\User; |
|
32
|
|
|
use Datatrics\API\Modules\Webhook; |
|
33
|
|
|
|
|
34
|
|
|
class Client |
|
35
|
|
|
{ |
|
36
|
|
|
/** |
|
37
|
|
|
* @const Version of our client. |
|
38
|
|
|
*/ |
|
39
|
|
|
const CLIENT_VERSION = '2.0'; |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* @const HTTP Method GET |
|
43
|
|
|
*/ |
|
44
|
|
|
const HTTP_GET = 'GET'; |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* @const HTTP Method POST |
|
48
|
|
|
*/ |
|
49
|
|
|
const HTTP_POST = 'POST'; |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* @const HTTP Method PUT |
|
53
|
|
|
*/ |
|
54
|
|
|
const HTTP_PUT = 'PUT'; |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* @const HTTP Method DELETE |
|
58
|
|
|
*/ |
|
59
|
|
|
const HTTP_DELETE = 'DELETE'; |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* Version of the remote API. |
|
63
|
|
|
* |
|
64
|
|
|
* @var string |
|
65
|
|
|
*/ |
|
66
|
|
|
private $_api_version = '2.0'; |
|
67
|
|
|
|
|
68
|
|
|
/** |
|
69
|
|
|
* @var string |
|
70
|
|
|
*/ |
|
71
|
|
|
private $_api_endpoint = 'https://api.datatrics.com'; |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* @var string |
|
75
|
|
|
*/ |
|
76
|
|
|
private $_api_key; |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* @var string |
|
80
|
|
|
*/ |
|
81
|
|
|
private $_projectId; |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* @var Apikey |
|
85
|
|
|
*/ |
|
86
|
|
|
public $Apikey; |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* @var Behavior |
|
90
|
|
|
*/ |
|
91
|
|
|
public $Behavior; |
|
92
|
|
|
|
|
93
|
|
|
/** |
|
94
|
|
|
* @var Billing |
|
95
|
|
|
*/ |
|
96
|
|
|
public $Billing; |
|
97
|
|
|
|
|
98
|
|
|
/** |
|
99
|
|
|
* @var Box |
|
100
|
|
|
*/ |
|
101
|
|
|
public $Box; |
|
102
|
|
|
|
|
103
|
|
|
/** |
|
104
|
|
|
* @var Bucket |
|
105
|
|
|
*/ |
|
106
|
|
|
public $Bucket; |
|
107
|
|
|
|
|
108
|
|
|
/** |
|
109
|
|
|
* @var Campaign |
|
110
|
|
|
*/ |
|
111
|
|
|
public $Campaign; |
|
112
|
|
|
|
|
113
|
|
|
/** |
|
114
|
|
|
* @var Card |
|
115
|
|
|
*/ |
|
116
|
|
|
public $Card; |
|
117
|
|
|
|
|
118
|
|
|
/** |
|
119
|
|
|
* @var Channel |
|
120
|
|
|
*/ |
|
121
|
|
|
public $Channel; |
|
122
|
|
|
|
|
123
|
|
|
/** |
|
124
|
|
|
* @var Content |
|
125
|
|
|
*/ |
|
126
|
|
|
public $Content; |
|
127
|
|
|
|
|
128
|
|
|
/** |
|
129
|
|
|
* @var Geo |
|
130
|
|
|
*/ |
|
131
|
|
|
public $Geo; |
|
132
|
|
|
|
|
133
|
|
|
/** |
|
134
|
|
|
* @var Goal |
|
135
|
|
|
*/ |
|
136
|
|
|
public $Goal; |
|
137
|
|
|
|
|
138
|
|
|
/** |
|
139
|
|
|
* @var Interaction |
|
140
|
|
|
*/ |
|
141
|
|
|
public $Interaction; |
|
142
|
|
|
|
|
143
|
|
|
/** |
|
144
|
|
|
* @var Journey |
|
145
|
|
|
*/ |
|
146
|
|
|
public $Journey; |
|
147
|
|
|
|
|
148
|
|
|
/** |
|
149
|
|
|
* @var Link |
|
150
|
|
|
*/ |
|
151
|
|
|
public $Link; |
|
152
|
|
|
|
|
153
|
|
|
/** |
|
154
|
|
|
* @var NextBestAction |
|
155
|
|
|
*/ |
|
156
|
|
|
public $NextBestAction; |
|
157
|
|
|
|
|
158
|
|
|
/** |
|
159
|
|
|
* @var Profile |
|
160
|
|
|
*/ |
|
161
|
|
|
public $Profile; |
|
162
|
|
|
|
|
163
|
|
|
/** |
|
164
|
|
|
* @var Project |
|
165
|
|
|
*/ |
|
166
|
|
|
public $Project; |
|
167
|
|
|
|
|
168
|
|
|
/** |
|
169
|
|
|
* @var Sale |
|
170
|
|
|
*/ |
|
171
|
|
|
public $Sale; |
|
172
|
|
|
|
|
173
|
|
|
/** |
|
174
|
|
|
* @var Scorecard |
|
175
|
|
|
*/ |
|
176
|
|
|
public $Scorecard; |
|
177
|
|
|
|
|
178
|
|
|
/** |
|
179
|
|
|
* @var Segment |
|
180
|
|
|
*/ |
|
181
|
|
|
public $Segment; |
|
182
|
|
|
|
|
183
|
|
|
/** |
|
184
|
|
|
* @var Subscription |
|
185
|
|
|
*/ |
|
186
|
|
|
public $Subscription; |
|
187
|
|
|
|
|
188
|
|
|
/** |
|
189
|
|
|
* @var Template |
|
190
|
|
|
*/ |
|
191
|
|
|
public $Template; |
|
192
|
|
|
|
|
193
|
|
|
/** |
|
194
|
|
|
* @var Theme |
|
195
|
|
|
*/ |
|
196
|
|
|
public $Theme; |
|
197
|
|
|
|
|
198
|
|
|
/** |
|
199
|
|
|
* @var Touchpoint |
|
200
|
|
|
*/ |
|
201
|
|
|
public $Touchpoint; |
|
202
|
|
|
|
|
203
|
|
|
/** |
|
204
|
|
|
* @var Tracker |
|
205
|
|
|
*/ |
|
206
|
|
|
public $Tracker; |
|
207
|
|
|
|
|
208
|
|
|
/** |
|
209
|
|
|
* @var Tric |
|
210
|
|
|
*/ |
|
211
|
|
|
public $Tric; |
|
212
|
|
|
|
|
213
|
|
|
/** |
|
214
|
|
|
* @var Trigger |
|
215
|
|
|
*/ |
|
216
|
|
|
public $Trigger; |
|
217
|
|
|
|
|
218
|
|
|
/** |
|
219
|
|
|
* @var User |
|
220
|
|
|
*/ |
|
221
|
|
|
public $User; |
|
222
|
|
|
|
|
223
|
|
|
/** |
|
224
|
|
|
* @var Webhook |
|
225
|
|
|
*/ |
|
226
|
|
|
public $Webhook; |
|
227
|
|
|
|
|
228
|
|
|
/** |
|
229
|
|
|
* Create a new API instance |
|
230
|
|
|
* |
|
231
|
|
|
* @param string $apiKey The API key |
|
232
|
|
|
* @param string $projectId The Project id |
|
233
|
|
|
*/ |
|
234
|
16 |
|
public function __construct($apiKey, $projectId = null) |
|
235
|
|
|
{ |
|
236
|
16 |
|
$this->SetApiKey($apiKey); |
|
237
|
16 |
|
$this->SetProjectId($projectId); |
|
238
|
16 |
|
$this->_RegisterModules(); |
|
239
|
16 |
|
} |
|
240
|
|
|
|
|
241
|
|
|
/** |
|
242
|
|
|
* Get the current API version |
|
243
|
|
|
* |
|
244
|
|
|
* @return string $api_version |
|
245
|
|
|
*/ |
|
246
|
8 |
|
public function GetApiVersion() |
|
247
|
|
|
{ |
|
248
|
8 |
|
return $this->_api_version; |
|
249
|
|
|
} |
|
250
|
|
|
|
|
251
|
|
|
/** |
|
252
|
|
|
* Get the API endpoint |
|
253
|
|
|
* |
|
254
|
|
|
* @return string |
|
255
|
|
|
*/ |
|
256
|
9 |
|
public function GetApiEndpoint() |
|
257
|
|
|
{ |
|
258
|
9 |
|
return $this->_api_endpoint; |
|
259
|
|
|
} |
|
260
|
|
|
|
|
261
|
|
|
/** |
|
262
|
|
|
* Set the API endpoint |
|
263
|
|
|
* |
|
264
|
|
|
* @param string $api_endpoint |
|
265
|
|
|
* @return Client |
|
266
|
|
|
*/ |
|
267
|
1 |
|
public function SetApiEndpoint($api_endpoint) |
|
268
|
|
|
{ |
|
269
|
1 |
|
$this->_api_endpoint = $api_endpoint; |
|
270
|
1 |
|
$this->_RegisterModules(); |
|
271
|
1 |
|
return $this; |
|
272
|
|
|
} |
|
273
|
|
|
|
|
274
|
|
|
/** |
|
275
|
|
|
* Get the API key |
|
276
|
|
|
* |
|
277
|
|
|
* @return string $api_key |
|
278
|
|
|
*/ |
|
279
|
8 |
|
public function GetApiKey() |
|
280
|
|
|
{ |
|
281
|
8 |
|
return $this->_api_key; |
|
282
|
|
|
} |
|
283
|
|
|
|
|
284
|
|
|
/** |
|
285
|
|
|
* Get the API key |
|
286
|
|
|
* |
|
287
|
|
|
* @param string $api_key |
|
288
|
|
|
* @return Client |
|
289
|
|
|
*/ |
|
290
|
16 |
|
public function SetApiKey($api_key) |
|
291
|
|
|
{ |
|
292
|
16 |
|
$this->_api_key = $api_key; |
|
293
|
16 |
|
$this->_RegisterModules(); |
|
294
|
16 |
|
return $this; |
|
295
|
|
|
} |
|
296
|
|
|
|
|
297
|
|
|
/** |
|
298
|
|
|
* Get the API project id |
|
299
|
|
|
* |
|
300
|
|
|
* @return string $projectId |
|
301
|
|
|
*/ |
|
302
|
16 |
|
public function GetProjectId() |
|
303
|
|
|
{ |
|
304
|
16 |
|
return $this->_projectId; |
|
305
|
|
|
} |
|
306
|
|
|
|
|
307
|
|
|
/** |
|
308
|
|
|
* Set the API project id |
|
309
|
|
|
* |
|
310
|
|
|
* @param string $projectId |
|
311
|
|
|
* @return Client |
|
312
|
|
|
*/ |
|
313
|
16 |
|
public function SetProjectId($projectId) |
|
314
|
|
|
{ |
|
315
|
16 |
|
$this->_projectId = $projectId; |
|
316
|
16 |
|
$this->_RegisterModules(); |
|
317
|
16 |
|
return $this; |
|
318
|
|
|
} |
|
319
|
|
|
|
|
320
|
|
|
/** |
|
321
|
|
|
* Register Modules |
|
322
|
|
|
* |
|
323
|
|
|
* @return void |
|
324
|
|
|
*/ |
|
325
|
16 |
|
private function _RegisterModules() |
|
326
|
|
|
{ |
|
327
|
16 |
|
$this->Apikey = new Apikey($this); |
|
328
|
16 |
|
$this->Behavior = new Behavior($this); |
|
329
|
16 |
|
$this->Billing = new Billing($this); |
|
330
|
16 |
|
$this->Box = new Box($this); |
|
331
|
16 |
|
$this->Bucket = new Bucket($this); |
|
332
|
16 |
|
$this->Campaign = new Campaign($this); |
|
333
|
16 |
|
$this->Card = new Card($this); |
|
334
|
16 |
|
$this->Channel = new Channel($this); |
|
335
|
16 |
|
$this->Content = new Content($this); |
|
336
|
16 |
|
$this->Geo = new Geo($this); |
|
337
|
16 |
|
$this->Goal = new Goal($this); |
|
338
|
16 |
|
$this->Interaction = new Interaction($this); |
|
339
|
16 |
|
$this->Journey = new Journey($this); |
|
340
|
16 |
|
$this->Link = new Link($this); |
|
341
|
16 |
|
$this->NextBestAction = new NextBestAction($this); |
|
342
|
16 |
|
$this->Profile = new Profile($this); |
|
343
|
16 |
|
$this->Project = new Project($this); |
|
344
|
16 |
|
$this->Sale = new Sale($this); |
|
345
|
16 |
|
$this->Scorecard = new Scorecard($this); |
|
346
|
16 |
|
$this->Segment = new Segment($this); |
|
347
|
16 |
|
$this->Subscription = new Subscription($this); |
|
348
|
16 |
|
$this->Template = new Template($this); |
|
349
|
16 |
|
$this->Theme = new Theme($this); |
|
350
|
16 |
|
$this->Touchpoint = new Touchpoint($this); |
|
351
|
16 |
|
$this->Tracker = new Tracker($this); |
|
352
|
16 |
|
$this->Tric = new Tric($this); |
|
353
|
16 |
|
$this->Trigger = new Trigger($this); |
|
354
|
16 |
|
$this->User = new User($this); |
|
355
|
16 |
|
$this->Webhook = new Webhook($this); |
|
356
|
16 |
|
} |
|
357
|
|
|
|
|
358
|
|
|
/** |
|
359
|
|
|
* Define the HTTP headers |
|
360
|
|
|
* |
|
361
|
|
|
* @return array |
|
362
|
|
|
*/ |
|
363
|
6 |
|
private function _GetHttpHeaders() |
|
364
|
|
|
{ |
|
365
|
6 |
|
$user_agent = 'Datatrics/API '.self::CLIENT_VERSION; |
|
366
|
|
|
return [ |
|
367
|
6 |
|
'Accept' => 'application/json', |
|
368
|
6 |
|
'Content-Type' => 'application/json', |
|
369
|
6 |
|
'User-Agent' => $user_agent, |
|
370
|
6 |
|
'X-apikey: '. $this->GetApiKey(), |
|
371
|
6 |
|
'X-client-name: '. $user_agent, |
|
372
|
6 |
|
'X-datatrics-client-info: '. php_uname() |
|
373
|
|
|
]; |
|
374
|
|
|
} |
|
375
|
|
|
|
|
376
|
|
|
/** |
|
377
|
|
|
* @throws \Exception |
|
378
|
|
|
* @return boolean |
|
379
|
|
|
*/ |
|
380
|
5 |
|
public function CheckApiKey() |
|
381
|
|
|
{ |
|
382
|
5 |
|
if (empty($this->GetApiKey())) { |
|
383
|
|
|
throw new \Exception('You have not set an api key. Please use setApiKey() to set the API key.'); |
|
384
|
|
|
} |
|
385
|
5 |
|
return true; |
|
386
|
|
|
} |
|
387
|
|
|
|
|
388
|
|
|
/** |
|
389
|
|
|
* @param $url |
|
390
|
|
|
* @param null|array $payload |
|
391
|
|
|
* @return string |
|
392
|
|
|
*/ |
|
393
|
7 |
|
public function GetUrl($url, $payload = array()) |
|
394
|
|
|
{ |
|
395
|
7 |
|
$url = $this->GetApiEndpoint()."/".$this->GetApiVersion().$url; |
|
396
|
7 |
|
if (count($payload)) { |
|
397
|
1 |
|
$url .= "?".http_build_query($payload); |
|
398
|
|
|
} |
|
399
|
7 |
|
return $url; |
|
400
|
|
|
} |
|
401
|
|
|
|
|
402
|
|
|
/** |
|
403
|
|
|
* @param string $method HTTP Method |
|
404
|
|
|
* @param string $url The url |
|
405
|
|
|
* @param array $payload The Payload |
|
406
|
|
|
* @throws \Exception |
|
407
|
|
|
* @return array |
|
408
|
|
|
*/ |
|
409
|
6 |
|
public function BuildRequest($method, $url, $payload = array()) |
|
410
|
|
|
{ |
|
411
|
6 |
|
$headers = $this->_GetHttpHeaders(); |
|
412
|
6 |
|
if($method == self::HTTP_POST || $method == self::HTTP_PUT){ |
|
413
|
2 |
|
if (!$payload || !is_array($payload)) |
|
|
|
|
|
|
414
|
|
|
{ |
|
415
|
|
|
throw new \Exception('Invalid payload', 100); |
|
416
|
|
|
} |
|
417
|
2 |
|
$payload = json_encode($payload); |
|
418
|
|
|
$curlOptions = array( |
|
419
|
2 |
|
CURLOPT_URL => $this->getUrl($url), |
|
420
|
2 |
|
CURLOPT_CUSTOMREQUEST => strtoupper($method), |
|
421
|
2 |
|
CURLOPT_POSTFIELDS => $payload |
|
422
|
|
|
); |
|
423
|
2 |
|
$headers['Content-Length'] = strlen($payload); |
|
424
|
4 |
|
}elseif($method == self::HTTP_DELETE){ |
|
425
|
|
|
$curlOptions = array( |
|
426
|
1 |
|
CURLOPT_URL => $this->getUrl($url), |
|
427
|
1 |
|
CURLOPT_CUSTOMREQUEST => self::HTTP_DELETE, |
|
428
|
|
|
); |
|
429
|
|
|
}else{ |
|
430
|
|
|
$curlOptions = array( |
|
431
|
3 |
|
CURLOPT_URL => $this->getUrl($url, $payload), |
|
432
|
3 |
|
CURLOPT_CUSTOMREQUEST => strtoupper($method) |
|
433
|
|
|
); |
|
434
|
|
|
} |
|
435
|
|
|
|
|
436
|
|
|
$curlOptions += array( |
|
437
|
6 |
|
CURLOPT_RETURNTRANSFER => true, |
|
438
|
6 |
|
CURLOPT_SSL_VERIFYPEER => false, |
|
439
|
6 |
|
CURLOPT_HTTPHEADER => $headers |
|
440
|
|
|
); |
|
441
|
6 |
|
return $curlOptions; |
|
442
|
|
|
} |
|
443
|
|
|
|
|
444
|
|
|
/** |
|
445
|
|
|
* @param string $method HTTP Method |
|
446
|
|
|
* @param string $url The url |
|
447
|
|
|
* @param array $payload The Payload |
|
448
|
|
|
* @return mixed |
|
449
|
|
|
* @throws \Exception |
|
450
|
|
|
*/ |
|
451
|
5 |
|
public function SendRequest($method, $url, $payload = array()) |
|
452
|
|
|
{ |
|
453
|
5 |
|
$this->CheckApiKey(); |
|
454
|
5 |
|
$curlOptions = $this->BuildRequest($method, $url, $payload); |
|
455
|
5 |
|
$curlHandle = curl_init(); |
|
456
|
5 |
|
curl_setopt_array($curlHandle, $curlOptions); |
|
457
|
5 |
|
$responseBody = curl_exec($curlHandle); |
|
458
|
5 |
|
if (curl_errno($curlHandle)) |
|
459
|
|
|
{ |
|
460
|
|
|
throw new \Exception('Curl error: ' . curl_error($curlHandle), curl_errno($curlHandle)); |
|
461
|
|
|
} |
|
462
|
5 |
|
$responseBody = json_decode($responseBody, true); |
|
463
|
5 |
|
if (json_last_error() !== JSON_ERROR_NONE) { |
|
464
|
|
|
throw new \Exception(json_last_error_msg()); |
|
465
|
|
|
} |
|
466
|
5 |
|
$responseCode = curl_getinfo($curlHandle, CURLINFO_HTTP_CODE); |
|
467
|
5 |
|
curl_close($curlHandle); |
|
468
|
5 |
|
if ($responseCode < 200 || $responseCode > 299) |
|
469
|
|
|
{ |
|
470
|
5 |
|
if($responseBody && array_key_exists('error', $responseBody)){ |
|
471
|
|
|
throw new \Exception($responseBody['error']['message'], $responseCode); |
|
472
|
|
|
} |
|
473
|
5 |
|
if($responseBody && array_key_exists('message', $responseBody)){ |
|
474
|
5 |
|
throw new \Exception($responseBody['message'], $responseCode); |
|
475
|
|
|
} |
|
476
|
|
|
throw new \Exception('Something went wrong'); |
|
477
|
|
|
} |
|
478
|
|
|
return $responseBody; |
|
479
|
|
|
} |
|
480
|
|
|
|
|
481
|
|
|
/** |
|
482
|
|
|
* @param string $url |
|
483
|
|
|
* @param array $payload |
|
484
|
|
|
* @return mixed |
|
485
|
|
|
*/ |
|
486
|
1 |
|
public function Post($url, $payload = array()) |
|
487
|
|
|
{ |
|
488
|
1 |
|
return $this->SendRequest(self::HTTP_POST, $url, $payload); |
|
489
|
|
|
} |
|
490
|
|
|
|
|
491
|
|
|
/** |
|
492
|
|
|
* @param string $url |
|
493
|
|
|
* @param array $payload |
|
494
|
|
|
* @return mixed |
|
495
|
|
|
*/ |
|
496
|
1 |
|
public function Get($url, $payload = array()) |
|
497
|
|
|
{ |
|
498
|
1 |
|
return $this->SendRequest(self::HTTP_GET, $url, $payload); |
|
499
|
|
|
} |
|
500
|
|
|
|
|
501
|
|
|
/** |
|
502
|
|
|
* @param string $url |
|
503
|
|
|
* @param array $payload |
|
504
|
|
|
* @return mixed |
|
505
|
|
|
*/ |
|
506
|
1 |
|
public function Put($url, $payload = array()) |
|
507
|
|
|
{ |
|
508
|
1 |
|
return $this->SendRequest(self::HTTP_PUT, $url, $payload); |
|
509
|
|
|
} |
|
510
|
|
|
|
|
511
|
|
|
/** |
|
512
|
|
|
* @param string $url |
|
513
|
|
|
* @param array $payload |
|
514
|
|
|
* @return mixed |
|
515
|
|
|
*/ |
|
516
|
1 |
|
public function Delete($url, $payload = array()) |
|
517
|
|
|
{ |
|
518
|
1 |
|
return $this->SendRequest(self::HTTP_DELETE, $url, $payload); |
|
519
|
|
|
} |
|
520
|
|
|
} |
|
521
|
|
|
|
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)or! empty(...)instead.