Issues (55)

examples/Client/sync-request-simple.php (2 issues)

Labels
Severity
1
<?php
2
use PEAR2\Net\RouterOS;
3
4
require_once 'PEAR2/Autoload.php';
5
6
try {
7
    $client = new RouterOS\Client('192.168.88.1', 'admin', 'password');
8
} catch (Exception $e) {
9
    die('Unable to connect to the router.');
10
    //Inspect $e if you want to know details about the failure.
11
}
12
13
$responses = $client->sendSync(new RouterOS\Request('/ip/arp/print'));
14
15
foreach ($responses as $response) {
16
    if ($response->getType() === RouterOS\Response::TYPE_DATA) {
17
        echo 'IP: ', $response->getProperty('address'),
0 ignored issues
show
Are you sure $response->getProperty('address') of type null|resource|string can be used in echo? ( Ignorable by Annotation )

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

17
        echo 'IP: ', /** @scrutinizer ignore-type */ $response->getProperty('address'),
Loading history...
18
        ' MAC: ', $response->getProperty('mac-address'),
0 ignored issues
show
Are you sure $response->getProperty('mac-address') of type null|resource|string can be used in echo? ( Ignorable by Annotation )

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

18
        ' MAC: ', /** @scrutinizer ignore-type */ $response->getProperty('mac-address'),
Loading history...
19
        "\n";
20
    }
21
}
22
//Example output:
23
/*
24
IP: 192.168.88.100 MAC: 00:00:00:00:00:01
25
IP: 192.168.88.101 MAC: 00:00:00:00:00:02
26
 */
27