| Total Complexity | 12 |
| Total Lines | 58 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 16 | class XStorage implements IStorage |
||
| 17 | { |
||
| 18 | /** @var string */ |
||
| 19 | protected $storedData = ''; |
||
| 20 | |||
| 21 | public function canUse(): bool |
||
| 22 | { |
||
| 23 | return true; |
||
| 24 | } |
||
| 25 | |||
| 26 | public function write(string $sharedKey, $data, ?int $timeout = null): bool |
||
| 27 | { |
||
| 28 | if ('off' !== $sharedKey) { |
||
| 29 | $this->storedData = $data; |
||
| 30 | return true; |
||
| 31 | } else { |
||
| 32 | return false; |
||
| 33 | } |
||
| 34 | } |
||
| 35 | |||
| 36 | public function read(string $sharedKey) |
||
| 37 | { |
||
| 38 | if ('off' !== $sharedKey) { |
||
| 39 | return $this->storedData; |
||
| 40 | } else { |
||
| 41 | return 'mocked'; |
||
| 42 | } |
||
| 43 | } |
||
| 44 | |||
| 45 | public function remove(string $sharedKey): bool |
||
| 46 | { |
||
| 47 | $this->storedData = ''; |
||
| 48 | return 'off' !== $sharedKey; |
||
| 49 | } |
||
| 50 | |||
| 51 | public function exists(string $sharedKey): bool |
||
| 52 | { |
||
| 53 | return ('off' !== $sharedKey) ? !empty($this->storedData) : false; |
||
| 54 | } |
||
| 55 | |||
| 56 | public function lookup(string $mask): Traversable |
||
| 57 | { |
||
| 58 | yield from []; |
||
| 59 | } |
||
| 60 | |||
| 61 | public function increment(string $key): bool |
||
| 62 | { |
||
| 63 | return 'off' !== $key; |
||
| 64 | } |
||
| 65 | |||
| 66 | public function decrement(string $key): bool |
||
| 67 | { |
||
| 68 | return 'off' !== $key; |
||
| 69 | } |
||
| 70 | |||
| 71 | public function removeMulti(array $keys): array |
||
| 74 | } |
||
| 75 | } |
||
| 76 |