| Total Complexity | 7 |
| Total Lines | 39 |
| Duplicated Lines | 0 % |
| Coverage | 93.75% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 16 | class MemoryLock implements ILock |
||
| 17 | { |
||
| 18 | protected bool $lock = false; |
||
| 19 | |||
| 20 | 1 | public function __destruct() |
|
| 26 | // do nothing instead of |
||
| 27 | // register_shutdown_function([$this, 'delete']); |
||
| 28 | } |
||
| 29 | // @codeCoverageIgnoreEnd |
||
| 30 | 1 | } |
|
| 31 | |||
| 32 | 1 | public function has(): bool |
|
| 35 | } |
||
| 36 | |||
| 37 | 1 | public function create(bool $force = false): bool |
|
| 38 | { |
||
| 39 | 1 | if ($this->has()) { |
|
| 40 | 1 | return false; |
|
| 41 | } |
||
| 42 | |||
| 43 | 1 | $this->lock = true; |
|
| 44 | 1 | return true; |
|
| 45 | } |
||
| 46 | |||
| 47 | 1 | public function delete(bool $force = false): bool |
|
| 55 | } |
||
| 56 | } |
||
| 57 |