Conditions | 4 |
Paths | 4 |
Total Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 4.0218 |
Changes | 0 |
1 | <?php |
||
55 | 8 | public function flush(bool $simulate = false): bool |
|
56 | { |
||
57 | 8 | $this->logger->info('flush file ['.$this->file.'] from endpoint ['.$this->name.']', [ |
|
58 | 8 | 'category' => get_class($this), |
|
59 | ]); |
||
60 | |||
61 | 8 | if ($simulate === true) { |
|
62 | return true; |
||
63 | } |
||
64 | |||
65 | 8 | foreach ($this->files as $stream) { |
|
66 | 8 | if (ftruncate($stream['stream'], 0) === false) { |
|
67 | 8 | throw new Exception\WriteOperationFailed('failed flush file '.$this->file); |
|
68 | } |
||
69 | } |
||
70 | |||
71 | 7 | return true; |
|
72 | } |
||
73 | } |
||
74 |