Lines
50.00%
4 / 8
Functions and Methods
50.00%
4 / 8
Classes and Traits
0.00%
0 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| ReadOnlyStore | 50.00% | 4 / 8 | 50.00% | 4 / 8 | 16.00 | 0.00% | 0 / 1 | |||
| __construct | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | |||||
| has | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | |||||
| getInt | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | |||||
| getFloat | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | |||||
| getString | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | |||||
| getBool | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | |||||
| getObject | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | |||||
| listKeys | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | declare(strict_types=1); | |
| 4 | ||
| 5 | namespace Stewart\Store; | |
| 6 | ||
| 7 | use Stewart\Contracts\Store\ReadableStore; | |
| 8 | use Stewart\Contracts\Store\Storable; | |
| 9 | ||
| 10 | final readonly class ReadOnlyStore implements ReadableStore | |
| 11 | { | |
| 12 | public function __construct(private ReadableStore $inner) {} | |
| 13 | ||
| 14 | public function has(string $key): bool | |
| 15 | { | |
| 16 | return $this->inner->has($key); | |
| 17 | } | |
| 18 | ||
| 19 | public function getInt(string $key): ?int | |
| 20 | { | |
| 21 | return $this->inner->getInt($key); | |
| 22 | } | |
| 23 | ||
| 24 | public function getFloat(string $key): ?float | |
| 25 | { | |
| 26 | return $this->inner->getFloat($key); | |
| 27 | } | |
| 28 | ||
| 29 | public function getString(string $key): ?string | |
| 30 | { | |
| 31 | return $this->inner->getString($key); | |
| 32 | } | |
| 33 | ||
| 34 | public function getBool(string $key): ?bool | |
| 35 | { | |
| 36 | return $this->inner->getBool($key); | |
| 37 | } | |
| 38 | ||
| 39 | /** | |
| 40 | * @template T of Storable | |
| 41 | * | |
| 42 | * @param class-string<T> $class | |
| 43 | * @return T|null | |
| 44 | */ | |
| 45 | public function getObject(string $key, string $class): ?Storable | |
| 46 | { | |
| 47 | return $this->inner->getObject($key, $class); | |
| 48 | } | |
| 49 | ||
| 50 | public function listKeys(): array | |
| 51 | { | |
| 52 | return $this->inner->listKeys(); | |
| 53 | } | |
| 54 | } |