From 1887ef7ed656f0a75a298d07c2aa9e5298856ae2 Mon Sep 17 00:00:00 2001 From: sebastiandedeyne Date: Tue, 12 Mar 2024 17:03:33 +0100 Subject: [PATCH] Provide fallbacks for config values --- src/Support/Caching/DataStructureCache.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Support/Caching/DataStructureCache.php b/src/Support/Caching/DataStructureCache.php index e41f43b8..13d8c772 100644 --- a/src/Support/Caching/DataStructureCache.php +++ b/src/Support/Caching/DataStructureCache.php @@ -17,9 +17,9 @@ class DataStructureCache public function __construct( protected array $cacheConfig, ) { - $this->store = cache()->store($this->cacheConfig['store'])?->getStore(); - $this->prefix = $this->cacheConfig['prefix'] ? "{$this->cacheConfig['prefix']}." : ''; - $this->duration = $this->cacheConfig['duration']; + $this->store = cache()->store(($this->cacheConfig['store'] ?? null))?->getStore(); + $this->prefix = ($this->cacheConfig['prefix'] ?? '') ? "{$this->cacheConfig['prefix']}." : ''; + $this->duration = $this->cacheConfig['duration'] ?? null; } public function getConfig(): ?CachedDataConfig