Passed
Pull Request — main (#2)
by Sílvio
09:07 queued 06:24
created
src/CacheStore/ArrayCacheStore.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
   * @param int|string $ttl
45 45
   * @return mixed
46 46
   */
47
-  public function getCache(string $cacheKey, string $namespace = '', string|int $ttl = 3600)
47
+  public function getCache(string $cacheKey, string $namespace = '', string | int $ttl = 3600)
48 48
   {
49 49
 
50 50
     $arrayStoreKey = $this->buildArrayKey($cacheKey, $namespace);
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     $expirationTime = $cacheData['expirationTime'] ?? 0;
60 60
     $now = time();
61 61
 
62
-    if($expirationTime !== 0 && $now >= $expirationTime) {
62
+    if ($expirationTime !== 0 && $now >= $expirationTime) {
63 63
       list($np, $key) = explode(':', $arrayStoreKey);
64 64
       $this->clearCache($key, $np);
65 65
       $this->setMessage("cacheKey: {$key} has expired.", false);
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
   * @param int|string $ttl
80 80
   * @return bool
81 81
   */
82
-  public function putCache(string $cacheKey, mixed $cacheData, string $namespace = '', int|string $ttl = 3600)
82
+  public function putCache(string $cacheKey, mixed $cacheData, string $namespace = '', int | string $ttl = 3600)
83 83
   {
84 84
 
85 85
     $arrayStoreKey = $this->buildArrayKey($cacheKey, $namespace);
@@ -159,12 +159,12 @@  discard block
 block discarded – undo
159 159
   * @param string $namespace
160 160
   * @return void
161 161
   */
162
-  public function renewCache(string $cacheKey, int|string $ttl = 3600, string $namespace = '')
162
+  public function renewCache(string $cacheKey, int | string $ttl = 3600, string $namespace = '')
163 163
   {
164 164
     $arrayStoreKey = $this->buildArrayKey($cacheKey, $namespace);
165 165
 
166 166
     if (isset($this->arrayStore[$arrayStoreKey])) {
167
-        $ttlSeconds = is_numeric($ttl) ? (int) $ttl : strtotime($ttl) - time();
167
+        $ttlSeconds = is_numeric($ttl) ? (int)$ttl : strtotime($ttl) - time();
168 168
         $this->arrayStore[$arrayStoreKey]['expirationTime'] = time() + $ttlSeconds;
169 169
         $this->setMessage("cacheKey: {$cacheKey} renewed successfully", true);
170 170
         $this->logger->debug("{$this->getMessage()} from array driver.");
Please login to merge, or discard this patch.
tests/Unit/ArrayCacheStoreTest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -258,13 +258,13 @@  discard block
 block discarded – undo
258 258
     {
259 259
         $this->cache->flushCache();
260 260
 
261
-        $value = $this->cache->remember('remember_test_key', 60, function () {
261
+        $value = $this->cache->remember('remember_test_key', 60, function() {
262 262
             return 'valor_teste';
263 263
         });
264 264
 
265 265
         $this->assertEquals('valor_teste', $value);
266 266
 
267
-        $cachedValue = $this->cache->remember('remember_test_key', 60, function (){
267
+        $cachedValue = $this->cache->remember('remember_test_key', 60, function() {
268 268
             return 'novo_valor';
269 269
         });
270 270
 
@@ -276,12 +276,12 @@  discard block
 block discarded – undo
276 276
     {
277 277
         $this->cache->flushCache();
278 278
 
279
-        $value = $this->cache->rememberForever('remember_forever_key', function () {
279
+        $value = $this->cache->rememberForever('remember_forever_key', function() {
280 280
             return 'valor_eterno';
281 281
         });
282 282
         $this->assertEquals('valor_eterno', $value);
283 283
 
284
-        $cachedValue = $this->cache->rememberForever('remember_forever_key', function () {
284
+        $cachedValue = $this->cache->rememberForever('remember_forever_key', function() {
285 285
             return 'novo_valor';
286 286
         });
287 287
 
Please login to merge, or discard this patch.