Issues (55)

examples/Script/parseValue.php (1 issue)

Labels
Severity
1
<?php
2
use PEAR2\Net\RouterOS;
3
4
require_once 'PEAR2/Autoload.php';
5
6
$util = new RouterOS\Util(
7
    $client = new RouterOS\Client('192.168.88.1', 'admin', 'password')
8
);
9
10
$util->setMenu('/system resource');
11
$uptime = RouterOS\Script::parseValue($util->get(null, 'uptime'));
0 ignored issues
show
It seems like $util->get(null, 'uptime') can also be of type resource; however, parameter $value of PEAR2\Net\RouterOS\Script::parseValue() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

11
$uptime = RouterOS\Script::parseValue(/** @scrutinizer ignore-type */ $util->get(null, 'uptime'));
Loading history...
12
13
$now = new DateTime;
14
15
//Will output something akin to 'Running since: Sunday, 18 Aug 2013 14:03:01'
16
echo 'Running since: ' . $now->sub($uptime)->format(DateTime::COOKIE);
17