Passed
Pull Request — main (#63)
by Sílvio
03:01
created
src/Exceptions/ConnectionException.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -53,23 +53,23 @@
 block discarded – undo
53 53
     }
54 54
     
55 55
     /**
56
-    * Converts the exception to a JSON serializable format.
57
-    * 
58
-    * @return string
59
-    */
56
+     * Converts the exception to a JSON serializable format.
57
+     * 
58
+     * @return string
59
+     */
60 60
     public function jsonSerialize(): array
61 61
     {
62 62
         return parent::jsonSerialize();
63 63
     }
64 64
 
65 65
     /**
66
-    * Converts the exception to a JSON string.
67
-    *
68
-    * @param int $options
69
-    * @return string
70
-    */
66
+     * Converts the exception to a JSON string.
67
+     *
68
+     * @param int $options
69
+     * @return string
70
+     */
71 71
     public function toJson(int $options = 0)
72 72
     {
73
-      return parent::toJson($options);
73
+        return parent::toJson($options);
74 74
     }
75 75
 }
Please login to merge, or discard this patch.
src/CacheStore/FileCacheStore.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -43,18 +43,18 @@
 block discarded – undo
43 43
 
44 44
 
45 45
     /**
46
-    * @var CacheLogger
47
-    */
46
+     * @var CacheLogger
47
+     */
48 48
     private $logger = null;
49 49
 
50 50
     /**
51
-    * @var FileCacheManager
52
-    */
51
+     * @var FileCacheManager
52
+     */
53 53
     private FileCacheManager $fileManager;
54 54
 
55 55
     /**
56
-    * @var FileCacheFlusher
57
-    */
56
+     * @var FileCacheFlusher
57
+     */
58 58
     private FileCacheFlusher $flusher;
59 59
 
60 60
 
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
      * @return mixed
190 190
      * @throws CacheFileException return string|void
191 191
      */
192
-    public function getCache(string $cacheKey, string $namespace = '', string|int $ttl = 3600): mixed
192
+    public function getCache(string $cacheKey, string $namespace = '', string | int $ttl = 3600): mixed
193 193
     {
194 194
        
195 195
         $ttl = CacheFileHelper::ttl($ttl, $this->defaultTTL);
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
      * @return array
278 278
      * @throws CacheFileException
279 279
      */
280
-    public function getMany(array $cacheKeys, string $namespace = '', string|int $ttl = 3600): array
280
+    public function getMany(array $cacheKeys, string $namespace = '', string | int $ttl = 3600): array
281 281
     {
282 282
         $ttl = CacheFileHelper::ttl($ttl, $this->defaultTTL);
283 283
         $results = [];
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
      * @return void
325 325
      * @throws CacheFileException
326 326
      */
327
-    public function putCache(string $cacheKey, mixed $cacheData, string $namespace = '', string|int $ttl = 3600): void
327
+    public function putCache(string $cacheKey, mixed $cacheData, string $namespace = '', string | int $ttl = 3600): void
328 328
     {
329 329
         $cacheFile = $this->buildCacheFilePath($cacheKey, $namespace);
330 330
         $data = $this->fileManager->serialize($cacheData);
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
      * @return void
364 364
      * @throws CacheFileException
365 365
      */
366
-    public function renewCache(string $cacheKey, string|int $ttl, string $namespace = ''): void
366
+    public function renewCache(string $cacheKey, string | int $ttl, string $namespace = ''): void
367 367
     {
368 368
         $cacheData = $this->getCache($cacheKey, $namespace);
369 369
         if ($cacheData) {
Please login to merge, or discard this patch.
src/CacheStore/CacheManager/FileCacheFlusher.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
             return;
53 53
         }
54 54
 
55
-        $lastFlushTime = (int) $this->fileManager->readFile($this->lastFlushTimeFile);
55
+        $lastFlushTime = (int)$this->fileManager->readFile($this->lastFlushTimeFile);
56 56
 
57 57
         if ((time() - $lastFlushTime) >= $flushAfterSeconds) {
58 58
             $this->flushCache();
Please login to merge, or discard this patch.
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -13,18 +13,18 @@  discard block
 block discarded – undo
13 13
 class FileCacheFlusher
14 14
 {
15 15
     /**
16
-    * @var FileCacheManager
17
-    */
16
+     * @var FileCacheManager
17
+     */
18 18
     private FileCacheManager $fileManager;
19 19
 
20 20
     /**
21
-    * @var string $cacheDir
22
-    */
21
+     * @var string $cacheDir
22
+     */
23 23
     private string $cacheDir;
24 24
 
25 25
     /**
26
-    * @var string $lastFlushTimeFile
27
-    */
26
+     * @var string $lastFlushTimeFile
27
+     */
28 28
     private string $lastFlushTimeFile;
29 29
 
30 30
     /**
@@ -41,10 +41,10 @@  discard block
 block discarded – undo
41 41
     }
42 42
 
43 43
     /**
44
-    * Flushes all cache items and updates the last flush timestamp.
45
-    *
46
-    * @return void
47
-    */
44
+     * Flushes all cache items and updates the last flush timestamp.
45
+     *
46
+     * @return void
47
+     */
48 48
     public function flushCache(): void
49 49
     {
50 50
         $this->fileManager->clearDirectory($this->cacheDir);
@@ -52,11 +52,11 @@  discard block
 block discarded – undo
52 52
     }
53 53
 
54 54
     /**
55
-    * Handles the auto-flush functionality based on options.
56
-    *
57
-    * @param array $options
58
-    * @return void
59
-    */
55
+     * Handles the auto-flush functionality based on options.
56
+     *
57
+     * @param array $options
58
+     * @return void
59
+     */
60 60
     public function handleAutoFlush(array $options): void
61 61
     {
62 62
         if (isset($options['flushAfter'])) {
Please login to merge, or discard this patch.
src/Interface/CacheerInterface.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
      * @param string|int $ttl Lifetime in seconds (default: 3600)
53 53
      * @return mixed Returns the cached data or null if not found
54 54
      */
55
-    public function getCache(string $cacheKey, string $namespace = '', string|int $ttl = 3600);
55
+    public function getCache(string $cacheKey, string $namespace = '', string | int $ttl = 3600);
56 56
 
57 57
     /**
58 58
      * Retrieves multiple cache items by their keys.
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
      * @param string|int $ttl Lifetime in seconds (default: 3600)
63 63
      * @return CacheDataFormatter|mixed Returns a formatter with the retrieved items
64 64
      */
65
-    public function getMany(array $cacheKeys, string $namespace, string|int $ttl = 3600);
65
+    public function getMany(array $cacheKeys, string $namespace, string | int $ttl = 3600);
66 66
 
67 67
     /**
68 68
      * Checks if a cache item exists.
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
      * @param string|int $ttl Lifetime in seconds (default: 3600)
83 83
      * @return bool True on success, false on failure
84 84
      */
85
-    public function putCache(string $cacheKey, mixed $cacheData, string $namespace = '', int|string $ttl = 3600);
85
+    public function putCache(string $cacheKey, mixed $cacheData, string $namespace = '', int | string $ttl = 3600);
86 86
 
87 87
     /**
88 88
      * Stores multiple items in the cache.
Please login to merge, or discard this patch.
tests/Feature/FileCacheStoreFeatureTest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -92,11 +92,11 @@  discard block
 block discarded – undo
92 92
     public function test_remember_saves_and_recover_values()
93 93
     {
94 94
         $this->cache->flushCache();
95
-        $value = $this->cache->remember('remember_test_key', 60, function () {
95
+        $value = $this->cache->remember('remember_test_key', 60, function() {
96 96
             return 'valor_teste';
97 97
         });
98 98
         $this->assertEquals('valor_teste', $value);
99
-        $cachedValue = $this->cache->remember('remember_test_key', 60, function(){
99
+        $cachedValue = $this->cache->remember('remember_test_key', 60, function() {
100 100
             return 'novo_valor';
101 101
         });
102 102
         $this->assertEquals('valor_teste', $cachedValue);
@@ -105,11 +105,11 @@  discard block
 block discarded – undo
105 105
     public function test_remember_forever_saves_value_indefinitely()
106 106
     {
107 107
         $this->cache->flushCache();
108
-        $value = $this->cache->rememberForever('remember_forever_key', function () {
108
+        $value = $this->cache->rememberForever('remember_forever_key', function() {
109 109
             return 'valor_eterno';
110 110
         });
111 111
         $this->assertEquals('valor_eterno', $value);
112
-        $cachedValue = $this->cache->rememberForever('remember_forever_key', function () {
112
+        $cachedValue = $this->cache->rememberForever('remember_forever_key', function() {
113 113
             return 'novo_valor';
114 114
         });
115 115
         $this->assertEquals('valor_eterno', $cachedValue);
Please login to merge, or discard this patch.
src/CacheStore/ArrayCacheStore.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
    * @param int|string $ttl
141 141
    * @return mixed
142 142
    */
143
-  public function getCache(string $cacheKey, string $namespace = '', string|int $ttl = 3600): mixed
143
+  public function getCache(string $cacheKey, string $namespace = '', string | int $ttl = 3600): mixed
144 144
   {
145 145
     $arrayStoreKey = $this->buildArrayKey($cacheKey, $namespace);
146 146
 
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
    * @param string|int $ttl
230 230
    * @return array
231 231
    */
232
-  public function getMany(array $cacheKeys, string $namespace = '', string|int $ttl = 3600): array
232
+  public function getMany(array $cacheKeys, string $namespace = '', string | int $ttl = 3600): array
233 233
   {
234 234
     $results = [];
235 235
     foreach ($cacheKeys as $cacheKey) {
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
   {
264 264
     $cacheData = $this->getCache($cacheKey, $namespace);
265 265
 
266
-    if(!empty($cacheData) && is_numeric($cacheData)) {
266
+    if (!empty($cacheData) && is_numeric($cacheData)) {
267 267
       $this->putCache($cacheKey, (int)($cacheData + $amount), $namespace);
268 268
       $this->setMessage($this->getMessage(), $this->isSuccess());
269 269
       return true;
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
    * @param int|string $ttl
302 302
    * @return bool
303 303
    */
304
-  public function putCache(string $cacheKey, mixed $cacheData, string $namespace = '', int|string $ttl = 3600): bool
304
+  public function putCache(string $cacheKey, mixed $cacheData, string $namespace = '', int | string $ttl = 3600): bool
305 305
   {
306 306
     $arrayStoreKey = $this->buildArrayKey($cacheKey, $namespace);
307 307
 
@@ -344,12 +344,12 @@  discard block
 block discarded – undo
344 344
    * @param string $namespace
345 345
    * @return void
346 346
    */
347
-  public function renewCache(string $cacheKey, int|string $ttl = 3600, string $namespace = ''): void
347
+  public function renewCache(string $cacheKey, int | string $ttl = 3600, string $namespace = ''): void
348 348
   {
349 349
     $arrayStoreKey = $this->buildArrayKey($cacheKey, $namespace);
350 350
 
351 351
     if (isset($this->arrayStore[$arrayStoreKey])) {
352
-        $ttlSeconds = is_numeric($ttl) ? (int) $ttl : strtotime($ttl) - time();
352
+        $ttlSeconds = is_numeric($ttl) ? (int)$ttl : strtotime($ttl) - time();
353 353
         $this->arrayStore[$arrayStoreKey]['expirationTime'] = time() + $ttlSeconds;
354 354
         $this->setMessage("cacheKey: {$cacheKey} renewed successfully", true);
355 355
         $this->logger->debug("{$this->getMessage()} from array driver.");
Please login to merge, or discard this patch.
Indentation   +317 added lines, -317 removed lines patch added patch discarded remove patch
@@ -13,117 +13,117 @@  discard block
 block discarded – undo
13 13
 class ArrayCacheStore implements CacheerInterface
14 14
 {
15 15
 
16
-  /**
17
-  * @param array $arrayStore
18
-  */
19
-  private array $arrayStore = [];
20
-
21
-  /**
22
-   * @var boolean
23
-   */
24
-  private bool $success = false;
25
-
26
-  /**
27
-   * @var string
28
-   */
29
-  private string $message = '';
30
-
31
-  /**
32
-   * @var ?CacheLogger
33
-   */
34
-  private ?CacheLogger $logger = null;
35
-
36
-  /**
37
-   * @var array<string, array<string,bool>>
38
-   */
39
-  private array $tags = [];
40
-
41
-  /**
42
-   * ArrayCacheStore constructor.
43
-   * 
44
-   * @param string $logPath
45
-   */
46
-  public function __construct(string $logPath)
47
-  {
16
+    /**
17
+     * @param array $arrayStore
18
+     */
19
+    private array $arrayStore = [];
20
+
21
+    /**
22
+     * @var boolean
23
+     */
24
+    private bool $success = false;
25
+
26
+    /**
27
+     * @var string
28
+     */
29
+    private string $message = '';
30
+
31
+    /**
32
+     * @var ?CacheLogger
33
+     */
34
+    private ?CacheLogger $logger = null;
35
+
36
+    /**
37
+     * @var array<string, array<string,bool>>
38
+     */
39
+    private array $tags = [];
40
+
41
+    /**
42
+     * ArrayCacheStore constructor.
43
+     * 
44
+     * @param string $logPath
45
+     */
46
+    public function __construct(string $logPath)
47
+    {
48 48
     $this->logger = new CacheLogger($logPath);
49
-  }
50
-
51
-  /**
52
-   * Appends data to an existing cache item.
53
-   * 
54
-   * @param string $cacheKey
55
-   * @param mixed  $cacheData
56
-   * @param string $namespace
57
-   * @return bool
58
-   */
59
-  public function appendCache(string $cacheKey, mixed $cacheData, string $namespace = ''): bool
60
-  {
61
-      $arrayStoreKey = $this->buildArrayKey($cacheKey, $namespace);
62
-
63
-      if (!$this->has($cacheKey, $namespace)) {
64
-          $this->setMessage("cacheData can't be appended, because doesn't exist or expired", false);
65
-          $this->logger->debug("{$this->getMessage()} from array driver.");
66
-          return false;
67
-      }
68
-
69
-      $this->arrayStore[$arrayStoreKey]['cacheData'] = serialize($cacheData);
70
-      $this->setMessage("Cache appended successfully", true);
71
-      return true;
72
-  }
73
-
74
-  /**
75
-   * Builds a unique key for the array store.
76
-   * 
77
-   * @param string $cacheKey
78
-   * @param string $namespace
79
-   * @return string
80
-   */
81
-  private function buildArrayKey(string $cacheKey, string $namespace = ''): string
82
-  {
49
+    }
50
+
51
+    /**
52
+     * Appends data to an existing cache item.
53
+     * 
54
+     * @param string $cacheKey
55
+     * @param mixed  $cacheData
56
+     * @param string $namespace
57
+     * @return bool
58
+     */
59
+    public function appendCache(string $cacheKey, mixed $cacheData, string $namespace = ''): bool
60
+    {
61
+        $arrayStoreKey = $this->buildArrayKey($cacheKey, $namespace);
62
+
63
+        if (!$this->has($cacheKey, $namespace)) {
64
+            $this->setMessage("cacheData can't be appended, because doesn't exist or expired", false);
65
+            $this->logger->debug("{$this->getMessage()} from array driver.");
66
+            return false;
67
+        }
68
+
69
+        $this->arrayStore[$arrayStoreKey]['cacheData'] = serialize($cacheData);
70
+        $this->setMessage("Cache appended successfully", true);
71
+        return true;
72
+    }
73
+
74
+    /**
75
+     * Builds a unique key for the array store.
76
+     * 
77
+     * @param string $cacheKey
78
+     * @param string $namespace
79
+     * @return string
80
+     */
81
+    private function buildArrayKey(string $cacheKey, string $namespace = ''): string
82
+    {
83 83
     return !empty($namespace) ? ($namespace . ':' . $cacheKey) : $cacheKey;
84
-  }
85
-
86
-  /**
87
-   * Clears a specific cache item.
88
-   * 
89
-   * @param string $cacheKey
90
-   * @param string $namespace
91
-   * @return void
92
-   */
93
-  public function clearCache(string $cacheKey, string $namespace = ''): void
94
-  {
84
+    }
85
+
86
+    /**
87
+     * Clears a specific cache item.
88
+     * 
89
+     * @param string $cacheKey
90
+     * @param string $namespace
91
+     * @return void
92
+     */
93
+    public function clearCache(string $cacheKey, string $namespace = ''): void
94
+    {
95 95
     $arrayStoreKey = $this->buildArrayKey($cacheKey, $namespace);
96 96
     unset($this->arrayStore[$arrayStoreKey]);
97 97
     $this->setMessage("Cache cleared successfully", true);
98 98
     $this->logger->debug("{$this->getMessage()} from array driver.");
99
-  }
100
-
101
-  /**
102
-   * Decrements a cache item by a specified amount.
103
-   * 
104
-   * @param string $cacheKey
105
-   * @param int $amount
106
-   * @param string $namespace
107
-   * @return bool
108
-   */
109
-  public function decrement(string $cacheKey, int $amount = 1, string $namespace = ''): bool
110
-  {
99
+    }
100
+
101
+    /**
102
+     * Decrements a cache item by a specified amount.
103
+     * 
104
+     * @param string $cacheKey
105
+     * @param int $amount
106
+     * @param string $namespace
107
+     * @return bool
108
+     */
109
+    public function decrement(string $cacheKey, int $amount = 1, string $namespace = ''): bool
110
+    {
111 111
     return $this->increment($cacheKey, ($amount * -1), $namespace);
112
-  }
113
-
114
-  /**
115
-   * Flushes all cache items.
116
-   * 
117
-   * @return void
118
-   */
119
-  public function flushCache(): void
120
-  {
112
+    }
113
+
114
+    /**
115
+     * Flushes all cache items.
116
+     * 
117
+     * @return void
118
+     */
119
+    public function flushCache(): void
120
+    {
121 121
     unset($this->arrayStore);
122 122
     $this->arrayStore = [];
123 123
     $this->tags = [];
124 124
     $this->setMessage("Cache flushed successfully", true);
125 125
     $this->logger->debug("{$this->getMessage()} from array driver.");
126
-  }
126
+    }
127 127
 
128 128
     /**
129 129
      * Stores a cache item permanently.
@@ -132,234 +132,234 @@  discard block
 block discarded – undo
132 132
      * @param mixed $cacheData
133 133
      * @return void
134 134
      */
135
-  public function forever(string $cacheKey, mixed $cacheData): void
136
-  {
135
+    public function forever(string $cacheKey, mixed $cacheData): void
136
+    {
137 137
     $this->putCache($cacheKey, $cacheData, ttl: 31536000 * 1000);
138 138
     $this->setMessage($this->getMessage(), $this->isSuccess());
139
-  }
140
-
141
-  /**
142
-   * Retrieves a single cache item.
143
-   * 
144
-   * @param string $cacheKey
145
-   * @param string $namespace
146
-   * @param int|string $ttl
147
-   * @return mixed
148
-   */
149
-  public function getCache(string $cacheKey, string $namespace = '', string|int $ttl = 3600): mixed
150
-  {
139
+    }
140
+
141
+    /**
142
+     * Retrieves a single cache item.
143
+     * 
144
+     * @param string $cacheKey
145
+     * @param string $namespace
146
+     * @param int|string $ttl
147
+     * @return mixed
148
+     */
149
+    public function getCache(string $cacheKey, string $namespace = '', string|int $ttl = 3600): mixed
150
+    {
151 151
     $arrayStoreKey = $this->buildArrayKey($cacheKey, $namespace);
152 152
 
153 153
     if (!$this->has($cacheKey, $namespace)) {
154
-      $this->handleCacheNotFound();
155
-      return false;
154
+        $this->handleCacheNotFound();
155
+        return false;
156 156
     }
157 157
 
158 158
     $cacheData = $this->arrayStore[$arrayStoreKey];
159 159
     if ($this->isExpired($cacheData)) {
160
-      $this->handleCacheExpired($arrayStoreKey);
161
-      return false;
160
+        $this->handleCacheExpired($arrayStoreKey);
161
+        return false;
162 162
     }
163 163
 
164 164
     $this->setMessage("Cache retrieved successfully", true);
165 165
     $this->logger->debug("{$this->getMessage()} from array driver.");
166 166
     return $this->serialize($cacheData['cacheData'], false);
167
-  }
168
-
169
-  /**
170
-   * Verify if the cache is expired.
171
-   * 
172
-   * @param array $cacheData
173
-   * @return bool
174
-   */
175
-  private function isExpired(array $cacheData): bool
176
-  {
167
+    }
168
+
169
+    /**
170
+     * Verify if the cache is expired.
171
+     * 
172
+     * @param array $cacheData
173
+     * @return bool
174
+     */
175
+    private function isExpired(array $cacheData): bool
176
+    {
177 177
     $expirationTime = $cacheData['expirationTime'] ?? 0;
178 178
     $now = time();
179 179
     return $expirationTime !== 0 && $now >= $expirationTime;
180
-  }
181
-
182
-  /**
183
-   * Handles the case when cache data is not found.
184
-   * 
185
-   * @return void
186
-   */
187
-  private function handleCacheNotFound(): void
188
-  {
180
+    }
181
+
182
+    /**
183
+     * Handles the case when cache data is not found.
184
+     * 
185
+     * @return void
186
+     */
187
+    private function handleCacheNotFound(): void
188
+    {
189 189
     $this->setMessage("cacheData not found, does not exists or expired", false);
190 190
     $this->logger->debug("{$this->getMessage()} from array driver.");
191
-  }
192
-
193
-  /**
194
-   * Handles the case when cache data has expired.
195
-   * 
196
-   * @param string $arrayStoreKey
197
-   * @return void
198
-   */
199
-  private function handleCacheExpired(string $arrayStoreKey): void
200
-  {
191
+    }
192
+
193
+    /**
194
+     * Handles the case when cache data has expired.
195
+     * 
196
+     * @param string $arrayStoreKey
197
+     * @return void
198
+     */
199
+    private function handleCacheExpired(string $arrayStoreKey): void
200
+    {
201 201
     $parts = explode(':', $arrayStoreKey, 2);
202 202
     if (count($parts) === 2) {
203
-      list($np, $key) = $parts;
203
+        list($np, $key) = $parts;
204 204
     } else {
205
-      $np = '';
206
-      $key = $arrayStoreKey;
205
+        $np = '';
206
+        $key = $arrayStoreKey;
207 207
     }
208 208
     $this->clearCache($key, $np);
209 209
     $this->setMessage("cacheKey: {$key} has expired.", false);
210 210
     $this->logger->debug("{$this->getMessage()} from array driver.");
211
-  }
212
-
213
-  /**
214
-   * Gets all items in a specific namespace.
215
-   * 
216
-   * @param string $namespace
217
-   * @return array
218
-   */
219
-  public function getAll(string $namespace = ''): array
220
-  {
211
+    }
212
+
213
+    /**
214
+     * Gets all items in a specific namespace.
215
+     * 
216
+     * @param string $namespace
217
+     * @return array
218
+     */
219
+    public function getAll(string $namespace = ''): array
220
+    {
221 221
     $results = [];
222 222
     foreach ($this->arrayStore as $key => $data) {
223
-      if (str_starts_with($key, $namespace . ':') || empty($namespace)) {
223
+        if (str_starts_with($key, $namespace . ':') || empty($namespace)) {
224 224
         $results[$key] = $this->serialize($data['cacheData'], false);
225
-      }
225
+        }
226 226
     }
227 227
     return $results;
228
-  }
229
-
230
-  /**
231
-   * Retrieves multiple cache items by their keys.
232
-   * 
233
-   * @param array $cacheKeys
234
-   * @param string $namespace
235
-   * @param string|int $ttl
236
-   * @return array
237
-   */
238
-  public function getMany(array $cacheKeys, string $namespace = '', string|int $ttl = 3600): array
239
-  {
228
+    }
229
+
230
+    /**
231
+     * Retrieves multiple cache items by their keys.
232
+     * 
233
+     * @param array $cacheKeys
234
+     * @param string $namespace
235
+     * @param string|int $ttl
236
+     * @return array
237
+     */
238
+    public function getMany(array $cacheKeys, string $namespace = '', string|int $ttl = 3600): array
239
+    {
240 240
     $results = [];
241 241
     foreach ($cacheKeys as $cacheKey) {
242
-      $results[$cacheKey] = $this->getCache($cacheKey, $namespace, $ttl);
242
+        $results[$cacheKey] = $this->getCache($cacheKey, $namespace, $ttl);
243 243
     }
244 244
     return $results;
245
-  }
246
-
247
-  /**
248
-   * Checks if a cache item exists.
249
-   * 
250
-   * @param string $cacheKey
251
-   * @param string $namespace
252
-   * @return bool
253
-   */
254
-  public function has(string $cacheKey, string $namespace = ''): bool
255
-  {
245
+    }
246
+
247
+    /**
248
+     * Checks if a cache item exists.
249
+     * 
250
+     * @param string $cacheKey
251
+     * @param string $namespace
252
+     * @return bool
253
+     */
254
+    public function has(string $cacheKey, string $namespace = ''): bool
255
+    {
256 256
     $arrayStoreKey = $this->buildArrayKey($cacheKey, $namespace);
257 257
     $exists = isset($this->arrayStore[$arrayStoreKey]) && time() < $this->arrayStore[$arrayStoreKey]['expirationTime'];
258 258
 
259 259
     $this->setMessage(
260
-      $exists ? "Cache key: {$cacheKey} exists and it's available!" : "Cache key: {$cacheKey} does not exist or it's expired!",
261
-      $exists
260
+        $exists ? "Cache key: {$cacheKey} exists and it's available!" : "Cache key: {$cacheKey} does not exist or it's expired!",
261
+        $exists
262 262
     );
263 263
     $this->logger->debug("{$this->getMessage()} from array driver.");
264 264
 
265 265
     return $exists;
266
-  }
267
-
268
-  /**
269
-   * Increments a cache item by a specified amount.
270
-   * 
271
-   * @param string $cacheKey
272
-   * @param int $amount
273
-   * @param string $namespace
274
-   * @return bool
275
-   */
276
-  public function increment(string $cacheKey, int $amount = 1, string $namespace = ''): bool
277
-  {
266
+    }
267
+
268
+    /**
269
+     * Increments a cache item by a specified amount.
270
+     * 
271
+     * @param string $cacheKey
272
+     * @param int $amount
273
+     * @param string $namespace
274
+     * @return bool
275
+     */
276
+    public function increment(string $cacheKey, int $amount = 1, string $namespace = ''): bool
277
+    {
278 278
     $cacheData = $this->getCache($cacheKey, $namespace);
279 279
 
280 280
     if(!empty($cacheData) && is_numeric($cacheData)) {
281
-      $this->putCache($cacheKey, (int)($cacheData + $amount), $namespace);
282
-      $this->setMessage($this->getMessage(), $this->isSuccess());
283
-      return true;
281
+        $this->putCache($cacheKey, (int)($cacheData + $amount), $namespace);
282
+        $this->setMessage($this->getMessage(), $this->isSuccess());
283
+        return true;
284 284
     }
285 285
 
286 286
     return false;
287
-  }
288
-
289
-  /**
290
-   * Checks if the operation was successful.
291
-   * 
292
-   * @return boolean
293
-   */
294
-  public function isSuccess(): bool
295
-  {
287
+    }
288
+
289
+    /**
290
+     * Checks if the operation was successful.
291
+     * 
292
+     * @return boolean
293
+     */
294
+    public function isSuccess(): bool
295
+    {
296 296
     return $this->success;
297
-  }
298
-
299
-  /**
300
-   * Gets the last message.
301
-   * 
302
-   * @return string
303
-   */
304
-  public function getMessage(): string
305
-  {
297
+    }
298
+
299
+    /**
300
+     * Gets the last message.
301
+     * 
302
+     * @return string
303
+     */
304
+    public function getMessage(): string
305
+    {
306 306
     return $this->message;
307
-  }
308
-
309
-  /**
310
-   * Stores an item in the cache with a specific TTL.
311
-   * 
312
-   * @param string $cacheKey
313
-   * @param mixed $cacheData
314
-   * @param string $namespace
315
-   * @param int|string $ttl
316
-   * @return bool
317
-   */
318
-  public function putCache(string $cacheKey, mixed $cacheData, string $namespace = '', int|string $ttl = 3600): bool
319
-  {
307
+    }
308
+
309
+    /**
310
+     * Stores an item in the cache with a specific TTL.
311
+     * 
312
+     * @param string $cacheKey
313
+     * @param mixed $cacheData
314
+     * @param string $namespace
315
+     * @param int|string $ttl
316
+     * @return bool
317
+     */
318
+    public function putCache(string $cacheKey, mixed $cacheData, string $namespace = '', int|string $ttl = 3600): bool
319
+    {
320 320
     $arrayStoreKey = $this->buildArrayKey($cacheKey, $namespace);
321 321
 
322 322
     $this->arrayStore[$arrayStoreKey] = [
323
-      'cacheData' => serialize($cacheData),
324
-      'expirationTime' => time() + $ttl
323
+        'cacheData' => serialize($cacheData),
324
+        'expirationTime' => time() + $ttl
325 325
     ];
326 326
 
327 327
     $this->setMessage("Cache stored successfully", true);
328 328
     $this->logger->debug("{$this->getMessage()} from Array driver.");
329 329
     return true;
330
-  }
331
-
332
-  /**
333
-   * Stores multiple items in the cache in batches.
334
-   * 
335
-   * @param array $items
336
-   * @param string $namespace
337
-   * @param int $batchSize
338
-   * @return void
339
-   */
340
-  public function putMany(array $items, string $namespace = '', int $batchSize = 100): void
341
-  {
330
+    }
331
+
332
+    /**
333
+     * Stores multiple items in the cache in batches.
334
+     * 
335
+     * @param array $items
336
+     * @param string $namespace
337
+     * @param int $batchSize
338
+     * @return void
339
+     */
340
+    public function putMany(array $items, string $namespace = '', int $batchSize = 100): void
341
+    {
342 342
     $chunks = array_chunk($items, $batchSize, true);
343 343
 
344 344
     foreach ($chunks as $chunk) {
345
-      foreach ($chunk as $key => $data) {
346
-          $this->putCache($data['cacheKey'], $data['cacheData'], $namespace);
345
+        foreach ($chunk as $key => $data) {
346
+            $this->putCache($data['cacheKey'], $data['cacheData'], $namespace);
347
+        }
347 348
         }
348
-      }
349 349
     $this->setMessage("{$this->getMessage()}", $this->isSuccess());
350 350
     $this->logger->debug("{$this->getMessage()} from Array driver.");
351
-  }
352
-
353
-  /**
354
-   * Renews the expiration time of a cache item.
355
-   * 
356
-   * @param string $cacheKey
357
-   * @param string|int $ttl
358
-   * @param string $namespace
359
-   * @return void
360
-   */
361
-  public function renewCache(string $cacheKey, int|string $ttl = 3600, string $namespace = ''): void
362
-  {
351
+    }
352
+
353
+    /**
354
+     * Renews the expiration time of a cache item.
355
+     * 
356
+     * @param string $cacheKey
357
+     * @param string|int $ttl
358
+     * @param string $namespace
359
+     * @return void
360
+     */
361
+    public function renewCache(string $cacheKey, int|string $ttl = 3600, string $namespace = ''): void
362
+    {
363 363
     $arrayStoreKey = $this->buildArrayKey($cacheKey, $namespace);
364 364
 
365 365
     if (isset($this->arrayStore[$arrayStoreKey])) {
@@ -367,78 +367,78 @@  discard block
 block discarded – undo
367 367
         $this->arrayStore[$arrayStoreKey]['expirationTime'] = time() + $ttlSeconds;
368 368
         $this->setMessage("cacheKey: {$cacheKey} renewed successfully", true);
369 369
         $this->logger->debug("{$this->getMessage()} from array driver.");
370
-      }
371
-  }
372
-
373
-  /**
374
-   * Sets a message and its success status.
375
-   * 
376
-   * @param string  $message
377
-   * @param boolean $success
378
-   * @return void
379
-   */
380
-  private function setMessage(string $message, bool $success): void
381
-  {
370
+        }
371
+    }
372
+
373
+    /**
374
+     * Sets a message and its success status.
375
+     * 
376
+     * @param string  $message
377
+     * @param boolean $success
378
+     * @return void
379
+     */
380
+    private function setMessage(string $message, bool $success): void
381
+    {
382 382
     $this->message = $message;
383 383
     $this->success = $success;
384
-  }
385
-
386
-  /**
387
-   * Serializes or unserializes data based on the flag.
388
-   * 
389
-   * @param mixed $data
390
-   * @param bool $serialize
391
-   * @return mixed
392
-   */
393
-  private function serialize(mixed $data, bool $serialize = true): mixed
394
-  {
384
+    }
385
+
386
+    /**
387
+     * Serializes or unserializes data based on the flag.
388
+     * 
389
+     * @param mixed $data
390
+     * @param bool $serialize
391
+     * @return mixed
392
+     */
393
+    private function serialize(mixed $data, bool $serialize = true): mixed
394
+    {
395 395
     return $serialize ? serialize($data) : unserialize($data);
396
-  }
397
-
398
-  /**
399
-   * Associates one or more keys to a tag.
400
-   *
401
-   * @param string $tag
402
-   * @param string ...$keys
403
-   * @return bool
404
-   */
405
-  public function tag(string $tag, string ...$keys): bool
406
-  {
396
+    }
397
+
398
+    /**
399
+     * Associates one or more keys to a tag.
400
+     *
401
+     * @param string $tag
402
+     * @param string ...$keys
403
+     * @return bool
404
+     */
405
+    public function tag(string $tag, string ...$keys): bool
406
+    {
407 407
     if (!isset($this->tags[$tag])) {
408
-      $this->tags[$tag] = [];
408
+        $this->tags[$tag] = [];
409 409
     }
410 410
     foreach ($keys as $key) {
411
-      // Accept either raw key or "namespace:key"
412
-      $arrayStoreKey = (str_contains($key, ':')) ? $key : $this->buildArrayKey($key, '');
413
-      $this->tags[$tag][$arrayStoreKey] = true;
411
+        // Accept either raw key or "namespace:key"
412
+        $arrayStoreKey = (str_contains($key, ':')) ? $key : $this->buildArrayKey($key, '');
413
+        $this->tags[$tag][$arrayStoreKey] = true;
414 414
     }
415 415
     $this->setMessage("Tagged successfully", true);
416 416
     $this->logger?->debug("{$this->getMessage()} from array driver.");
417 417
     return true;
418
-  }
419
-
420
-  /**
421
-   * Flushes all keys associated with a tag.
422
-   *
423
-   * @param string $tag
424
-   * @return void
425
-   */
426
-  public function flushTag(string $tag): void
427
-  {
418
+    }
419
+
420
+    /**
421
+     * Flushes all keys associated with a tag.
422
+     *
423
+     * @param string $tag
424
+     * @return void
425
+     */
426
+    public function flushTag(string $tag): void
427
+    {
428 428
     $keys = array_keys($this->tags[$tag] ?? []);
429 429
     foreach ($keys as $arrayStoreKey) {
430
-      // Recover original key/namespace combination
431
-      $parts = explode(':', $arrayStoreKey, 2);
432
-      if (count($parts) === 2) {
430
+        // Recover original key/namespace combination
431
+        $parts = explode(':', $arrayStoreKey, 2);
432
+        if (count($parts) === 2) {
433 433
         [$np, $key] = $parts;
434
-      } else {
434
+        } else {
435 435
         $np = '';
436 436
         $key = $arrayStoreKey;
437
-      }
438
-      $this->clearCache($key, $np);
437
+        }
438
+        $this->clearCache($key, $np);
439 439
     }
440 440
     unset($this->tags[$tag]);
441 441
     $this->setMessage("Tag flushed successfully", true);
442 442
     $this->logger?->debug("{$this->getMessage()} from array driver.");
443
-  }
443
+    }
444 444
 }
Please login to merge, or discard this patch.
src/CacheStore/CacheManager/FileCacheManager.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -53,18 +53,18 @@  discard block
 block discarded – undo
53 53
     }
54 54
 
55 55
     /**
56
-    * @param string $filename
57
-    * @return bool
58
-    */
56
+     * @param string $filename
57
+     * @return bool
58
+     */
59 59
     public function fileExists(string $filename): bool
60 60
     {
61 61
         return file_exists($filename);
62 62
     }
63 63
 
64 64
     /**
65
-    * @param string $filename
66
-    * @return void
67
-    */
65
+     * @param string $filename
66
+     * @return void
67
+     */
68 68
     public function removeFile(string $filename): void
69 69
     {
70 70
         if (file_exists($filename)) {
@@ -73,9 +73,9 @@  discard block
 block discarded – undo
73 73
     }
74 74
 
75 75
     /**
76
-    * @param string $dir
77
-    * @return void
78
-    */
76
+     * @param string $dir
77
+     * @return void
78
+     */
79 79
     public function clearDirectory(string $dir): void
80 80
     {
81 81
         $iterator = new RecursiveIteratorIterator(
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
      * @return string|bool
45 45
      * @throws CacheFileException
46 46
      */
47
-    public function readFile(string $filename): string|bool
47
+    public function readFile(string $filename): string | bool
48 48
     {
49 49
         if (!$this->fileExists($filename)) {
50 50
             throw CacheFileException::create("File not found: {$filename}");
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
      */
96 96
     public function serialize(mixed $data, bool $serialize = true): mixed
97 97
     {
98
-        if($serialize) {
98
+        if ($serialize) {
99 99
             return serialize($data);
100 100
         }
101 101
         return unserialize($data);
Please login to merge, or discard this patch.
src/CacheStore/CacheManager/RedisCacheManager.php 2 patches
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -14,42 +14,42 @@
 block discarded – undo
14 14
 class RedisCacheManager
15 15
 {
16 16
 
17
-  /** @var Predis\Client */
18
-  private static $redis;
19
-
20
-  /** @param string $namespace */
21
-  private static $namespace;
22
-
23
-  /**
24
-   * Connects to the Redis server using the configuration defined in REDIS_CONNECTION_CONFIG.
25
-   * 
26
-  * @return Client
27
-  */
28
-  public static function connect()
29
-  {
17
+    /** @var Predis\Client */
18
+    private static $redis;
19
+
20
+    /** @param string $namespace */
21
+    private static $namespace;
22
+
23
+    /**
24
+     * Connects to the Redis server using the configuration defined in REDIS_CONNECTION_CONFIG.
25
+     * 
26
+     * @return Client
27
+     */
28
+    public static function connect()
29
+    {
30 30
     Autoloader::register();
31 31
     self::$redis = new Client([
32
-      'scheme' => 'tcp',
33
-      'host' => REDIS_CONNECTION_CONFIG['REDIS_HOST'],
34
-      'port' => REDIS_CONNECTION_CONFIG['REDIS_PORT'],
35
-      'password' => REDIS_CONNECTION_CONFIG['REDIS_PASSWORD'],
36
-      'database' => 0
32
+        'scheme' => 'tcp',
33
+        'host' => REDIS_CONNECTION_CONFIG['REDIS_HOST'],
34
+        'port' => REDIS_CONNECTION_CONFIG['REDIS_PORT'],
35
+        'password' => REDIS_CONNECTION_CONFIG['REDIS_PASSWORD'],
36
+        'database' => 0
37 37
     ]);
38 38
     self::auth();
39 39
     self::$namespace = REDIS_CONNECTION_CONFIG['REDIS_NAMESPACE'] ?? 'Cache';
40 40
     return self::$redis;
41
-  }
42
-
43
-  /**
44
-  * Authenticates the Redis connection if a password is provided in the configuration.
45
-  *
46
-  * @return void
47
-  */
48
-  private static function auth(): void
49
-  {
41
+    }
42
+
43
+    /**
44
+     * Authenticates the Redis connection if a password is provided in the configuration.
45
+     *
46
+     * @return void
47
+     */
48
+    private static function auth(): void
49
+    {
50 50
     if(is_string(REDIS_CONNECTION_CONFIG['REDIS_PASSWORD']) && REDIS_CONNECTION_CONFIG['REDIS_PASSWORD'] !== '') {
51
-      self::$redis->auth(REDIS_CONNECTION_CONFIG['REDIS_PASSWORD']);
51
+        self::$redis->auth(REDIS_CONNECTION_CONFIG['REDIS_PASSWORD']);
52
+    }
52 53
     }
53
-  }
54 54
 
55 55
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
   */
48 48
   private static function auth(): void
49 49
   {
50
-    if(is_string(REDIS_CONNECTION_CONFIG['REDIS_PASSWORD']) && REDIS_CONNECTION_CONFIG['REDIS_PASSWORD'] !== '') {
50
+    if (is_string(REDIS_CONNECTION_CONFIG['REDIS_PASSWORD']) && REDIS_CONNECTION_CONFIG['REDIS_PASSWORD'] !== '') {
51 51
       self::$redis->auth(REDIS_CONNECTION_CONFIG['REDIS_PASSWORD']);
52 52
     }
53 53
   }
Please login to merge, or discard this patch.
src/Repositories/CacheDatabaseRepository.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      * @param string|int $ttl
38 38
      * @return bool
39 39
      */
40
-    public function store(string $cacheKey, mixed $cacheData, string $namespace, string|int $ttl = 3600): bool
40
+    public function store(string $cacheKey, mixed $cacheData, string $namespace, string | int $ttl = 3600): bool
41 41
     {
42 42
         if (!empty($this->retrieve($cacheKey, $namespace))) {
43 43
             return $this->update($cacheKey, $cacheData, $namespace);
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
     * @param string $namespace
223 223
     * @return bool
224 224
     */
225
-    public function renew(string $cacheKey, string|int $ttl, string $namespace = ''): bool
225
+    public function renew(string $cacheKey, string | int $ttl, string $namespace = ''): bool
226 226
     {
227 227
         $currentTime = date('Y-m-d H:i:s');
228 228
         if (!$this->hasValidCache($cacheKey, $namespace, $currentTime)) {
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 
232 232
         $query = $this->getRenewExpirationQueryWithDriver();
233 233
         $stmt = $this->connection->prepare($query);
234
-        $stmt->bindValue(':ttl', (int) $ttl, PDO::PARAM_INT);
234
+        $stmt->bindValue(':ttl', (int)$ttl, PDO::PARAM_INT);
235 235
         $stmt->bindValue(':cacheKey', $cacheKey);
236 236
         $stmt->bindValue(':namespace', $namespace);
237 237
         $stmt->bindValue(':currentTime', $currentTime);
Please login to merge, or discard this patch.
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
     }
65 65
 
66 66
     /**
67
-    * Retrieves cache data from the database.
68
-    * 
69
-    * @param string $cacheKey
70
-    * @param string $namespace
71
-    * @return mixed
67
+     * Retrieves cache data from the database.
68
+     * 
69
+     * @param string $cacheKey
70
+     * @param string $namespace
71
+     * @return mixed
72 72
      */
73 73
     public function retrieve(string $cacheKey, string $namespace = ''): mixed
74 74
     {
@@ -113,10 +113,10 @@  discard block
 block discarded – undo
113 113
     }
114 114
 
115 115
     /**
116
-    * Get Update query based on the database driver.
117
-    *
118
-    * @return string
119
-    */
116
+     * Get Update query based on the database driver.
117
+     *
118
+     * @return string
119
+     */
120 120
     private function getUpdateQueryWithDriver(): string
121 121
     {
122 122
         $driver = $this->connection->getAttribute(PDO::ATTR_DRIVER_NAME);
@@ -127,10 +127,10 @@  discard block
 block discarded – undo
127 127
     }
128 128
 
129 129
     /**
130
-    * Get Delete query based on the database driver.
131
-    * 
132
-    * @return string
133
-    */
130
+     * Get Delete query based on the database driver.
131
+     * 
132
+     * @return string
133
+     */
134 134
     private function getDeleteQueryWithDriver(): string
135 135
     {
136 136
         $driver = $this->connection->getAttribute(PDO::ATTR_DRIVER_NAME);
@@ -141,13 +141,13 @@  discard block
 block discarded – undo
141 141
     }
142 142
 
143 143
     /**
144
-    * Updates an existing cache item in the database.
145
-    * 
146
-    * @param string $cacheKey
147
-    * @param mixed  $cacheData
148
-    * @param string $namespace
149
-    * @return bool
150
-    */
144
+     * Updates an existing cache item in the database.
145
+     * 
146
+     * @param string $cacheKey
147
+     * @param mixed  $cacheData
148
+     * @param string $namespace
149
+     * @return bool
150
+     */
151 151
     public function update(string $cacheKey, mixed $cacheData, string $namespace = ''): bool
152 152
     {
153 153
         $query = $this->getUpdateQueryWithDriver();
@@ -161,12 +161,12 @@  discard block
 block discarded – undo
161 161
     }
162 162
 
163 163
     /**
164
-    * Clears a specific cache item from the database.
165
-    * 
166
-    * @param string $cacheKey
167
-    * @param string $namespace
168
-    * @return bool
169
-    */
164
+     * Clears a specific cache item from the database.
165
+     * 
166
+     * @param string $cacheKey
167
+     * @param string $namespace
168
+     * @return bool
169
+     */
170 170
     public function clear(string $cacheKey, string $namespace = ''): bool
171 171
     {
172 172
         $query = $this->getDeleteQueryWithDriver();
@@ -179,10 +179,10 @@  discard block
 block discarded – undo
179 179
     }
180 180
 
181 181
     /**
182
-    * Gets the query to renew the expiration time of a cache item based on the database driver.
183
-    *  
184
-    * @return string
185
-    */
182
+     * Gets the query to renew the expiration time of a cache item based on the database driver.
183
+     *  
184
+     * @return string
185
+     */
186 186
     private function getRenewExpirationQueryWithDriver(): string
187 187
     {
188 188
         $driver = $this->connection->getAttribute(PDO::ATTR_DRIVER_NAME);
@@ -197,13 +197,13 @@  discard block
 block discarded – undo
197 197
     }
198 198
 
199 199
     /**
200
-    * Checks if a cache item is valid based on its key, namespace, and current time.
201
-    * 
202
-    * @param string $cacheKey
203
-    * @param string $namespace
204
-    * @param string $currentTime
205
-    * @return bool
206
-    */
200
+     * Checks if a cache item is valid based on its key, namespace, and current time.
201
+     * 
202
+     * @param string $cacheKey
203
+     * @param string $namespace
204
+     * @param string $currentTime
205
+     * @return bool
206
+     */
207 207
     private function hasValidCache(string $cacheKey, string $namespace, string $currentTime): bool
208 208
     {
209 209
         $stmt = $this->connection->prepare(
@@ -219,13 +219,13 @@  discard block
 block discarded – undo
219 219
     }
220 220
 
221 221
     /**
222
-    * Renews the expiration time of a cache item.
223
-    * 
224
-    * @param string $cacheKey
225
-    * @param string|int $ttl
226
-    * @param string $namespace
227
-    * @return bool
228
-    */
222
+     * Renews the expiration time of a cache item.
223
+     * 
224
+     * @param string $cacheKey
225
+     * @param string|int $ttl
226
+     * @param string $namespace
227
+     * @return bool
228
+     */
229 229
     public function renew(string $cacheKey, string|int $ttl, string $namespace = ''): bool
230 230
     {
231 231
         $currentTime = date('Y-m-d H:i:s');
@@ -245,10 +245,10 @@  discard block
 block discarded – undo
245 245
     }
246 246
 
247 247
     /**
248
-    * Flushes all cache items from the database.
249
-    * 
250
-    * @return bool
251
-    */
248
+     * Flushes all cache items from the database.
249
+     * 
250
+     * @return bool
251
+     */
252 252
     public function flush(): bool
253 253
     {
254 254
         return $this->connection->exec("DELETE FROM {$this->table}") !== false;
@@ -267,11 +267,11 @@  discard block
 block discarded – undo
267 267
     }
268 268
 
269 269
     /**
270
-    * Gets the current date and time based on the database driver.
271
-    * 
272
-    * @param string $driver
273
-    * @return string
274
-    */
270
+     * Gets the current date and time based on the database driver.
271
+     * 
272
+     * @param string $driver
273
+     * @return string
274
+     */
275 275
     private function getCurrentDateTime(string $driver): string
276 276
     {
277 277
         return ($driver === 'sqlite') ? "DATETIME('now', 'localtime')" : "NOW()";
Please login to merge, or discard this patch.