| Conditions | 3 |
| Paths | 3 |
| Total Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 3.0175 |
| Changes | 0 | ||
| 1 | <?php |
||
| 62 | 5 | public function flush(bool $simulate = false): bool |
|
| 63 | { |
||
| 64 | 5 | $this->logger->info('flush file ['.$this->file.'] from endpoint ['.$this->name.']', [ |
|
| 65 | 5 | 'category' => get_class($this), |
|
| 66 | ]); |
||
| 67 | |||
| 68 | 5 | if ($simulate === true) { |
|
| 69 | return true; |
||
| 70 | } |
||
| 71 | |||
| 72 | 5 | if (ftruncate($this->writable, 0) === false) { |
|
| 73 | 1 | throw new Exception\WriteOperationFailed('failed flush file '.$this->file); |
|
| 74 | } |
||
| 75 | |||
| 76 | 4 | return true; |
|
| 77 | } |
||
| 78 | } |
||
| 79 |