Passed
Push — main ( ff2d21...910276 )
by Sílvio
02:40
created
src/Helpers/CacheRedisHelper.php 1 patch
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -12,20 +12,20 @@  discard block
 block discarded – undo
12 12
 class CacheRedisHelper
13 13
 {
14 14
 
15
-  /**
16
-  * @param mixed $data
17
-  * @param bool  $serialize
18
-  * @return mixed
19
-  */
20
-  public static function serialize(mixed $data, bool $serialize = true)
21
-  {
15
+    /**
16
+     * @param mixed $data
17
+     * @param bool  $serialize
18
+     * @return mixed
19
+     */
20
+    public static function serialize(mixed $data, bool $serialize = true)
21
+    {
22 22
     if($serialize) {
23
-      return serialize($data);
23
+        return serialize($data);
24 24
     }
25 25
 
26 26
     return unserialize($data);
27 27
 
28
-  }
28
+    }
29 29
 
30 30
     /**
31 31
      * @param array $item
@@ -54,63 +54,63 @@  discard block
 block discarded – undo
54 54
         return (array)$cacheData;
55 55
     }
56 56
 
57
-  /**
58
-    * @param mixed $currentCacheData
59
-    * @param mixed $cacheData
60
-    * @return array
61
-    */
62
-  public static function arrayIdentifier(mixed $currentCacheData, mixed $cacheData)
63
-  {
64
-      /**
65
-      * Se ambos forem arrays, mescle-os de forma recursiva para preservar subarrays
66
-      */
67
-      if (is_array($currentCacheData) && is_array($cacheData)) {
68
-          return self::mergeRecursive($currentCacheData, $cacheData);
69
-      }
70
-
71
-      /** 
72
-      * Se $currentCacheData não for um array, inicialize-o como um array vazio
73
-      */
74
-      if (!is_array($currentCacheData)) {
75
-          $currentCacheData = [];
76
-      }
77
-
78
-      /**
79
-      * Se $cacheData não for um array, converta-o em um array
80
-      */
81
-      if (!is_array($cacheData)) {
82
-          $cacheData = [$cacheData];
83
-      }
84
-
85
-      return array_merge($currentCacheData, $cacheData);
86
-  }
87
-
88
-  /**
89
-    * Mescla arrays de forma recursiva.
90
-    * @param array $array1
91
-    * @param array $array2
92
-    * @return array
93
-    */
94
-  private static function mergeRecursive(array $array1, array $array2)
95
-  {
96
-      foreach ($array2 as $key => $value) {
97
-
98
-          /**
99
-          * Se a chave existe em ambos os arrays e ambos os valores são arrays, mescle recursivamente
100
-          */
101
-          if (isset($array1[$key]) && is_array($array1[$key]) && is_array($value)) {
102
-              $array1[$key] = self::mergeRecursive($array1[$key], $value);
103
-          } else {
104
-
105
-              /**
106
-              * Caso contrário, sobrescreva o valor em $array1 com o valor de $array2
107
-              */
108
-              $array1[$key] = $value;
109
-          }
110
-      }
111
-
112
-      return $array1;
113
-  }
57
+    /**
58
+     * @param mixed $currentCacheData
59
+     * @param mixed $cacheData
60
+     * @return array
61
+     */
62
+    public static function arrayIdentifier(mixed $currentCacheData, mixed $cacheData)
63
+    {
64
+        /**
65
+         * Se ambos forem arrays, mescle-os de forma recursiva para preservar subarrays
66
+         */
67
+        if (is_array($currentCacheData) && is_array($cacheData)) {
68
+            return self::mergeRecursive($currentCacheData, $cacheData);
69
+        }
70
+
71
+        /** 
72
+         * Se $currentCacheData não for um array, inicialize-o como um array vazio
73
+         */
74
+        if (!is_array($currentCacheData)) {
75
+            $currentCacheData = [];
76
+        }
77
+
78
+        /**
79
+         * Se $cacheData não for um array, converta-o em um array
80
+         */
81
+        if (!is_array($cacheData)) {
82
+            $cacheData = [$cacheData];
83
+        }
84
+
85
+        return array_merge($currentCacheData, $cacheData);
86
+    }
87
+
88
+    /**
89
+     * Mescla arrays de forma recursiva.
90
+     * @param array $array1
91
+     * @param array $array2
92
+     * @return array
93
+     */
94
+    private static function mergeRecursive(array $array1, array $array2)
95
+    {
96
+        foreach ($array2 as $key => $value) {
97
+
98
+            /**
99
+             * Se a chave existe em ambos os arrays e ambos os valores são arrays, mescle recursivamente
100
+             */
101
+            if (isset($array1[$key]) && is_array($array1[$key]) && is_array($value)) {
102
+                $array1[$key] = self::mergeRecursive($array1[$key], $value);
103
+            } else {
104
+
105
+                /**
106
+                 * Caso contrário, sobrescreva o valor em $array1 com o valor de $array2
107
+                 */
108
+                $array1[$key] = $value;
109
+            }
110
+        }
111
+
112
+        return $array1;
113
+    }
114 114
 
115 115
 }
116 116
 
Please login to merge, or discard this patch.
src/Exceptions/CacheRedisException.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -8,34 +8,34 @@
 block discarded – undo
8 8
 {
9 9
 
10 10
 
11
-  /** @param string $before */
12
-  private static string $before = "<Redis Cache Store Exception>";
11
+    /** @param string $before */
12
+    private static string $before = "<Redis Cache Store Exception>";
13 13
 
14 14
 
15
-  /**
16
-  * @return void
17
-  */
18
-  public static function create(string $message = "", int $code = 0, ?Exception $previous = null, array $details = [])
19
-  {
15
+    /**
16
+     * @return void
17
+     */
18
+    public static function create(string $message = "", int $code = 0, ?Exception $previous = null, array $details = [])
19
+    {
20 20
     return new self(self::getBefore() . ": " .$message, $code, $previous, $details);
21
-  }
21
+    }
22 22
 
23 23
 
24
-  /**
25
-  * @return string
26
-  */
27
-  public static function getBefore()
28
-  {
24
+    /**
25
+     * @return string
26
+     */
27
+    public static function getBefore()
28
+    {
29 29
     return self::$before;
30
-  }
30
+    }
31 31
 
32
-  /**
33
-  * @return void
34
-  */
35
-  public static function setBefore(string $text)
36
-  {
32
+    /**
33
+     * @return void
34
+     */
35
+    public static function setBefore(string $text)
36
+    {
37 37
     self::$before = $text;
38
-  }
38
+    }
39 39
 
40 40
 }
41 41
 
Please login to merge, or discard this patch.