Skip to content

Commit

Permalink
Applied code change suggestion
Browse files Browse the repository at this point in the history
Signed-off-by: Adrian Sausenthaler <github@sausenthaler.de>
  • Loading branch information
sausix committed Dec 2, 2020
1 parent 0f9d5c3 commit 4ff3e3d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/OperatingSystems/DefaultOs.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public function getNetworkInfo() {
* @return string
*/
public function getNetworkInterfaces() {
$interfaces = array_diff(scandir("/sys/class/net"), ['.', '..']); // remove dot directories
$interfaces = array_diff(scandir('/sys/class/net'), ['.', '..']); // remove dot directories
$result = [];

foreach ($interfaces as $interface) {
Expand All @@ -155,7 +155,7 @@ public function getNetworkInterfaces() {
if ($iface['interface'] !== 'lo') {
$iface['status'] = shell_exec('cat /sys/class/net/' . $iface['interface'] . '/operstate');
$iface['speed'] = shell_exec('cat /sys/class/net/' . $iface['interface'] . '/speed');
if ($iface['speed'] !== '' and substr($iface['speed'], 0, 1) != "-") {
if ($iface['speed'] !== '' && trim($iface['speed']) !== '-1') {
$iface['speed'] = $iface['speed'] . 'Mbps';
} else {
$iface['speed'] = 'unknown';
Expand Down

0 comments on commit 4ff3e3d

Please sign in to comment.