This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | namespace Jleagle\SickBeard; |
||
3 | |||
4 | use Jleagle\CurlWrapper\Curl; |
||
5 | use Jleagle\SickBeard\Enums\FutureSortEnum; |
||
6 | use Jleagle\SickBeard\Enums\LanguageEnum; |
||
7 | use Jleagle\SickBeard\Enums\LogEnum; |
||
8 | use Jleagle\SickBeard\Enums\ShowsSortEnum; |
||
9 | use Jleagle\SickBeard\Enums\SortOrderEnum; |
||
10 | use Jleagle\SickBeard\Exceptions\SickBeardException; |
||
11 | use Packaged\Helpers\Strings; |
||
12 | |||
13 | class SickBeard |
||
14 | { |
||
15 | protected $_url; |
||
16 | protected $_apiKey; |
||
17 | |||
18 | protected $_debug = 0; |
||
19 | protected $_profile = 0; |
||
20 | protected $_help = 0; |
||
21 | protected $_callback = ''; |
||
22 | |||
23 | public function __construct($url, $apiKey) |
||
24 | { |
||
25 | $this->_url = $url; |
||
26 | $this->_apiKey = $apiKey; |
||
27 | } |
||
28 | |||
29 | /** |
||
30 | * @param int $tvdbId |
||
31 | * @param int $season |
||
32 | * @param int $episode |
||
33 | * @param bool $fullPath |
||
34 | * |
||
35 | * @return array |
||
36 | */ |
||
37 | View Code Duplication | public function episode($tvdbId, $season, $episode, $fullPath = false) |
|
38 | { |
||
39 | return $this->_request( |
||
40 | [ |
||
41 | 'cmd' => 'episode', |
||
42 | 'tvdbid' => $tvdbId, |
||
43 | 'season' => $season, |
||
44 | 'episode' => $episode, |
||
45 | 'full_path' => $fullPath ? 1 : 0, |
||
46 | ] |
||
47 | ); |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * @param int $tvdbId |
||
52 | * @param int $season |
||
53 | * @param int $episode |
||
54 | * |
||
55 | * @return array |
||
56 | */ |
||
57 | public function episodeSearch($tvdbId, $season, $episode) |
||
58 | { |
||
59 | return $this->_request( |
||
60 | [ |
||
61 | 'cmd' => 'episode.search', |
||
62 | 'tvdbid' => $tvdbId, |
||
63 | 'season' => $season, |
||
64 | 'episode' => $episode, |
||
65 | ] |
||
66 | ); |
||
67 | } |
||
68 | |||
69 | /** |
||
70 | * @param int $tvdbId |
||
71 | * @param int $season |
||
72 | * @param string $status - StatusEnum |
||
73 | * @param int $episode |
||
74 | * @param bool $force |
||
75 | * |
||
76 | * @return array |
||
77 | */ |
||
78 | View Code Duplication | public function episodeSetStatus( |
|
79 | $tvdbId, $season, $status, $episode = null, $force = false |
||
80 | ) |
||
81 | { |
||
82 | return $this->_request( |
||
83 | [ |
||
84 | 'cmd' => 'episode.setstatus', |
||
85 | 'tvdbid' => $tvdbId, |
||
86 | 'season' => $season, |
||
87 | 'status' => $status, |
||
88 | 'episode' => $episode, |
||
89 | 'force' => $force ? 1 : 0, |
||
90 | ] |
||
91 | ); |
||
92 | } |
||
93 | |||
94 | /** |
||
95 | * @param int $tvdbId |
||
96 | * |
||
97 | * @return array |
||
98 | */ |
||
99 | public function exceptions($tvdbId = null) |
||
100 | { |
||
101 | return $this->_request( |
||
102 | [ |
||
103 | 'cmd' => 'exceptions', |
||
104 | 'tvdbid' => $tvdbId |
||
105 | ] |
||
106 | ); |
||
107 | } |
||
108 | |||
109 | /** |
||
110 | * @param string $sort - FutureSortEnum |
||
111 | * @param array $type - FutureTypeEnum[] |
||
112 | * @param bool $paused |
||
113 | * |
||
114 | * @return array |
||
115 | */ |
||
116 | public function future( |
||
117 | $sort = FutureSortEnum::DATE, array $type = null, $paused = null |
||
118 | ) |
||
119 | { |
||
120 | if($type) |
||
121 | { |
||
122 | $type = implode('|', $type); |
||
123 | } |
||
124 | |||
125 | return $this->_request( |
||
126 | [ |
||
127 | 'cmd' => 'future', |
||
128 | 'sort' => $sort, |
||
129 | 'type' => $type, |
||
130 | 'pased' => $paused ? 1 : 0, |
||
131 | ] |
||
132 | ); |
||
133 | } |
||
134 | |||
135 | /** |
||
136 | * @param int $limit |
||
137 | * @param string $type - HistoryTypeEnum |
||
138 | * |
||
139 | * @return array |
||
140 | */ |
||
141 | public function history($limit = 100, $type = null) |
||
142 | { |
||
143 | return $this->_request( |
||
144 | [ |
||
145 | 'cmd' => 'history', |
||
146 | 'limit' => $limit, |
||
147 | 'type' => $type |
||
148 | ] |
||
149 | ); |
||
150 | } |
||
151 | |||
152 | /** |
||
153 | * @return array |
||
154 | */ |
||
155 | public function historyClear() |
||
156 | { |
||
157 | return $this->_request( |
||
158 | [ |
||
159 | 'cmd' => 'history.clear', |
||
160 | ] |
||
161 | ); |
||
162 | } |
||
163 | |||
164 | /** |
||
165 | * @return array |
||
166 | */ |
||
167 | public function historyTrim() |
||
168 | { |
||
169 | return $this->_request( |
||
170 | [ |
||
171 | 'cmd' => 'history.trim', |
||
172 | ] |
||
173 | ); |
||
174 | } |
||
175 | |||
176 | /** |
||
177 | * @param string $minLevel - LogEnum |
||
178 | * |
||
179 | * @return array |
||
180 | */ |
||
181 | public function logs($minLevel = LogEnum::ERROR) |
||
182 | { |
||
183 | return $this->_request( |
||
184 | [ |
||
185 | 'cmd' => 'logs', |
||
186 | 'min_level' => $minLevel, |
||
187 | ] |
||
188 | ); |
||
189 | } |
||
190 | |||
191 | /** |
||
192 | * @param $tvdbId |
||
193 | * |
||
194 | * @return array |
||
195 | */ |
||
196 | public function show($tvdbId) |
||
197 | { |
||
198 | return $this->_request( |
||
199 | [ |
||
200 | 'cmd' => 'show', |
||
201 | 'tvdbid' => $tvdbId, |
||
202 | ] |
||
203 | ); |
||
204 | } |
||
205 | |||
206 | /** |
||
207 | * @param int $tvdbid |
||
208 | * @param string $location |
||
209 | * @param bool $flattenFolders |
||
210 | * @param array $initial - InitialEnum[] |
||
211 | * @param array $archive - ArchiveEnum[] |
||
212 | * |
||
213 | * @return array |
||
214 | */ |
||
215 | public function showAddExisting( |
||
216 | $tvdbid, $location, $flattenFolders = null, array $initial = null, |
||
217 | array $archive = null |
||
218 | ) |
||
219 | { |
||
220 | if($initial) |
||
221 | { |
||
222 | $initial = implode('|', $initial); |
||
223 | } |
||
224 | |||
225 | if($archive) |
||
226 | { |
||
227 | $archive = implode('|', $archive); |
||
228 | } |
||
229 | |||
230 | return $this->_request( |
||
231 | [ |
||
232 | 'cmd' => 'show.addexisting', |
||
233 | 'tvdbid' => $tvdbid, |
||
234 | 'location' => $location, |
||
235 | 'flatten_folders' => $flattenFolders ? 1 : 0, |
||
236 | 'initial' => $initial, |
||
237 | 'archive' => $archive, |
||
238 | ] |
||
239 | ); |
||
240 | } |
||
241 | |||
242 | /** |
||
243 | * @param int $tvdbId |
||
244 | * @param string $location |
||
245 | * @param string $lang |
||
246 | * @param bool $flattenFolders |
||
247 | * @param string $status - ShowStatusEnum |
||
248 | * @param array $initial - InitialEnum[] |
||
249 | * @param array $archive - ArchiveEnum[] |
||
250 | * |
||
251 | * @return array |
||
252 | */ |
||
253 | public function showAddNew( |
||
254 | $tvdbId, $location = null, $lang = LanguageEnum::ENGLISH, |
||
255 | $flattenFolders = null, $status = null, array $initial = null, |
||
256 | array $archive = null |
||
257 | ) |
||
258 | { |
||
259 | if($initial) |
||
260 | { |
||
261 | $initial = implode('|', $initial); |
||
262 | } |
||
263 | |||
264 | if($archive) |
||
265 | { |
||
266 | $archive = implode('|', $archive); |
||
267 | } |
||
268 | |||
269 | return $this->_request( |
||
270 | [ |
||
271 | 'cmd' => 'show.addnew', |
||
272 | 'tvdbid' => $tvdbId, |
||
273 | 'location' => $location, |
||
274 | 'lang' => $lang, |
||
275 | 'flatten_folders' => $flattenFolders ? 1 : 0, |
||
276 | 'status' => $status, |
||
277 | 'initial' => $initial, |
||
278 | 'archive' => $archive, |
||
279 | ] |
||
280 | ); |
||
281 | } |
||
282 | |||
283 | /** |
||
284 | * @param int $tvdbId |
||
285 | * |
||
286 | * @return array |
||
287 | */ |
||
288 | public function showCache($tvdbId) |
||
289 | { |
||
290 | return $this->_request( |
||
291 | [ |
||
292 | 'cmd' => 'show.cache', |
||
293 | 'tvdbid' => $tvdbId, |
||
294 | ] |
||
295 | ); |
||
296 | } |
||
297 | |||
298 | /** |
||
299 | * @param int $tvdbId |
||
300 | * |
||
301 | * @return array |
||
302 | */ |
||
303 | public function showDelete($tvdbId) |
||
304 | { |
||
305 | return $this->_request( |
||
306 | [ |
||
307 | 'cmd' => 'show.delete', |
||
308 | 'tvdbid' => $tvdbId, |
||
309 | ] |
||
310 | ); |
||
311 | } |
||
312 | |||
313 | /** |
||
314 | * @param int $tvdbId |
||
315 | * |
||
316 | * @return string |
||
317 | */ |
||
318 | public function showGetBanner($tvdbId) |
||
319 | { |
||
320 | return $this->_request( |
||
321 | [ |
||
322 | 'cmd' => 'show.getbanner', |
||
323 | 'tvdbid' => $tvdbId, |
||
324 | ] |
||
325 | ); |
||
326 | } |
||
327 | |||
328 | /** |
||
329 | * @param int $tvdbId |
||
330 | * |
||
331 | * @return string |
||
332 | */ |
||
333 | public function showGetPoster($tvdbId) |
||
334 | { |
||
335 | return $this->_request( |
||
336 | [ |
||
337 | 'cmd' => 'show.getposter', |
||
338 | 'tvdbid' => $tvdbId, |
||
339 | ] |
||
340 | ); |
||
341 | } |
||
342 | |||
343 | /** |
||
344 | * @param int $tvdbId |
||
345 | * |
||
346 | * @return array |
||
347 | */ |
||
348 | public function showGetQuality($tvdbId) |
||
349 | { |
||
350 | return $this->_request( |
||
351 | [ |
||
352 | 'cmd' => 'show.getquality', |
||
353 | 'tvdbid' => $tvdbId, |
||
354 | ] |
||
355 | ); |
||
356 | } |
||
357 | |||
358 | /** |
||
359 | * @param int $tvdbId |
||
360 | * @param bool $pause |
||
361 | * |
||
362 | * @return array |
||
363 | */ |
||
364 | public function showPause($tvdbId, $pause = false) |
||
365 | { |
||
366 | return $this->_request( |
||
367 | [ |
||
368 | 'cmd' => 'show.pause', |
||
369 | 'tvdbid' => $tvdbId, |
||
370 | 'pause' => $pause ? 1 : 0, |
||
371 | ] |
||
372 | ); |
||
373 | } |
||
374 | |||
375 | /** |
||
376 | * @param int $tvdbId |
||
377 | * |
||
378 | * @return array |
||
379 | */ |
||
380 | public function showRefresh($tvdbId) |
||
381 | { |
||
382 | return $this->_request( |
||
383 | [ |
||
384 | 'cmd' => 'show.refresh', |
||
385 | 'tvdbid' => $tvdbId, |
||
386 | ] |
||
387 | ); |
||
388 | } |
||
389 | |||
390 | /** |
||
391 | * @param int $tvdbId |
||
392 | * @param string $sort - Use SortEnum enum |
||
393 | * |
||
394 | * @return array |
||
395 | */ |
||
396 | public function showSeasonList($tvdbId, $sort = SortOrderEnum::DESCENDING) |
||
397 | { |
||
398 | return $this->_request( |
||
399 | [ |
||
400 | 'cmd' => 'show.seasonlist', |
||
401 | 'tvdbid' => $tvdbId, |
||
402 | 'sort' => $sort, |
||
403 | ] |
||
404 | ); |
||
405 | } |
||
406 | |||
407 | /** |
||
408 | * @param int $tvdbId |
||
409 | * @param int $season |
||
410 | * |
||
411 | * @return array |
||
412 | */ |
||
413 | public function showSeasons($tvdbId, $season = null) |
||
414 | { |
||
415 | return $this->_request( |
||
416 | [ |
||
417 | 'cmd' => 'show.seasons', |
||
418 | 'tvdbid' => $tvdbId, |
||
419 | 'season' => $season, |
||
420 | ] |
||
421 | ); |
||
422 | } |
||
423 | |||
424 | /** |
||
425 | * @param int $tvdbId |
||
426 | * @param array $initial - InitialEnum[] |
||
427 | * @param array $archive - ArchiveEnum[] |
||
428 | * |
||
429 | * @return array |
||
430 | */ |
||
431 | public function showSetQuality( |
||
432 | $tvdbId, array $initial = null, array $archive = null |
||
433 | ) |
||
434 | { |
||
435 | if($initial) |
||
436 | { |
||
437 | $initial = implode('|', $initial); |
||
438 | } |
||
439 | |||
440 | if($archive) |
||
441 | { |
||
442 | $archive = implode('|', $archive); |
||
443 | } |
||
444 | |||
445 | return $this->_request( |
||
446 | [ |
||
447 | 'cmd' => 'show.setquality', |
||
448 | 'tvdbid' => $tvdbId, |
||
449 | 'initial' => $initial, |
||
450 | 'archive' => $archive, |
||
451 | ] |
||
452 | ); |
||
453 | } |
||
454 | |||
455 | /** |
||
456 | * @param int $tvdbId |
||
457 | * |
||
458 | * @return array |
||
459 | */ |
||
460 | public function showStats($tvdbId) |
||
461 | { |
||
462 | return $this->_request( |
||
463 | [ |
||
464 | 'cmd' => 'show.stats', |
||
465 | 'tvdbid' => $tvdbId, |
||
466 | ] |
||
467 | ); |
||
468 | } |
||
469 | |||
470 | /** |
||
471 | * @param int $tvdbId |
||
472 | * |
||
473 | * @return array |
||
474 | */ |
||
475 | public function showUpdate($tvdbId) |
||
476 | { |
||
477 | return $this->_request( |
||
478 | [ |
||
479 | 'cmd' => 'show.update', |
||
480 | 'tvdbid' => $tvdbId, |
||
481 | ] |
||
482 | ); |
||
483 | } |
||
484 | |||
485 | /** |
||
486 | * @param string $sort - SortSortEnum |
||
487 | * @param bool $paused |
||
488 | * |
||
489 | * @return array |
||
490 | */ |
||
491 | public function shows($sort = ShowsSortEnum::ID, $paused = null) |
||
492 | { |
||
493 | return $this->_request( |
||
494 | [ |
||
495 | 'cmd' => 'shows', |
||
496 | 'sort' => $sort, |
||
497 | 'paused' => $paused ? 1 : 0 |
||
498 | ] |
||
499 | ); |
||
500 | } |
||
501 | |||
502 | /** |
||
503 | * @return array |
||
504 | */ |
||
505 | public function showsStats() |
||
506 | { |
||
507 | return $this->_request( |
||
508 | [ |
||
509 | 'cmd' => 'shows.stats', |
||
510 | ] |
||
511 | ); |
||
512 | } |
||
513 | |||
514 | /** |
||
515 | * @return array |
||
516 | */ |
||
517 | public function sickBeard() |
||
518 | { |
||
519 | return $this->_request( |
||
520 | [ |
||
521 | 'cmd' => 'sb', |
||
522 | ] |
||
523 | ); |
||
524 | } |
||
525 | |||
526 | /** |
||
527 | * @param string $location |
||
528 | * @param bool $default |
||
529 | * |
||
530 | * @return array |
||
531 | */ |
||
532 | public function sickBeardAddRootDirectory($location, $default = false) |
||
533 | { |
||
534 | return $this->_request( |
||
535 | [ |
||
536 | 'cmd' => 'sb.addrootdir', |
||
537 | 'location' => $location, |
||
538 | 'default' => $default ? 1 : 0, |
||
539 | ] |
||
540 | ); |
||
541 | } |
||
542 | |||
543 | /** |
||
544 | * @return array |
||
545 | */ |
||
546 | public function sickBeardCheckScheduler() |
||
547 | { |
||
548 | return $this->_request( |
||
549 | [ |
||
550 | 'cmd' => 'sb.checkscheduler', |
||
551 | ] |
||
552 | ); |
||
553 | } |
||
554 | |||
555 | /** |
||
556 | * @param string $location |
||
557 | * |
||
558 | * @return array |
||
559 | */ |
||
560 | public function sickBeardDeleteRootDirectory($location) |
||
561 | { |
||
562 | return $this->_request( |
||
563 | [ |
||
564 | 'cmd' => 'sb.deleterootdir', |
||
565 | 'location' => $location |
||
566 | ] |
||
567 | ); |
||
568 | } |
||
569 | |||
570 | /** |
||
571 | * @return array |
||
572 | */ |
||
573 | public function sickBeardForceSearch() |
||
574 | { |
||
575 | return $this->_request( |
||
576 | [ |
||
577 | 'cmd' => 'sb.forcesearch', |
||
578 | ] |
||
579 | ); |
||
580 | } |
||
581 | |||
582 | /** |
||
583 | * @return array |
||
584 | */ |
||
585 | public function sickBeardGetDefaults() |
||
586 | { |
||
587 | return $this->_request( |
||
588 | [ |
||
589 | 'cmd' => 'sb.getdefaults', |
||
590 | ] |
||
591 | ); |
||
592 | } |
||
593 | |||
594 | /** |
||
595 | * @return array |
||
596 | */ |
||
597 | public function sickBeardGetMessages() |
||
598 | { |
||
599 | return $this->_request( |
||
600 | [ |
||
601 | 'cmd' => 'sb.getmessages', |
||
602 | ] |
||
603 | ); |
||
604 | } |
||
605 | |||
606 | /** |
||
607 | * @return array |
||
608 | */ |
||
609 | public function sickBeardGetRootDirectories() |
||
610 | { |
||
611 | return $this->_request( |
||
612 | [ |
||
613 | 'cmd' => 'sb.getrootdirs', |
||
614 | ] |
||
615 | ); |
||
616 | } |
||
617 | |||
618 | /** |
||
619 | * @param bool $pause |
||
620 | * |
||
621 | * @return array |
||
622 | */ |
||
623 | public function sickBeardPauseBacklog($pause = false) |
||
624 | { |
||
625 | return $this->_request( |
||
626 | [ |
||
627 | 'cmd' => 'sb.pausebacklog', |
||
628 | 'pause' => $pause ? 1 : 0 |
||
629 | ] |
||
630 | ); |
||
631 | } |
||
632 | |||
633 | /** |
||
634 | * @return array |
||
635 | */ |
||
636 | public function sickBeardPing() |
||
637 | { |
||
638 | return $this->_request( |
||
639 | [ |
||
640 | 'cmd' => 'sb.ping', |
||
641 | ] |
||
642 | ); |
||
643 | } |
||
644 | |||
645 | /** |
||
646 | * @return array |
||
647 | */ |
||
648 | public function sickBeardRestart() |
||
649 | { |
||
650 | return $this->_request( |
||
651 | [ |
||
652 | 'cmd' => 'sb.restart', |
||
653 | ] |
||
654 | ); |
||
655 | } |
||
656 | |||
657 | /** |
||
658 | * @param string $name |
||
659 | * @param int $tvdbId |
||
660 | * @param string $lang - LanguageEnum |
||
661 | * |
||
662 | * @return array |
||
663 | */ |
||
664 | public function sickBeardSearchTvDb( |
||
665 | $name = null, $tvdbId = null, $lang = LanguageEnum::ENGLISH |
||
666 | ) |
||
667 | { |
||
668 | return $this->_request( |
||
669 | [ |
||
670 | 'cmd' => 'sb.searchtvdb', |
||
671 | 'name' => $name, |
||
672 | 'tvdbid' => $tvdbId, |
||
673 | 'lang' => $lang, |
||
674 | ] |
||
675 | ); |
||
676 | } |
||
677 | |||
678 | /** |
||
679 | * @param bool $futureShowPaused |
||
680 | * @param string $status - ShowStatusEnum |
||
681 | * @param bool $flattenFolders |
||
682 | * @param array $initial - InitialEnum[] |
||
683 | * @param array $archive - ArchiveEnum[] |
||
684 | * |
||
685 | * @return array |
||
686 | */ |
||
687 | public function sickBeardSetDefaults( |
||
688 | $futureShowPaused = null, $status = null, $flattenFolders = null, |
||
689 | array $initial = null, array $archive = null |
||
690 | ) |
||
691 | { |
||
692 | if($initial) |
||
693 | { |
||
694 | $initial = implode('|', $initial); |
||
695 | } |
||
696 | |||
697 | if($archive) |
||
698 | { |
||
699 | $archive = implode('|', $archive); |
||
700 | } |
||
701 | |||
702 | return $this->_request( |
||
703 | [ |
||
704 | 'cmd' => 'sb.setdefaults', |
||
705 | 'future_show_paused' => $futureShowPaused ? 1 : 0, |
||
706 | 'status' => $status, |
||
707 | 'flatten_folders' => $flattenFolders ? 1 : 0, |
||
708 | 'initial' => $initial, |
||
709 | 'archive' => $archive, |
||
710 | ] |
||
711 | ); |
||
712 | } |
||
713 | |||
714 | /** |
||
715 | * @return array |
||
716 | */ |
||
717 | public function sickBeardShutdown() |
||
718 | { |
||
719 | return $this->_request( |
||
720 | [ |
||
721 | 'cmd' => 'sb.shutdown', |
||
722 | ] |
||
723 | ); |
||
724 | } |
||
725 | |||
726 | /** |
||
727 | * @param array $params |
||
728 | * |
||
729 | * @return array |
||
730 | * |
||
731 | * @throws SickBeardException |
||
732 | */ |
||
733 | protected function _request($params) |
||
734 | { |
||
735 | |||
736 | if($this->_debug) |
||
737 | { |
||
738 | $params['debug'] = 1; |
||
739 | } |
||
740 | if($this->_profile) |
||
741 | { |
||
742 | $params['profile'] = 1; |
||
743 | } |
||
744 | if($this->_help) |
||
745 | { |
||
746 | $params['help'] = 1; |
||
747 | } |
||
748 | if($this->_callback) |
||
749 | { |
||
750 | $params['callback'] = $this->_callback; |
||
751 | } |
||
752 | |||
753 | $url = $this->_url . '/api/' . $this->_apiKey; |
||
754 | |||
755 | $response = Curl::get($url, $params)->run(); |
||
756 | |||
757 | if($response->getHttpCode() != 200) |
||
758 | { |
||
759 | throw new SickBeardException('Invalid response'); |
||
760 | } |
||
761 | |||
762 | $contentType = $response->getContentType(); |
||
763 | |||
764 | if(Strings::contains($contentType, 'json', false)) |
||
0 ignored issues
–
show
|
|||
765 | { |
||
766 | $array = $response->getJson(); |
||
767 | |||
768 | if(isset($array['result']) && $array['result'] != 'success') |
||
769 | { |
||
770 | throw new SickBeardException($array['message']); |
||
771 | } |
||
772 | |||
773 | return $array['data']; |
||
774 | } |
||
775 | else |
||
776 | { |
||
777 | header('Content-Type: ' . $contentType); |
||
778 | return $response->getOutput(); |
||
779 | } |
||
780 | } |
||
781 | |||
782 | /** |
||
783 | * @param bool $debug |
||
784 | * |
||
785 | * @return $this |
||
786 | */ |
||
787 | public function setDebug($debug = true) |
||
788 | { |
||
789 | $this->_debug = $debug ? 1 : 0; |
||
790 | return $this; |
||
791 | } |
||
792 | |||
793 | /** |
||
794 | * @param bool $help |
||
795 | * |
||
796 | * @return $this |
||
797 | */ |
||
798 | public function setHelp($help = true) |
||
799 | { |
||
800 | $this->_help = $help ? 1 : 0; |
||
801 | return $this; |
||
802 | } |
||
803 | |||
804 | /** |
||
805 | * @param bool $profile |
||
806 | * |
||
807 | * @return $this |
||
808 | */ |
||
809 | public function setProfile($profile = true) |
||
810 | { |
||
811 | $this->_profile = $profile ? 1 : 0; |
||
812 | return $this; |
||
813 | } |
||
814 | |||
815 | /** |
||
816 | * @param string $callback |
||
817 | * |
||
818 | * @return $this |
||
819 | */ |
||
820 | public function setCallback($callback) |
||
821 | { |
||
822 | $this->_callback = $callback; |
||
823 | return $this; |
||
824 | } |
||
825 | } |
||
826 |
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: