@@ -99,7 +99,7 @@ public function __construct($url, $apikeyOrUsername, $pass = null)
99
99
/**
100
100
* PHP getter magic method.
101
101
*
102
- * @deprecated
102
+ * @deprecated use getApi() instead
103
103
*
104
104
* @param string $name
105
105
*
@@ -109,20 +109,24 @@ public function __construct($url, $apikeyOrUsername, $pass = null)
109
109
*/
110
110
public function __get ($ name )
111
111
{
112
- return $ this ->api ($ name );
112
+ @trigger_error ('The ' . __METHOD__ . ' method is deprecated, use getApi() instead. ' , E_USER_DEPRECATED );
113
+
114
+ return $ this ->getApi (strval ($ name ));
113
115
}
114
116
115
117
/**
116
118
* @param string $name
117
119
*
118
- * @deprecated
120
+ * @deprecated use getApi() instead
119
121
*
120
122
* @throws \InvalidArgumentException
121
123
*
122
124
* @return Api\AbstractApi
123
125
*/
124
126
public function api ($ name )
125
127
{
128
+ @trigger_error ('The ' . __METHOD__ . ' method is deprecated, use getApi() instead. ' , E_USER_DEPRECATED );
129
+
126
130
return $ this ->getApi (strval ($ name ));
127
131
}
128
132
@@ -135,6 +139,8 @@ public function api($name)
135
139
*/
136
140
public function getUrl ()
137
141
{
142
+ @trigger_error ('The ' . __METHOD__ . ' method is deprecated. You should stop using it, as it will be removed in the future. ' , E_USER_DEPRECATED );
143
+
138
144
return $ this ->url ;
139
145
}
140
146
@@ -205,7 +211,7 @@ public function getLastResponseBody(): string
205
211
/**
206
212
* HTTP GETs a json $path and tries to decode it.
207
213
*
208
- * @deprecated
214
+ * @deprecated use requestGet() instead
209
215
*
210
216
* @param string $path
211
217
* @param bool $decode
@@ -214,6 +220,8 @@ public function getLastResponseBody(): string
214
220
*/
215
221
public function get ($ path , $ decode = true )
216
222
{
223
+ @trigger_error ('The ' . __METHOD__ . ' method is deprecated, use requestGet() instead. ' , E_USER_DEPRECATED );
224
+
217
225
if (false === $ json = $ this ->runRequest ($ path , 'GET ' )) {
218
226
return false ;
219
227
}
@@ -239,6 +247,8 @@ public function get($path, $decode = true)
239
247
*/
240
248
public function decode ($ json )
241
249
{
250
+ @trigger_error ('The ' . __METHOD__ . ' method is deprecated. You should stop using it, as it will be removed in the future. ' , E_USER_DEPRECATED );
251
+
242
252
if (empty ($ json )) {
243
253
return '' ;
244
254
}
@@ -256,7 +266,7 @@ public function decode($json)
256
266
/**
257
267
* HTTP POSTs $params to $path.
258
268
*
259
- * @deprecated
269
+ * @deprecated use requestPost() instead
260
270
*
261
271
* @param string $path
262
272
* @param string $data
@@ -265,13 +275,15 @@ public function decode($json)
265
275
*/
266
276
public function post ($ path , $ data )
267
277
{
278
+ @trigger_error ('The ' . __METHOD__ . ' method is deprecated, use requestPost() instead. ' , E_USER_DEPRECATED );
279
+
268
280
return $ this ->runRequest ($ path , 'POST ' , $ data );
269
281
}
270
282
271
283
/**
272
284
* HTTP PUTs $params to $path.
273
285
*
274
- * @deprecated
286
+ * @deprecated use requestPut() instead
275
287
*
276
288
* @param string $path
277
289
* @param string $data
@@ -280,34 +292,40 @@ public function post($path, $data)
280
292
*/
281
293
public function put ($ path , $ data )
282
294
{
295
+ @trigger_error ('The ' . __METHOD__ . ' method is deprecated, use requestPut() instead. ' , E_USER_DEPRECATED );
296
+
283
297
return $ this ->runRequest ($ path , 'PUT ' , $ data );
284
298
}
285
299
286
300
/**
287
301
* HTTP PUTs $params to $path.
288
302
*
289
- * @deprecated
303
+ * @deprecated use requestDelete() instead
290
304
*
291
305
* @param string $path
292
306
*
293
307
* @return false|\SimpleXMLElement|string
294
308
*/
295
309
public function delete ($ path )
296
310
{
311
+ @trigger_error ('The ' . __METHOD__ . ' method is deprecated, use requestDelete() instead. ' , E_USER_DEPRECATED );
312
+
297
313
return $ this ->runRequest ($ path , 'DELETE ' );
298
314
}
299
315
300
316
/**
301
317
* Turns on/off ssl certificate check.
302
318
*
303
- * @deprecated
319
+ * @deprecated use setCurlOption() instead
304
320
*
305
321
* @param bool $check
306
322
*
307
323
* @return Client
308
324
*/
309
325
public function setCheckSslCertificate ($ check = false )
310
326
{
327
+ @trigger_error ('The ' . __METHOD__ . ' method is deprecated, use setCurlOption() instead. ' , E_USER_DEPRECATED );
328
+
311
329
$ this ->checkSslCertificate = $ check ;
312
330
313
331
return $ this ;
@@ -322,20 +340,24 @@ public function setCheckSslCertificate($check = false)
322
340
*/
323
341
public function getCheckSslCertificate ()
324
342
{
343
+ @trigger_error ('The ' . __METHOD__ . ' method is deprecated. You should stop using it, as it will be removed in the future. ' , E_USER_DEPRECATED );
344
+
325
345
return $ this ->checkSslCertificate ;
326
346
}
327
347
328
348
/**
329
349
* Turns on/off ssl host certificate check.
330
350
*
331
- * @deprecated
351
+ * @deprecated use setCurlOption() instead
332
352
*
333
353
* @param bool $check
334
354
*
335
355
* @return Client
336
356
*/
337
357
public function setCheckSslHost ($ check = false )
338
358
{
359
+ @trigger_error ('The ' . __METHOD__ . ' method is deprecated, use setCurlOption() instead. ' , E_USER_DEPRECATED );
360
+
339
361
$ this ->checkSslHost = (bool ) $ check ;
340
362
341
363
return $ this ;
@@ -350,13 +372,15 @@ public function setCheckSslHost($check = false)
350
372
*/
351
373
public function getCheckSslHost ()
352
374
{
375
+ @trigger_error ('The ' . __METHOD__ . ' method is deprecated. You should stop using it, as it will be removed in the future. ' , E_USER_DEPRECATED );
376
+
353
377
return $ this ->checkSslHost ;
354
378
}
355
379
356
380
/**
357
381
* Forces the SSL/TLS version to use.
358
382
*
359
- * @deprecated
383
+ * @deprecated use setCurlOption() instead
360
384
* @see http://curl.haxx.se/libcurl/c/CURLOPT_SSLVERSION.html
361
385
*
362
386
* @param int $sslVersion
@@ -365,6 +389,8 @@ public function getCheckSslHost()
365
389
*/
366
390
public function setSslVersion ($ sslVersion = 0 )
367
391
{
392
+ @trigger_error ('The ' . __METHOD__ . ' method is deprecated, use setCurlOption() instead. ' , E_USER_DEPRECATED );
393
+
368
394
$ this ->sslVersion = $ sslVersion ;
369
395
370
396
return $ this ;
@@ -379,20 +405,24 @@ public function setSslVersion($sslVersion = 0)
379
405
*/
380
406
public function getSslVersion ()
381
407
{
408
+ @trigger_error ('The ' . __METHOD__ . ' method is deprecated. You should stop using it, as it will be removed in the future. ' , E_USER_DEPRECATED );
409
+
382
410
return $ this ->sslVersion ;
383
411
}
384
412
385
413
/**
386
414
* Turns on/off http auth.
387
415
*
388
- * @deprecated
416
+ * @deprecated use setCurlOption() instead
389
417
*
390
418
* @param bool $use
391
419
*
392
420
* @return Client
393
421
*/
394
422
public function setUseHttpAuth ($ use = true )
395
423
{
424
+ @trigger_error ('The ' . __METHOD__ . ' method is deprecated, use setCurlOption() instead. ' , E_USER_DEPRECATED );
425
+
396
426
$ this ->useHttpAuth = $ use ;
397
427
398
428
return $ this ;
@@ -407,20 +437,24 @@ public function setUseHttpAuth($use = true)
407
437
*/
408
438
public function getUseHttpAuth ()
409
439
{
440
+ @trigger_error ('The ' . __METHOD__ . ' method is deprecated. You should stop using it, as it will be removed in the future. ' , E_USER_DEPRECATED );
441
+
410
442
return $ this ->useHttpAuth ;
411
443
}
412
444
413
445
/**
414
446
* Set the port of the connection.
415
447
*
416
- * @deprecated
448
+ * @deprecated use setCurlOption() instead
417
449
*
418
450
* @param int $port
419
451
*
420
452
* @return Client
421
453
*/
422
454
public function setPort ($ port = null )
423
455
{
456
+ @trigger_error ('The ' . __METHOD__ . ' method is deprecated, use setCurlOption() instead. ' , E_USER_DEPRECATED );
457
+
424
458
if (null !== $ port ) {
425
459
$ this ->port = (int ) $ port ;
426
460
}
@@ -431,13 +465,15 @@ public function setPort($port = null)
431
465
/**
432
466
* Returns Redmine response code.
433
467
*
434
- * @deprecated
468
+ * @deprecated use getLastResponseStatusCode() instead
435
469
*
436
470
* @return int
437
471
*/
438
472
public function getResponseCode ()
439
473
{
440
- return (int ) $ this ->responseCode ;
474
+ @trigger_error ('The ' . __METHOD__ . ' method is deprecated, use getLastResponseStatusCode() instead. ' , E_USER_DEPRECATED );
475
+
476
+ return (int ) $ this ->getLastResponseStatusCode ();
441
477
}
442
478
443
479
/**
@@ -451,11 +487,13 @@ public function getResponseCode()
451
487
*/
452
488
public function getPort ()
453
489
{
490
+ @trigger_error ('The ' . __METHOD__ . ' method is deprecated. You should stop using it, as it will be removed in the future. ' , E_USER_DEPRECATED );
491
+
454
492
if (null !== $ this ->port ) {
455
493
return $ this ->port ;
456
494
}
457
495
458
- $ tmp = parse_url ($ this ->getUrl () );
496
+ $ tmp = parse_url ($ this ->url );
459
497
if (isset ($ tmp ['port ' ])) {
460
498
$ this ->setPort ($ tmp ['port ' ]);
461
499
} elseif (isset ($ tmp ['scheme ' ])) {
@@ -486,7 +524,7 @@ public function stopImpersonateUser(): void
486
524
* Sets to an existing username so api calls can be
487
525
* impersonated to this user.
488
526
*
489
- * @deprecated
527
+ * @deprecated use startImpersonateUser() and stopImpersonateUser() instead
490
528
*
491
529
* @param string|null $username
492
530
*
@@ -495,8 +533,12 @@ public function stopImpersonateUser(): void
495
533
public function setImpersonateUser ($ username = null )
496
534
{
497
535
if (null === $ username ) {
536
+ @trigger_error ('The ' . __METHOD__ . ' method is deprecated, use stopImpersonateUser() instead. ' , E_USER_DEPRECATED );
537
+
498
538
$ this ->stopImpersonateUser ();
499
539
} else {
540
+ @trigger_error ('The ' . __METHOD__ . ' method is deprecated, use startImpersonateUser() instead. ' , E_USER_DEPRECATED );
541
+
500
542
$ this ->startImpersonateUser ($ username );
501
543
}
502
544
@@ -512,6 +554,8 @@ public function setImpersonateUser($username = null)
512
554
*/
513
555
public function getImpersonateUser ()
514
556
{
557
+ @trigger_error ('The ' . __METHOD__ . ' method is deprecated. You should stop using it, as it will be removed in the future. ' , E_USER_DEPRECATED );
558
+
515
559
return $ this ->impersonateUser ;
516
560
}
517
561
@@ -524,6 +568,8 @@ public function getImpersonateUser()
524
568
*/
525
569
public function setCustomHost ($ customHost = null )
526
570
{
571
+ @trigger_error ('The ' . __METHOD__ . ' method is deprecated, use setCurlOption() instead. ' , E_USER_DEPRECATED );
572
+
527
573
$ this ->customHost = $ customHost ;
528
574
529
575
return $ this ;
@@ -536,6 +582,8 @@ public function setCustomHost($customHost = null)
536
582
*/
537
583
public function getCustomHost ()
538
584
{
585
+ @trigger_error ('The ' . __METHOD__ . ' method is deprecated. You should stop using it, as it will be removed in the future. ' , E_USER_DEPRECATED );
586
+
539
587
return $ this ->customHost ;
540
588
}
541
589
@@ -577,6 +625,8 @@ public function unsetCurlOption($option)
577
625
*/
578
626
public function getCurlOptions ()
579
627
{
628
+ @trigger_error ('The ' . __METHOD__ . ' method is deprecated. You should stop using it, as it will be removed in the future. ' , E_USER_DEPRECATED );
629
+
580
630
return $ this ->curlOptions ;
581
631
}
582
632
@@ -593,6 +643,8 @@ public function getCurlOptions()
593
643
*/
594
644
public function prepareRequest ($ path , $ method = 'GET ' , $ data = '' )
595
645
{
646
+ @trigger_error ('The ' . __METHOD__ . ' method is deprecated. You should stop using it, as it will be removed in the future. ' , E_USER_DEPRECATED );
647
+
596
648
$ this ->responseCode = 0 ;
597
649
$ this ->responseContentType = '' ;
598
650
$ this ->responseBody = '' ;
@@ -724,6 +776,8 @@ private function setHttpHeader($path)
724
776
*/
725
777
public function processCurlResponse ($ response , $ contentType )
726
778
{
779
+ @trigger_error ('The ' . __METHOD__ . ' method is deprecated. You should stop using it, as it will be removed in the future. ' , E_USER_DEPRECATED );
780
+
727
781
if ($ response ) {
728
782
// if response is XML, return an SimpleXMLElement object
729
783
if (0 === strpos ($ contentType , 'application/xml ' )) {
@@ -751,6 +805,8 @@ public function processCurlResponse($response, $contentType)
751
805
*/
752
806
protected function runRequest ($ path , $ method = 'GET ' , $ data = '' )
753
807
{
808
+ @trigger_error ('The ' . __METHOD__ . ' method is deprecated. You should stop using it, as it will be removed in the future. ' , E_USER_DEPRECATED );
809
+
754
810
$ curl = $ this ->prepareRequest ($ path , $ method , $ data );
755
811
756
812
// use HTTP 1.1
0 commit comments