| Conditions | 3 |
| Paths | 3 |
| Total Lines | 17 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 24 | public function getValue(float $lastValue): float |
||
| 25 | { |
||
| 26 | $lastLineCount = Memory::getInstance()->getLastData($this->getName() . '_absolute', -1); |
||
| 27 | $lineCount = $this->getLineCount($this->filename); |
||
| 28 | Memory::getInstance()->addData($this->getName() . '_absolute', $lineCount); |
||
| 29 | |||
| 30 | // this is the first run we return 0 to skip this value |
||
| 31 | if ($lastLineCount < 0) { |
||
| 32 | return 0; |
||
| 33 | } |
||
| 34 | |||
| 35 | // we assume that there was a log rotation done here |
||
| 36 | if ($lineCount < $lastLineCount) { |
||
| 37 | return $lineCount; |
||
| 38 | } |
||
| 39 | |||
| 40 | return $lineCount - $lastLineCount; |
||
| 41 | } |
||
| 48 | } |