Lines
0.00%
0 / 5
Methods
0.00%
0 / 2
Classes
0.00%
0 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| __construct | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | ||
| createStores | 0.00% | 0 / 4 | 0.00% | 0 / 1 | 6 | ||
| 18 | final readonly class WorkerStoresFactory | |
| 19 | { | |
| 20 | public function __construct( | |
| 21 | private Bootstrap $bootstrap, | |
| 22 | private StoreValueCodec $codec, | |
| 23 | private ClosestNameFinder $closestNameFinder, | |
| 24 | private ?StoreBackend $storeBackend = null, | |
| 25 | ) {} | |
| 26 | ||
| 27 | /** @throws StoreSetupException */ | |
| 28 | public function createStores(): Stores | |
| 29 | { | |
| 30 | if ($this->storeBackend === null) { | |
| 31 | return new DisabledStores(); | |
| 32 | } | |
| 33 | ||
| 34 | $prefix = $this->bootstrap->store->prefix ?? throw new LogicException('A store backend was opened without store settings.'); | |
| 35 | ||
| 36 | return new KeyspacedStores($this->storeBackend, new StorePrefix($prefix), $this->bootstrap->knownAppIds->collection, $this->codec, $this->closestNameFinder); | |
| 37 | } | |
| 38 | } |