@@ -25,7 +25,9 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | $file = new File(); |
| 27 | 27 | |
| 28 | - if (!$file->fileExists('/proc/net/dev')) return 0; |
|
| 28 | + if (!$file->fileExists('/proc/net/dev')) { |
|
| 29 | + return 0; |
|
| 30 | + } |
|
| 29 | 31 | |
| 30 | 32 | $lines = $file->getContents('/proc/net/dev', true); |
| 31 | 33 | foreach ($lines as $line) { |
@@ -38,12 +40,16 @@ discard block |
||
| 38 | 40 | } |
| 39 | 41 | } |
| 40 | 42 | |
| 41 | - if (!isset($total)) return 0; |
|
| 43 | + if (!isset($total)) { |
|
| 44 | + return 0; |
|
| 45 | + } |
|
| 42 | 46 | |
| 43 | 47 | $history = $memory->getData(self::MEMORY_KEY) ?? []; |
| 44 | 48 | $lastTotal = end($history); |
| 45 | 49 | |
| 46 | - if (!$lastTotal) $lastTotal = 0; |
|
| 50 | + if (!$lastTotal) { |
|
| 51 | + $lastTotal = 0; |
|
| 52 | + } |
|
| 47 | 53 | |
| 48 | 54 | if (!empty($history) && $total < $lastTotal) { |
| 49 | 55 | $memory->addData(self::MEMORY_KEY, $total); |