jdel /
sspks
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | namespace SSpkS\Handler; |
||
| 4 | |||
| 5 | use \SSpkS\Device\DeviceList; |
||
| 6 | use \SSpkS\Output\HtmlOutput; |
||
| 7 | |||
| 8 | class BrowserDeviceListHandler extends AbstractHandler |
||
| 9 | { |
||
| 10 | public function canHandle() |
||
| 11 | { |
||
| 12 | return ($_SERVER['REQUEST_METHOD'] == 'GET'); |
||
| 13 | } |
||
| 14 | |||
| 15 | public function handle() |
||
| 16 | { |
||
| 17 | // Nothing requested --> show models overview |
||
| 18 | $output = new HtmlOutput($this->config); |
||
| 19 | try { |
||
| 20 | $deviceList = new DeviceList($this->config); |
||
| 21 | $models = $deviceList->getDevices(); |
||
| 22 | if (count($models) == 0) { |
||
| 23 | $output->setTemplate('html_modellist_none'); |
||
| 24 | } else { |
||
| 25 | $output->setVariable('modellist', $models); |
||
|
0 ignored issues
–
show
|
|||
| 26 | $output->setTemplate('html_modellist'); |
||
| 27 | } |
||
| 28 | } catch (\Exception $e) { |
||
| 29 | $output->setVariable('errorMessage', $e->getMessage()); |
||
| 30 | $output->setTemplate('html_modellist_error'); |
||
| 31 | } |
||
| 32 | $output->setVariable('is_devicelist', true); |
||
|
0 ignored issues
–
show
true is of type boolean, but the function expects a string.
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: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
Loading history...
|
|||
| 33 | $output->output(); |
||
| 34 | } |
||
| 35 | } |
||
| 36 |
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: