| Conditions | 3 |
| Paths | 4 |
| Total Lines | 18 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 3.0123 |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | 1 | protected function garbageCollect(): bool |
|
| 16 | { |
||
| 17 | 1 | static $currentIteration = 0; |
|
| 18 | |||
| 19 | 1 | if (false === gc_enabled()) { |
|
| 20 | 1 | gc_enable(); |
|
| 21 | } |
||
| 22 | |||
| 23 | 1 | if (++$currentIteration >= static::GARBAGE_COLLECT_ITERATIONS) { |
|
| 24 | 1 | $currentIteration = 0; |
|
| 25 | |||
| 26 | 1 | gc_collect_cycles(); |
|
| 27 | |||
| 28 | 1 | return true; |
|
| 29 | } |
||
| 30 | |||
| 31 | return false; |
||
| 32 | } |
||
| 33 | } |
||
| 34 |