@@ -131,11 +131,11 @@ discard block |
||
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
134 | - * @param string $cacheKey |
|
135 | - * @param int $amount |
|
136 | - * @param string $namespace |
|
137 | - * @return bool |
|
138 | - */ |
|
134 | + * @param string $cacheKey |
|
135 | + * @param int $amount |
|
136 | + * @param string $namespace |
|
137 | + * @return bool |
|
138 | + */ |
|
139 | 139 | public function increment(string $cacheKey, int $amount = 1, string $namespace = '') |
140 | 140 | { |
141 | 141 | $cacheData = $this->getCache($cacheKey, $namespace); |
@@ -150,20 +150,20 @@ discard block |
||
150 | 150 | } |
151 | 151 | |
152 | 152 | /** |
153 | - * @param string $cacheKey |
|
154 | - * @param int $amount |
|
155 | - * @param string $namespace |
|
156 | - * @return bool |
|
157 | - */ |
|
153 | + * @param string $cacheKey |
|
154 | + * @param int $amount |
|
155 | + * @param string $namespace |
|
156 | + * @return bool |
|
157 | + */ |
|
158 | 158 | public function decrement(string $cacheKey, int $amount = 1, string $namespace = '') |
159 | 159 | { |
160 | - return $this->increment($cacheKey, ($amount * -1), $namespace); |
|
160 | + return $this->increment($cacheKey, ($amount * -1), $namespace); |
|
161 | 161 | } |
162 | 162 | /** |
163 | - * @param string $cacheKey |
|
164 | - * @param mixed $cacheData |
|
165 | - * @return void |
|
166 | - */ |
|
163 | + * @param string $cacheKey |
|
164 | + * @param mixed $cacheData |
|
165 | + * @return void |
|
166 | + */ |
|
167 | 167 | public function forever(string $cacheKey, mixed $cacheData) |
168 | 168 | { |
169 | 169 | $this->putCache($cacheKey, $cacheData, ttl: 31536000 * 1000); |
@@ -171,11 +171,11 @@ discard block |
||
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
174 | - * @param string $cacheKey |
|
175 | - * @param int|string $ttl |
|
176 | - * @param Closure $callback |
|
177 | - * @return mixed |
|
178 | - */ |
|
174 | + * @param string $cacheKey |
|
175 | + * @param int|string $ttl |
|
176 | + * @param Closure $callback |
|
177 | + * @return mixed |
|
178 | + */ |
|
179 | 179 | public function remember(string $cacheKey, int|string $ttl, Closure $callback) |
180 | 180 | { |
181 | 181 | $cachedData = $this->getCache($cacheKey, ttl: $ttl); |
@@ -192,20 +192,20 @@ discard block |
||
192 | 192 | } |
193 | 193 | |
194 | 194 | /** |
195 | - * @param string $cacheKey |
|
196 | - * @param Closure $callback |
|
197 | - * @return mixed |
|
198 | - */ |
|
195 | + * @param string $cacheKey |
|
196 | + * @param Closure $callback |
|
197 | + * @return mixed |
|
198 | + */ |
|
199 | 199 | public function rememberForever(string $cacheKey, Closure $callback) |
200 | 200 | { |
201 | 201 | return $this->remember($cacheKey, 31536000 * 1000, $callback); |
202 | 202 | } |
203 | 203 | |
204 | 204 | /** |
205 | - * @param string $cacheKey |
|
206 | - * @param string $namespace |
|
207 | - * @return mixed |
|
208 | - */ |
|
205 | + * @param string $cacheKey |
|
206 | + * @param string $namespace |
|
207 | + * @return mixed |
|
208 | + */ |
|
209 | 209 | public function getAndForget(string $cacheKey, string $namespace = '') |
210 | 210 | { |
211 | 211 | $cachedData = $this->getCache($cacheKey, $namespace); |
@@ -219,12 +219,12 @@ discard block |
||
219 | 219 | } |
220 | 220 | |
221 | 221 | /** |
222 | - * @param string $cacheKey |
|
223 | - * @param mixed $cacheData |
|
224 | - * @param string $namespace |
|
225 | - * @param int|string $ttl |
|
226 | - * @return bool |
|
227 | - */ |
|
222 | + * @param string $cacheKey |
|
223 | + * @param mixed $cacheData |
|
224 | + * @param string $namespace |
|
225 | + * @param int|string $ttl |
|
226 | + * @return bool |
|
227 | + */ |
|
228 | 228 | public function add(string $cacheKey, mixed $cacheData, string $namespace = '', int|string $ttl = 3600) |
229 | 229 | { |
230 | 230 | if (!empty($this->getCache($cacheKey, $namespace))) { |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * @param string|int $ttl |
58 | 58 | * @return CacheDataFormatter|mixed |
59 | 59 | */ |
60 | - public function getCache(string $cacheKey, string $namespace = '', string|int $ttl = 3600) |
|
60 | + public function getCache(string $cacheKey, string $namespace = '', string | int $ttl = 3600) |
|
61 | 61 | { |
62 | 62 | $cacheData = $this->cacheStore->getCache($cacheKey, $namespace, $ttl); |
63 | 63 | $this->setMessage($this->cacheStore->getMessage(), $this->cacheStore->isSuccess()); |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | * @param string|int $ttl |
72 | 72 | * @return void |
73 | 73 | */ |
74 | - public function putCache(string $cacheKey, mixed $cacheData, string $namespace = '', string|int $ttl = 3600) |
|
74 | + public function putCache(string $cacheKey, mixed $cacheData, string $namespace = '', string | int $ttl = 3600) |
|
75 | 75 | { |
76 | 76 | $this->cacheStore->putCache($cacheKey, $cacheData, $namespace, $ttl); |
77 | 77 | $this->setMessage($this->cacheStore->getMessage(), $this->cacheStore->isSuccess()); |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * @param string $namespace |
118 | 118 | * @return mixed |
119 | 119 | */ |
120 | - public function renewCache(string $cacheKey, string|int $ttl = 3600, string $namespace = '') |
|
120 | + public function renewCache(string $cacheKey, string | int $ttl = 3600, string $namespace = '') |
|
121 | 121 | { |
122 | 122 | $renewedCache = $this->cacheStore->renewCache($cacheKey, $ttl, $namespace); |
123 | 123 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | { |
141 | 141 | $cacheData = $this->getCache($cacheKey, $namespace); |
142 | 142 | |
143 | - if(!empty($cacheData) && is_numeric($cacheData)) { |
|
143 | + if (!empty($cacheData) && is_numeric($cacheData)) { |
|
144 | 144 | $this->putCache($cacheKey, (int)($cacheData + $amount), $namespace); |
145 | 145 | $this->setMessage($this->getMessage(), $this->isSuccess()); |
146 | 146 | return true; |
@@ -176,11 +176,11 @@ discard block |
||
176 | 176 | * @param Closure $callback |
177 | 177 | * @return mixed |
178 | 178 | */ |
179 | - public function remember(string $cacheKey, int|string $ttl, Closure $callback) |
|
179 | + public function remember(string $cacheKey, int | string $ttl, Closure $callback) |
|
180 | 180 | { |
181 | 181 | $cachedData = $this->getCache($cacheKey, ttl: $ttl); |
182 | 182 | |
183 | - if(!empty($cachedData)) { |
|
183 | + if (!empty($cachedData)) { |
|
184 | 184 | return $cachedData; |
185 | 185 | } |
186 | 186 | |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | * @param int|string $ttl |
226 | 226 | * @return bool |
227 | 227 | */ |
228 | - public function add(string $cacheKey, mixed $cacheData, string $namespace = '', int|string $ttl = 3600) |
|
228 | + public function add(string $cacheKey, mixed $cacheData, string $namespace = '', int | string $ttl = 3600) |
|
229 | 229 | { |
230 | 230 | if (!empty($this->getCache($cacheKey, $namespace))) { |
231 | 231 | return true; |
@@ -13,9 +13,9 @@ discard block |
||
13 | 13 | { |
14 | 14 | |
15 | 15 | /** |
16 | - * @param string $expiration |
|
17 | - * @return int |
|
18 | - */ |
|
16 | + * @param string $expiration |
|
17 | + * @return int |
|
18 | + */ |
|
19 | 19 | public static function convertExpirationToSeconds(string $expiration) |
20 | 20 | { |
21 | 21 | $units = [ |
@@ -63,10 +63,10 @@ discard block |
||
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
66 | - * @param string|int $ttl |
|
67 | - * @param int $defaultTTL |
|
68 | - * @return mixed |
|
69 | - */ |
|
66 | + * @param string|int $ttl |
|
67 | + * @param int $defaultTTL |
|
68 | + * @return mixed |
|
69 | + */ |
|
70 | 70 | public static function ttl($ttl = null, ?int $defaultTTL = null) { |
71 | 71 | if ($ttl) { |
72 | 72 | $ttl = is_string($ttl) ? CacheFileHelper::convertExpirationToSeconds($ttl) : $ttl; |
@@ -76,19 +76,19 @@ discard block |
||
76 | 76 | return $ttl; |
77 | 77 | } |
78 | 78 | |
79 | - /** |
|
80 | - * @param mixed $currentCacheData |
|
81 | - * @param mixed $cacheData |
|
82 | - * @return array |
|
83 | - */ |
|
84 | - public static function arrayIdentifier(mixed $currentCacheData, mixed $cacheData) |
|
85 | - { |
|
79 | + /** |
|
80 | + * @param mixed $currentCacheData |
|
81 | + * @param mixed $cacheData |
|
82 | + * @return array |
|
83 | + */ |
|
84 | + public static function arrayIdentifier(mixed $currentCacheData, mixed $cacheData) |
|
85 | + { |
|
86 | 86 | if (is_array($currentCacheData) && is_array($cacheData)) { |
87 | - $mergedCacheData = array_merge($currentCacheData, $cacheData); |
|
87 | + $mergedCacheData = array_merge($currentCacheData, $cacheData); |
|
88 | 88 | } else { |
89 | - $mergedCacheData = array_merge((array)$currentCacheData, (array)$cacheData); |
|
89 | + $mergedCacheData = array_merge((array)$currentCacheData, (array)$cacheData); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | return $mergedCacheData; |
93 | - } |
|
93 | + } |
|
94 | 94 | } |
@@ -15,9 +15,9 @@ |
||
15 | 15 | { |
16 | 16 | |
17 | 17 | /** |
18 | - * @param array|null $database |
|
19 | - * @return PDO|null |
|
20 | - */ |
|
18 | + * @param array|null $database |
|
19 | + * @return PDO|null |
|
20 | + */ |
|
21 | 21 | public static function createConnection(?array $database = null) |
22 | 22 | { |
23 | 23 | $dbConf = $database ?? CACHEER_DATABASE_CONFIG[Connect::getConnection()]; |
@@ -18,9 +18,9 @@ discard block |
||
18 | 18 | |
19 | 19 | |
20 | 20 | /** |
21 | - * @param array|null $database |
|
22 | - * @return PDO|null |
|
23 | - */ |
|
21 | + * @param array|null $database |
|
22 | + * @return PDO|null |
|
23 | + */ |
|
24 | 24 | public static function getInstance(?array $database = null) |
25 | 25 | { |
26 | 26 | $pdo = ConnectionFactory::createConnection($database); |
@@ -31,9 +31,9 @@ discard block |
||
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
34 | - * @param string $connection |
|
35 | - * @return void |
|
36 | - */ |
|
34 | + * @param string $connection |
|
35 | + * @return void |
|
36 | + */ |
|
37 | 37 | public static function setConnection(string $connection) |
38 | 38 | { |
39 | 39 | $drivers = ['mysql', 'sqlite', 'pgsql']; |
@@ -44,16 +44,16 @@ discard block |
||
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
47 | - * @return string |
|
48 | - */ |
|
47 | + * @return string |
|
48 | + */ |
|
49 | 49 | public static function getConnection() |
50 | 50 | { |
51 | 51 | return self::$connection; |
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
55 | - * @return PDOException|null |
|
56 | - */ |
|
55 | + * @return PDOException|null |
|
56 | + */ |
|
57 | 57 | public static function getError() |
58 | 58 | { |
59 | 59 | return self::$error; |