Passed
Pull Request — main (#48)
by Sílvio
03:09
created
src/Utils/CacheDriver.php 1 patch
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -20,8 +20,8 @@  discard block
 block discarded – undo
20 20
 {
21 21
 
22 22
     /**
23
-    * @var Cacheer
24
-    */
23
+     * @var Cacheer
24
+     */
25 25
     protected $cacheer;
26 26
 
27 27
     /** @param string $logPath */
@@ -38,10 +38,10 @@  discard block
 block discarded – undo
38 38
     }
39 39
 
40 40
     /**
41
-    * Uses the database driver for caching.
42
-    * 
43
-    * @return Cacheer
44
-    */
41
+     * Uses the database driver for caching.
42
+     * 
43
+     * @return Cacheer
44
+     */
45 45
     public function useDatabaseDriver()
46 46
     {
47 47
         $this->cacheer->cacheStore = new DatabaseCacheStore($this->logPath);
@@ -49,10 +49,10 @@  discard block
 block discarded – undo
49 49
     }
50 50
 
51 51
     /**
52
-    * Uses the file driver for caching.
53
-    *
54
-    * @return Cacheer
55
-    */
52
+     * Uses the file driver for caching.
53
+     *
54
+     * @return Cacheer
55
+     */
56 56
     public function useFileDriver()
57 57
     {
58 58
         $this->cacheer->options['loggerPath'] = $this->logPath;
@@ -61,10 +61,10 @@  discard block
 block discarded – undo
61 61
     }
62 62
 
63 63
     /**
64
-    * Uses the Redis driver for caching.
65
-    * 
66
-    * @return Cacheer
67
-    */
64
+     * Uses the Redis driver for caching.
65
+     * 
66
+     * @return Cacheer
67
+     */
68 68
     public function useRedisDriver()
69 69
     {
70 70
         $this->cacheer->cacheStore = new RedisCacheStore($this->logPath);
@@ -72,10 +72,10 @@  discard block
 block discarded – undo
72 72
     }
73 73
 
74 74
     /**
75
-    * Uses the array driver for caching.
76
-    * 
77
-    * @return Cacheer
78
-    */
75
+     * Uses the array driver for caching.
76
+     * 
77
+     * @return Cacheer
78
+     */
79 79
     public function useArrayDriver()
80 80
     {
81 81
         $this->cacheer->cacheStore = new ArrayCacheStore($this->logPath);
@@ -83,10 +83,10 @@  discard block
 block discarded – undo
83 83
     }
84 84
 
85 85
     /**
86
-    * Uses the default driver for caching.
87
-    * 
88
-    * @return Cacheer
89
-    */
86
+     * Uses the default driver for caching.
87
+     * 
88
+     * @return Cacheer
89
+     */
90 90
     public function useDefaultDriver()
91 91
     {
92 92
         if (!isset($this->cacheer->options['cacheDir'])) {
@@ -103,16 +103,16 @@  discard block
 block discarded – undo
103 103
     }
104 104
 
105 105
     /**
106
-    * Checks if the directory exists or creates it.
107
-    *
108
-    * @param mixed $dirName
109
-    * @return bool
110
-    */
106
+     * Checks if the directory exists or creates it.
107
+     *
108
+     * @param mixed $dirName
109
+     * @return bool
110
+     */
111 111
     private function isDir(mixed $dirName)
112 112
     {
113
-      if (is_dir($dirName)) {
114
-          return true;
115
-      }
116
-      return mkdir($dirName, 0755, true);
113
+        if (is_dir($dirName)) {
114
+            return true;
115
+        }
116
+        return mkdir($dirName, 0755, true);
117 117
     }
118 118
 }
Please login to merge, or discard this patch.
src/Utils/CacheDataFormatter.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -13,20 +13,20 @@  discard block
 block discarded – undo
13 13
     private mixed $data;
14 14
 
15 15
     /**
16
-    * CacheDataFormatter constructor.
17
-    *
18
-    * @param mixed $data
19
-    */
16
+     * CacheDataFormatter constructor.
17
+     *
18
+     * @param mixed $data
19
+     */
20 20
     public function __construct(mixed $data)
21 21
     {
22 22
         $this->data = $data;
23 23
     }
24 24
 
25 25
     /**
26
-    * Converts the data to JSON format.
27
-    *
28
-    * @return string|false
29
-    */
26
+     * Converts the data to JSON format.
27
+     *
28
+     * @return string|false
29
+     */
30 30
     public function toJson()
31 31
     {
32 32
         return json_encode(
@@ -38,30 +38,30 @@  discard block
 block discarded – undo
38 38
     }
39 39
 
40 40
     /**
41
-    * Converts the data to an array.
42
-    * 
43
-    * @return array
44
-    */
41
+     * Converts the data to an array.
42
+     * 
43
+     * @return array
44
+     */
45 45
     public function toArray()
46 46
     {
47 47
         return (array)$this->data;
48 48
     }
49 49
 
50 50
     /**
51
-    * Converts the data to a string.
52
-    * 
53
-    * @return string
54
-    */
51
+     * Converts the data to a string.
52
+     * 
53
+     * @return string
54
+     */
55 55
     public function toString()
56 56
     {
57 57
         return (string)$this->data;
58 58
     }
59 59
 
60 60
     /**
61
-    * Converts the data to an object.
62
-    * 
63
-    * @return object
64
-    */
61
+     * Converts the data to an object.
62
+     * 
63
+     * @return object
64
+     */
65 65
     public function toObject()
66 66
     {
67 67
         return (object)$this->data;
Please login to merge, or discard this patch.
src/Repositories/CacheDatabaseRepository.php 1 patch
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -60,12 +60,12 @@  discard block
 block discarded – undo
60 60
     }
61 61
 
62 62
     /**
63
-    * Retrieves cache data from the database.
64
-    * 
65
-    * @param string $cacheKey
66
-    * @param string $namespace
67
-    * @return mixed
68
-    */
63
+     * Retrieves cache data from the database.
64
+     * 
65
+     * @param string $cacheKey
66
+     * @param string $namespace
67
+     * @return mixed
68
+     */
69 69
     public function retrieve(string $cacheKey, string $namespace = '')
70 70
     {
71 71
         $driver = $this->connection->getAttribute(PDO::ATTR_DRIVER_NAME);
@@ -85,11 +85,11 @@  discard block
 block discarded – undo
85 85
     }
86 86
 
87 87
     /**
88
-    * Retrieves multiple cache items by their keys. 
89
-    * @param array $cacheKeys
90
-    * @param string $namespace
91
-    * @return array
92
-    */
88
+     * Retrieves multiple cache items by their keys. 
89
+     * @param array $cacheKeys
90
+     * @param string $namespace
91
+     * @return array
92
+     */
93 93
     public function getAll(string $namespace = '')
94 94
     {
95 95
         $driver = $this->connection->getAttribute(PDO::ATTR_DRIVER_NAME);
@@ -110,10 +110,10 @@  discard block
 block discarded – undo
110 110
     }
111 111
 
112 112
     /**
113
-    * Get Update query based on the database driver.
114
-    *
115
-    * @return string
116
-    */
113
+     * Get Update query based on the database driver.
114
+     *
115
+     * @return string
116
+     */
117 117
     private function getUpdateQueryWithDriver()
118 118
     {
119 119
         $driver = $this->connection->getAttribute(PDO::ATTR_DRIVER_NAME);
@@ -124,10 +124,10 @@  discard block
 block discarded – undo
124 124
     }
125 125
 
126 126
     /**
127
-    * Get Delete query based on the database driver.
128
-    * 
129
-    * @return string
130
-    */
127
+     * Get Delete query based on the database driver.
128
+     * 
129
+     * @return string
130
+     */
131 131
     private function getDeleteQueryWithDriver()
132 132
     {
133 133
         $driver = $this->connection->getAttribute(PDO::ATTR_DRIVER_NAME);
@@ -138,13 +138,13 @@  discard block
 block discarded – undo
138 138
     }
139 139
 
140 140
     /**
141
-    * Updates an existing cache item in the database.
142
-    * 
143
-    * @param string $cacheKey
144
-    * @param mixed  $cacheData
145
-    * @param string $namespace
146
-    * @return bool
147
-    */
141
+     * Updates an existing cache item in the database.
142
+     * 
143
+     * @param string $cacheKey
144
+     * @param mixed  $cacheData
145
+     * @param string $namespace
146
+     * @return bool
147
+     */
148 148
     public function update(string $cacheKey, mixed $cacheData, string $namespace = '')
149 149
     {
150 150
         $query = $this->getUpdateQueryWithDriver();
@@ -158,12 +158,12 @@  discard block
 block discarded – undo
158 158
     }
159 159
 
160 160
     /**
161
-    * Clears a specific cache item from the database.
162
-    * 
163
-    * @param string $cacheKey
164
-    * @param string $namespace
165
-    * @return bool
166
-    */
161
+     * Clears a specific cache item from the database.
162
+     * 
163
+     * @param string $cacheKey
164
+     * @param string $namespace
165
+     * @return bool
166
+     */
167 167
     public function clear(string $cacheKey, string $namespace = '')
168 168
     {
169 169
         $query = $this->getDeleteQueryWithDriver();
@@ -176,10 +176,10 @@  discard block
 block discarded – undo
176 176
     }
177 177
 
178 178
     /**
179
-    * Gets the query to renew the expiration time of a cache item based on the database driver.
180
-    *  
181
-    * @return string
182
-    */
179
+     * Gets the query to renew the expiration time of a cache item based on the database driver.
180
+     *  
181
+     * @return string
182
+     */
183 183
     private function getRenewExpirationQueryWithDriver(): string
184 184
     {
185 185
         $driver = $this->connection->getAttribute(PDO::ATTR_DRIVER_NAME);
@@ -194,13 +194,13 @@  discard block
 block discarded – undo
194 194
     }
195 195
 
196 196
     /**
197
-    * Checks if a cache item is valid based on its key, namespace, and current time.
198
-    * 
199
-    * @param string $cacheKey
200
-    * @param string $namespace
201
-    * @param string $currentTime
202
-    * @return bool
203
-    */
197
+     * Checks if a cache item is valid based on its key, namespace, and current time.
198
+     * 
199
+     * @param string $cacheKey
200
+     * @param string $namespace
201
+     * @param string $currentTime
202
+     * @return bool
203
+     */
204 204
     private function hasValidCache(string $cacheKey, string $namespace, string $currentTime): bool
205 205
     {
206 206
         $stmt = $this->connection->prepare(
@@ -216,13 +216,13 @@  discard block
 block discarded – undo
216 216
     }
217 217
 
218 218
     /**
219
-    * Renews the expiration time of a cache item.
220
-    * 
221
-    * @param string $cacheKey
222
-    * @param string|int $ttl
223
-    * @param string $namespace
224
-    * @return bool
225
-    */
219
+     * Renews the expiration time of a cache item.
220
+     * 
221
+     * @param string $cacheKey
222
+     * @param string|int $ttl
223
+     * @param string $namespace
224
+     * @return bool
225
+     */
226 226
     public function renew(string $cacheKey, string|int $ttl, string $namespace = '')
227 227
     {
228 228
         $currentTime = date('Y-m-d H:i:s');
@@ -242,32 +242,32 @@  discard block
 block discarded – undo
242 242
     }
243 243
 
244 244
     /**
245
-    * Flushes all cache items from the database.
246
-    * 
247
-    * @return bool
248
-    */
245
+     * Flushes all cache items from the database.
246
+     * 
247
+     * @return bool
248
+     */
249 249
     public function flush()
250 250
     {
251 251
         return $this->connection->exec("DELETE FROM cacheer_table") !== false;
252 252
     }
253 253
 
254 254
     /**
255
-    * Serializes or unserializes data based on the provided flag.
256
-    * 
257
-    * @param mixed $data
258
-    * @return string
259
-    */
255
+     * Serializes or unserializes data based on the provided flag.
256
+     * 
257
+     * @param mixed $data
258
+     * @return string
259
+     */
260 260
     private function serialize(mixed $data, bool $serialize = true)
261 261
     {
262 262
         return $serialize ? serialize($data) : unserialize($data);
263 263
     }
264 264
 
265 265
     /**
266
-    * Gets the current date and time based on the database driver.
267
-    * 
268
-    * @param string $driver
269
-    * @return string
270
-    */
266
+     * Gets the current date and time based on the database driver.
267
+     * 
268
+     * @param string $driver
269
+     * @return string
270
+     */
271 271
     private function getCurrentDateTime(string $driver)
272 272
     {
273 273
         return ($driver === 'sqlite') ? "DATETIME('now', 'localtime')" : "NOW()";
Please login to merge, or discard this patch.
src/Support/TimeBuilder.php 1 patch
Indentation   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -13,112 +13,112 @@
 block discarded – undo
13 13
 class TimeBuilder
14 14
 {
15 15
 
16
-  /** @param string $unit */
17
-  private string $unit;
18
-
19
-  /** @param int $value */
20
-  private int $value;
21
-
22
-  /** @param Closure $callback */
23
-  private Closure $callback;
24
-
25
-  /** @param FileOptionBuilder */
26
-  private $builder = null;
27
-
28
-  /**
29
-  * TimeBuilder constructor.
30
-  * @param Closure $callback
31
-  * @param FileOptionBuilder $builder
32
-  *
33
-  * @return void
34
-  */
35
-  public function __construct(Closure $callback, $builder)
36
-  {
16
+    /** @param string $unit */
17
+    private string $unit;
18
+
19
+    /** @param int $value */
20
+    private int $value;
21
+
22
+    /** @param Closure $callback */
23
+    private Closure $callback;
24
+
25
+    /** @param FileOptionBuilder */
26
+    private $builder = null;
27
+
28
+    /**
29
+     * TimeBuilder constructor.
30
+     * @param Closure $callback
31
+     * @param FileOptionBuilder $builder
32
+     *
33
+     * @return void
34
+     */
35
+    public function __construct(Closure $callback, $builder)
36
+    {
37 37
     $this->callback = $callback;
38 38
     $this->builder = $builder;
39
-  }
40
-
41
-  /**
42
-  * Sets the time in seconds.
43
-  * 
44
-  * @param int $seconds
45
-  * @return FileOptionBuilder|mixed
46
-  */
47
-  public function second(int $seconds) 
48
-  {
39
+    }
40
+
41
+    /**
42
+     * Sets the time in seconds.
43
+     * 
44
+     * @param int $seconds
45
+     * @return FileOptionBuilder|mixed
46
+     */
47
+    public function second(int $seconds) 
48
+    {
49 49
     return $this->setTime($seconds, "seconds");
50
-  }
51
-
52
-  /**
53
-  * Sets the time in minutes.
54
-  *
55
-  * @param int $minutes
56
-  * @return FileOptionBuilder|mixed
57
-  */
58
-  public function minute(int $minutes) 
59
-  {
50
+    }
51
+
52
+    /**
53
+     * Sets the time in minutes.
54
+     *
55
+     * @param int $minutes
56
+     * @return FileOptionBuilder|mixed
57
+     */
58
+    public function minute(int $minutes) 
59
+    {
60 60
     return $this->setTime($minutes, "minutes");
61
-  }
62
-
63
-  /**
64
-  * Sets the time in hours.
65
-  * 
66
-  * @param int $hours
67
-  * @return FileOptionBuilder|mixed
68
-  */
69
-  public function hour(int $hours) 
70
-  {
61
+    }
62
+
63
+    /**
64
+     * Sets the time in hours.
65
+     * 
66
+     * @param int $hours
67
+     * @return FileOptionBuilder|mixed
68
+     */
69
+    public function hour(int $hours) 
70
+    {
71 71
     return $this->setTime($hours, "hours");
72
-  }
73
-
74
-  /**
75
-  * Sets the time in days.
76
-  *
77
-  * @param int $days
78
-  * @return FileOptionBuilder|mixed
79
-  */
80
-  public function day(int $days) 
81
-  {
72
+    }
73
+
74
+    /**
75
+     * Sets the time in days.
76
+     *
77
+     * @param int $days
78
+     * @return FileOptionBuilder|mixed
79
+     */
80
+    public function day(int $days) 
81
+    {
82 82
     return $this->setTime($days, "days");
83
-  }
84
-
85
-  /**
86
-  * Sets the time in weeks.
87
-  *
88
-  * @param int $weeks
89
-  * @return FileOptionBuilder|mixed
90
-  */
91
-  public function week(int $weeks) 
92
-  {
83
+    }
84
+
85
+    /**
86
+     * Sets the time in weeks.
87
+     *
88
+     * @param int $weeks
89
+     * @return FileOptionBuilder|mixed
90
+     */
91
+    public function week(int $weeks) 
92
+    {
93 93
     return $this->setTime($weeks, "weeks");
94
-  }
95
-
96
-  /**
97
-  * Sets the time in months.
98
-  *
99
-  * @param int $months
100
-  * @return FileOptionBuilder|mixed
101
-  */
102
-  public function month(int $months) 
103
-  {
94
+    }
95
+
96
+    /**
97
+     * Sets the time in months.
98
+     *
99
+     * @param int $months
100
+     * @return FileOptionBuilder|mixed
101
+     */
102
+    public function month(int $months) 
103
+    {
104 104
     return $this->setTime($months, "months");
105
-  }
105
+    }
106 106
   
107 107
 
108
-  /** 
109
-  * This method sets the time value and unit, and invokes the callback with the formatted string. 
110
-  *
111
-  * @param int $value
112
-  * @param string $unit
113
-  * @return FileOptionBuilder
114
-  */
115
-  private function setTime(int $value, string $unit) 
116
-  {
108
+    /** 
109
+     * This method sets the time value and unit, and invokes the callback with the formatted string. 
110
+     *
111
+     * @param int $value
112
+     * @param string $unit
113
+     * @return FileOptionBuilder
114
+     */
115
+    private function setTime(int $value, string $unit) 
116
+    {
117 117
 
118 118
     $this->value = $value;
119 119
     $this->unit = $unit;
120
-   ($this->callback)("{$value} {$unit}");
120
+    ($this->callback)("{$value} {$unit}");
121 121
     return $this->builder;
122
-  }
122
+    }
123 123
 
124 124
 }
Please login to merge, or discard this patch.
src/CacheStore/FileCacheStore.php 1 patch
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.
src/CacheStore/CacheManager/FileCacheFlusher.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -12,18 +12,18 @@  discard block
 block discarded – undo
12 12
 class FileCacheFlusher
13 13
 {
14 14
     /**
15
-    * @var FileCacheManager
16
-    */
15
+     * @var FileCacheManager
16
+     */
17 17
     private FileCacheManager $fileManager;
18 18
 
19 19
     /**
20
-    * @var string $cacheDir
21
-    */
20
+     * @var string $cacheDir
21
+     */
22 22
     private string $cacheDir;
23 23
 
24 24
     /**
25
-    * @var string $lastFlushTimeFile
26
-    */
25
+     * @var string $lastFlushTimeFile
26
+     */
27 27
     private string $lastFlushTimeFile;
28 28
 
29 29
     /**
@@ -40,10 +40,10 @@  discard block
 block discarded – undo
40 40
     }
41 41
 
42 42
     /**
43
-    * Flushes all cache items and updates the last flush timestamp.
44
-    *
45
-    * @return void
46
-    */
43
+     * Flushes all cache items and updates the last flush timestamp.
44
+     *
45
+     * @return void
46
+     */
47 47
     public function flushCache()
48 48
     {
49 49
         $this->fileManager->clearDirectory($this->cacheDir);
@@ -51,11 +51,11 @@  discard block
 block discarded – undo
51 51
     }
52 52
 
53 53
     /**
54
-    * Handles the auto-flush functionality based on options.
55
-    *
56
-    * @param array $options
57
-    * @return void
58
-    */
54
+     * Handles the auto-flush functionality based on options.
55
+     *
56
+     * @param array $options
57
+     * @return void
58
+     */
59 59
     public function handleAutoFlush(array $options)
60 60
     {
61 61
         if (isset($options['flushAfter'])) {
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
     }
65 65
 
66 66
     /**
67
-    * Schedules a flush operation based on the provided interval.
68
-    *
69
-    * @param string $flushAfter
70
-    * @return void
71
-    */
67
+     * Schedules a flush operation based on the provided interval.
68
+     *
69
+     * @param string $flushAfter
70
+     * @return void
71
+     */
72 72
     private function scheduleFlush(string $flushAfter)
73 73
     {
74 74
         $flushAfterSeconds = CacheFileHelper::convertExpirationToSeconds($flushAfter);
Please login to merge, or discard this patch.
src/Cacheer.php 1 patch
Indentation   +172 added lines, -172 removed lines patch added patch discarded remove patch
@@ -24,50 +24,50 @@  discard block
 block discarded – undo
24 24
 final class Cacheer implements CacheerInterface
25 25
 {
26 26
     /**
27
-    * @var string
28
-    */
27
+     * @var string
28
+     */
29 29
     private string $message;
30 30
 
31 31
     /**
32
-    * @var boolean
33
-    */
32
+     * @var boolean
33
+     */
34 34
     private bool $success;
35 35
 
36 36
     /**
37
-    * @var boolean
38
-    */
37
+     * @var boolean
38
+     */
39 39
     private bool $formatted = false;
40 40
 
41 41
     /**
42
-    * @var bool
43
-    */
42
+     * @var bool
43
+     */
44 44
     private bool $compression = false;
45 45
 
46 46
     /**
47
-    * @var string|null
48
-    */
47
+     * @var string|null
48
+     */
49 49
     private ?string $encryptionKey = null;
50 50
 
51 51
     /**
52
-    * @var FileCacheStore|DatabaseCacheStore|RedisCacheStore|ArrayCacheStore
53
-    */
52
+     * @var FileCacheStore|DatabaseCacheStore|RedisCacheStore|ArrayCacheStore
53
+     */
54 54
     public $cacheStore;
55 55
 
56 56
     /**
57
-    * @var array
58
-    */
57
+     * @var array
58
+     */
59 59
     public array $options = [];
60 60
 
61 61
     private CacheRetriever $retriever;
62 62
     private CacheMutator $mutator;
63 63
 
64 64
 /**
65
-    * Cacheer constructor.
66
-    *
67
-    * @param array $options
68
-    * @param bool  $formatted
69
-    * @throws RuntimeException
70
-    */
65
+ * Cacheer constructor.
66
+ *
67
+ * @param array $options
68
+ * @param bool  $formatted
69
+ * @throws RuntimeException
70
+ */
71 71
     public function __construct(array $options = [], $formatted = false)
72 72
     {
73 73
         $this->formatted = $formatted;
@@ -78,255 +78,255 @@  discard block
 block discarded – undo
78 78
     }
79 79
 
80 80
     /**
81
-    * Adds data to the cache if it does not already exist.
82
-    *
83
-    * @param string $cacheKey
84
-    * @param mixed  $cacheData
85
-    * @param string $namespace
86
-    * @param int|string $ttl
87
-    * @return bool
88
-    */
81
+     * Adds data to the cache if it does not already exist.
82
+     *
83
+     * @param string $cacheKey
84
+     * @param mixed  $cacheData
85
+     * @param string $namespace
86
+     * @param int|string $ttl
87
+     * @return bool
88
+     */
89 89
     public function add(string $cacheKey, mixed $cacheData, string $namespace = '', int|string $ttl = 3600)
90 90
     {
91 91
         return $this->mutator->add($cacheKey, $cacheData, $namespace, $ttl);
92 92
     }
93 93
 
94 94
     /**
95
-    * Appends data to an existing cache item.
96
-    * 
97
-    * @param string $cacheKey
98
-    * @param mixed  $cacheData
99
-    * @param string $namespace
100
-    * @return void
101
-    */
95
+     * Appends data to an existing cache item.
96
+     * 
97
+     * @param string $cacheKey
98
+     * @param mixed  $cacheData
99
+     * @param string $namespace
100
+     * @return void
101
+     */
102 102
     public function appendCache(string $cacheKey, mixed $cacheData, string $namespace = ''): void
103 103
     {
104 104
         $this->mutator->appendCache($cacheKey, $cacheData, $namespace);
105 105
     }
106 106
 
107 107
     /**
108
-    * Clears a specific cache item.
109
-    * 
110
-    * @param string $cacheKey
111
-    * @param string $namespace
112
-    * @return void
113
-    */
108
+     * Clears a specific cache item.
109
+     * 
110
+     * @param string $cacheKey
111
+     * @param string $namespace
112
+     * @return void
113
+     */
114 114
     public function clearCache(string $cacheKey, string $namespace = ''): void
115 115
     {
116 116
         $this->mutator->clearCache($cacheKey, $namespace);
117 117
     }
118 118
 
119 119
     /**
120
-    * Decrements a cache item by a specified amount.
121
-    *  
122
-    * @param string $cacheKey
123
-    * @param int $amount
124
-    * @param string $namespace
125
-    * @return bool
126
-    */
120
+     * Decrements a cache item by a specified amount.
121
+     *  
122
+     * @param string $cacheKey
123
+     * @param int $amount
124
+     * @param string $namespace
125
+     * @return bool
126
+     */
127 127
     public function decrement(string $cacheKey, int $amount = 1, string $namespace = '')
128 128
     {
129 129
         return $this->mutator->decrement($cacheKey, $amount, $namespace);
130 130
     }
131 131
 
132 132
     /**
133
-    * Store data in the cache permanently.
134
-    *
135
-    * @param string $cacheKey
136
-    * @param mixed $cacheData
137
-    * @return void
138
-    */
133
+     * Store data in the cache permanently.
134
+     *
135
+     * @param string $cacheKey
136
+     * @param mixed $cacheData
137
+     * @return void
138
+     */
139 139
     public function forever(string $cacheKey, mixed $cacheData): void
140 140
     {
141 141
         $this->mutator->forever($cacheKey, $cacheData);
142 142
     }
143 143
 
144 144
     /**
145
-    * Flushes all cache items.
146
-    * 
147
-    * @return void
148
-    */
145
+     * Flushes all cache items.
146
+     * 
147
+     * @return void
148
+     */
149 149
     public function flushCache(): void
150 150
     {
151 151
         $this->mutator->flushCache();
152 152
     }
153 153
 
154 154
     /**
155
-    * Retrieves a cache item and deletes it from the cache.
156
-    * 
157
-    * @param string $cacheKey
158
-    * @param string $namespace
159
-    * @return mixed
160
-    */
155
+     * Retrieves a cache item and deletes it from the cache.
156
+     * 
157
+     * @param string $cacheKey
158
+     * @param string $namespace
159
+     * @return mixed
160
+     */
161 161
     public function getAndForget(string $cacheKey, string $namespace = '')
162 162
     {
163 163
         return $this->retriever->getAndForget($cacheKey, $namespace);
164 164
     }
165 165
 
166 166
     /**
167
-    * Gets all items in a specific namespace.
168
-    * 
169
-    * @param string $namespace
170
-    * @return CacheDataFormatter|mixed
171
-    */
167
+     * Gets all items in a specific namespace.
168
+     * 
169
+     * @param string $namespace
170
+     * @return CacheDataFormatter|mixed
171
+     */
172 172
     public function getAll(string $namespace = '')
173 173
     {
174 174
         return $this->retriever->getAll($namespace);
175 175
     }
176 176
 
177 177
     /**
178
-    * Retrieves a single cache item.
179
-    * 
180
-    * @param string $cacheKey
181
-    * @param string $namespace
182
-    * @param string|int $ttl
183
-    * @return CacheDataFormatter|mixed
184
-    */
178
+     * Retrieves a single cache item.
179
+     * 
180
+     * @param string $cacheKey
181
+     * @param string $namespace
182
+     * @param string|int $ttl
183
+     * @return CacheDataFormatter|mixed
184
+     */
185 185
     public function getCache(string $cacheKey, string $namespace = '', string|int $ttl = 3600)
186 186
     {
187 187
         return $this->retriever->getCache($cacheKey, $namespace, $ttl);
188 188
     }
189 189
 
190 190
     /**
191
-    * Retrieves multiple cache items by their keys.
192
-    * 
193
-    * @param array $cacheKeys
194
-    * @param string $namespace
195
-    * @param string|int $ttl
196
-    * @return CacheDataFormatter|mixed
197
-    */
191
+     * Retrieves multiple cache items by their keys.
192
+     * 
193
+     * @param array $cacheKeys
194
+     * @param string $namespace
195
+     * @param string|int $ttl
196
+     * @return CacheDataFormatter|mixed
197
+     */
198 198
     public function getMany(array $cacheKeys, string $namespace = '', string|int $ttl = 3600)
199 199
     {
200 200
         return $this->retriever->getMany($cacheKeys, $namespace, $ttl);
201 201
     }
202 202
 
203 203
     /**
204
-    * Checks if a cache item exists.
205
-    * 
206
-    * @param string $cacheKey
207
-    * @param string $namespace
208
-    * @return void
209
-    */
204
+     * Checks if a cache item exists.
205
+     * 
206
+     * @param string $cacheKey
207
+     * @param string $namespace
208
+     * @return void
209
+     */
210 210
     public function has(string $cacheKey, string $namespace = ''): void
211 211
     {
212 212
         $this->retriever->has($cacheKey, $namespace);
213 213
     }
214 214
 
215 215
     /**
216
-    * Increments a cache item by a specified amount.
217
-    * 
218
-    * @param string $cacheKey
219
-    * @param int $amount
220
-    * @param string $namespace
221
-    * @return bool
222
-    */
216
+     * Increments a cache item by a specified amount.
217
+     * 
218
+     * @param string $cacheKey
219
+     * @param int $amount
220
+     * @param string $namespace
221
+     * @return bool
222
+     */
223 223
     public function increment(string $cacheKey, int $amount = 1, string $namespace = '')
224 224
     {
225 225
         return $this->mutator->increment($cacheKey, $amount, $namespace);
226 226
     }
227 227
 
228 228
     /**
229
-    * Checks if the last operation was successful.
230
-    * 
231
-    * @return boolean
232
-    */
229
+     * Checks if the last operation was successful.
230
+     * 
231
+     * @return boolean
232
+     */
233 233
     public function isSuccess()
234 234
     {
235 235
         return $this->success;
236 236
     }
237 237
 
238 238
     /**
239
-    * Stores an item in the cache with a specific TTL.
240
-    * 
241
-    * @param string $cacheKey
242
-    * @param mixed  $cacheData
243
-    * @param string $namespace
244
-    * @param string|int $ttl
245
-    * @return void
246
-    */
239
+     * Stores an item in the cache with a specific TTL.
240
+     * 
241
+     * @param string $cacheKey
242
+     * @param mixed  $cacheData
243
+     * @param string $namespace
244
+     * @param string|int $ttl
245
+     * @return void
246
+     */
247 247
     public function putCache(string $cacheKey, mixed $cacheData, string $namespace = '', string|int $ttl = 3600): void
248 248
     {
249 249
         $this->mutator->putCache($cacheKey, $cacheData, $namespace, $ttl);
250 250
     }
251 251
 
252 252
     /**
253
-    * Stores multiple items in the cache.
254
-    *  
255
-    * @param array   $items
256
-    * @param string  $namespace
257
-    * @param integer $batchSize
258
-    * @return void
259
-    */
253
+     * Stores multiple items in the cache.
254
+     *  
255
+     * @param array   $items
256
+     * @param string  $namespace
257
+     * @param integer $batchSize
258
+     * @return void
259
+     */
260 260
     public function putMany(array $items, string $namespace = '', int $batchSize = 100): void
261 261
     {
262 262
         $this->mutator->putMany($items, $namespace, $batchSize);
263 263
     }
264 264
 
265 265
     /**
266
-    * Renews the cache for a specific key with a new TTL.
267
-    * 
268
-    * @param string $cacheKey
269
-    * @param string|int $ttl
270
-    * @param string $namespace
271
-    * @return void
272
-    */
266
+     * Renews the cache for a specific key with a new TTL.
267
+     * 
268
+     * @param string $cacheKey
269
+     * @param string|int $ttl
270
+     * @param string $namespace
271
+     * @return void
272
+     */
273 273
     public function renewCache(string $cacheKey, string|int $ttl = 3600, string $namespace = ''): void
274 274
     {
275 275
         $this->mutator->renewCache($cacheKey, $ttl, $namespace);
276 276
     }
277 277
 
278 278
     /**
279
-    * Retrieves a cache item or executes a callback to store it if not found.
280
-    * 
281
-    * @param string $cacheKey
282
-    * @param int|string $ttl
283
-    * @param Closure $callback
284
-    * @return mixed
285
-    */
279
+     * Retrieves a cache item or executes a callback to store it if not found.
280
+     * 
281
+     * @param string $cacheKey
282
+     * @param int|string $ttl
283
+     * @param Closure $callback
284
+     * @return mixed
285
+     */
286 286
     public function remember(string $cacheKey, int|string $ttl, Closure $callback)
287 287
     {
288 288
         return $this->retriever->remember($cacheKey, $ttl, $callback);
289 289
     }
290 290
 
291 291
     /**
292
-    * Retrieves a cache item or executes a callback to store it permanently if not found.
293
-    * 
294
-    * @param string $cacheKey
295
-    * @param Closure $callback
296
-    * @return mixed
297
-    */
292
+     * Retrieves a cache item or executes a callback to store it permanently if not found.
293
+     * 
294
+     * @param string $cacheKey
295
+     * @param Closure $callback
296
+     * @return mixed
297
+     */
298 298
     public function rememberForever(string $cacheKey, Closure $callback)
299 299
     {
300 300
         return $this->retriever->rememberForever($cacheKey, $callback);
301 301
     }
302 302
 
303 303
     /**
304
-    * Returns a CacheConfig instance for configuration management.
305
-    * 
306
-    * @return CacheConfig
307
-    */
304
+     * Returns a CacheConfig instance for configuration management.
305
+     * 
306
+     * @return CacheConfig
307
+     */
308 308
     public function setConfig()
309 309
     {
310 310
         return new CacheConfig($this);
311 311
     }
312 312
 
313 313
     /**
314
-    * Sets the cache driver based on the configuration.
315
-    * 
316
-    * @return CacheDriver
317
-    */
314
+     * Sets the cache driver based on the configuration.
315
+     * 
316
+     * @return CacheDriver
317
+     */
318 318
     public function setDriver()
319 319
     {
320 320
         return new CacheDriver($this);
321 321
     }
322 322
 
323 323
     /**
324
-    * Sets a message for the cache operation.
325
-    *
326
-    * @param string  $message
327
-    * @param boolean $success
328
-    * @return void
329
-    */
324
+     * Sets a message for the cache operation.
325
+     *
326
+     * @param string  $message
327
+     * @param boolean $success
328
+     * @return void
329
+     */
330 330
     private function setMessage(string $message, bool $success)
331 331
     {
332 332
         $this->message = $message;
@@ -334,10 +334,10 @@  discard block
 block discarded – undo
334 334
     }
335 335
 
336 336
     /**
337
-    * Retrieves the message from the last operation.
338
-    * 
339
-    * @return string
340
-    */
337
+     * Retrieves the message from the last operation.
338
+     * 
339
+     * @return string
340
+     */
341 341
     public function getMessage()
342 342
     {
343 343
         return $this->message;
@@ -369,32 +369,32 @@  discard block
 block discarded – undo
369 369
     }
370 370
 
371 371
     /**
372
-    * Enables or disables the formatter for cache data.
373
-    * 
374
-    * @return void
375
-    */
372
+     * Enables or disables the formatter for cache data.
373
+     * 
374
+     * @return void
375
+     */
376 376
     public function useFormatter()
377 377
     {
378 378
         $this->formatted = !$this->formatted;
379 379
     }
380 380
 
381 381
     /**
382
-    * Validates the options provided for the Cacheer instance.
383
-    * 
384
-    * @param array $options
385
-    * @return void
386
-    */
382
+     * Validates the options provided for the Cacheer instance.
383
+     * 
384
+     * @param array $options
385
+     * @return void
386
+     */
387 387
     private function validateOptions(array $options)
388 388
     {
389 389
         $this->options = $options;
390 390
     }
391 391
 
392 392
     /**
393
-    * Enable or disable data compression
394
-    *
395
-    * @param bool $status
396
-    * @return $this
397
-    */
393
+     * Enable or disable data compression
394
+     *
395
+     * @param bool $status
396
+     * @return $this
397
+     */
398 398
     public function useCompression(bool $status = true)
399 399
     {
400 400
         $this->compression = $status;
@@ -402,11 +402,11 @@  discard block
 block discarded – undo
402 402
     }
403 403
 
404 404
     /**
405
-    * Enable encryption for cached data
406
-    *
407
-    * @param string $key
408
-    * @return $this
409
-    */
405
+     * Enable encryption for cached data
406
+     *
407
+     * @param string $key
408
+     * @return $this
409
+     */
410 410
     public function useEncryption(string $key)
411 411
     {
412 412
         $this->encryptionKey = $key;
Please login to merge, or discard this patch.