Lines 0.00% 0 / 9
Methods 0.00% 0 / 2
Classes 0.00% 0 / 1
Name Lines Methods CRAP
 __construct 0.00% 0 / 1 0.00% 0 / 1 2
 openConfiguredBackend 0.00% 0 / 8 0.00% 0 / 1 6
15final readonly class BrokerStoreBackendOpener
16{
17    public function __construct(
18        private StoreBackendConnector $storeBackendConnector,
19        private LoggerInterface $logger,
20        private PersistenceConfig $persistenceConfig,
21    ) {}
22
23    /**
24     * @throws StoreException
25     * @throws StoreSetupException
26     */
27    public function openConfiguredBackend(): ?GuardedStoreBackend
28    {
29        $url = $this->persistenceConfig->url;
30
31        if ($url === null) {
32            return null;
33        }
34
35        $this->logger->debug('Apps will store to ' . $url, ['prefix' => $this->persistenceConfig->prefix->value]);
36
37        return $this->storeBackendConnector->connectToBackend(
38            $url,
39            new StoreTiming($this->persistenceConfig->timeout, $this->persistenceConfig->recoveryInterval),
40        );
41    }
42}