Passed
Pull Request — main (#61)
by Sílvio
02:56
created
src/CacheStore/FileCacheStore.php 1 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/ArrayCacheStore.php 1 patch
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.
src/CacheStore/CacheManager/FileCacheManager.php 1 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 1 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 1 patch
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.
src/Service/CacheRetriever.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -39,12 +39,12 @@  discard block
 block discarded – undo
39 39
      * @return mixed
40 40
      * @throws CacheFileException
41 41
      */
42
-    public function getCache(string $cacheKey, string $namespace = '', int|string $ttl = 3600): mixed
42
+    public function getCache(string $cacheKey, string $namespace = '', int | string $ttl = 3600): mixed
43 43
     {
44 44
         $cacheData = $this->cacheer->cacheStore->getCache($cacheKey, $namespace, $ttl);
45 45
         $this->cacheer->syncState();
46 46
 
47
-        if ($this->cacheer->isSuccess() && ($this->cacheer->isCompressionEnabled() ||   $this->cacheer->getEncryptionKey() !== null)) {
47
+        if ($this->cacheer->isSuccess() && ($this->cacheer->isCompressionEnabled() || $this->cacheer->getEncryptionKey() !== null)) {
48 48
             $cacheData = CacheerHelper::recoverFromStorage($cacheData, $this->cacheer->isCompressionEnabled(), $this->cacheer->getEncryptionKey());
49 49
         }
50 50
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      * @return array|CacheDataFormatter
61 61
      * @throws CacheFileException
62 62
      */
63
-    public function getMany(array $cacheKeys, string $namespace = '', int|string $ttl = 3600): array|CacheDataFormatter
63
+    public function getMany(array $cacheKeys, string $namespace = '', int | string $ttl = 3600): array | CacheDataFormatter
64 64
     {
65 65
         $cachedData = $this->cacheer->cacheStore->getMany($cacheKeys, $namespace, $ttl);
66 66
         return $this->getCachedDatum($cachedData);
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      * @return mixed
110 110
      * @throws CacheFileException
111 111
      */
112
-    public function remember(string $cacheKey, int|string $ttl, Closure $callback): mixed
112
+    public function remember(string $cacheKey, int | string $ttl, Closure $callback): mixed
113 113
     {
114 114
         $cachedData = $this->getCache($cacheKey, ttl: $ttl);
115 115
 
Please login to merge, or discard this patch.
src/Utils/CacheDataFormatter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
     *
28 28
     * @return string|false
29 29
     */
30
-    public function toJson(): bool|string
30
+    public function toJson(): bool | string
31 31
     {
32 32
         return json_encode(
33 33
             $this->data,
Please login to merge, or discard this patch.
src/Helpers/CacheFileHelper.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
      * @return float|int
21 21
      * @throws CacheFileException
22 22
      */
23
-    public static function convertExpirationToSeconds(string $expiration): float|int
23
+    public static function convertExpirationToSeconds(string $expiration): float | int
24 24
     {
25 25
         $units = [
26 26
             'second' => 1,
Please login to merge, or discard this patch.
src/Helpers/CacheRedisHelper.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
   */
23 23
   public static function serialize(mixed $data, bool $serialize = true): mixed
24 24
   {
25
-    if($serialize) {
25
+    if ($serialize) {
26 26
       return serialize($data);
27 27
     }
28 28
 
Please login to merge, or discard this patch.