| Conditions | 4 |
| Paths | 4 |
| Total Lines | 17 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | public function checkStatus(): Result |
||
| 24 | { |
||
| 25 | $result = new Result($this->label); |
||
| 26 | |||
| 27 | if (!file_exists($this->filename)) { |
||
| 28 | $result->setError("Log file $this->filename does not exist!"); |
||
| 29 | return $result; |
||
| 30 | } |
||
| 31 | |||
| 32 | if (!empty($this->content)) { |
||
| 33 | $fileContent = file_get_contents($this->filename); |
||
| 34 | if (false === strpos($fileContent, $this->content)) { |
||
| 35 | $result->setError('Log file failure'); |
||
| 36 | $result->setDetails('Timestamp: '.date('d.m.Y H:i', filemtime($this->filename))); |
||
| 37 | } |
||
| 38 | } |
||
| 39 | return $result; |
||
| 40 | } |
||
| 42 |