@@ -258,13 +258,13 @@ discard block |
||
| 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 |
||
| 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 | |
@@ -7,40 +7,40 @@ discard block |
||
| 7 | 7 | class ArrayCacheStoreTest extends TestCase |
| 8 | 8 | { |
| 9 | 9 | |
| 10 | - private $cache; |
|
| 10 | + private $cache; |
|
| 11 | 11 | |
| 12 | - protected function setUp(): void |
|
| 13 | - { |
|
| 12 | + protected function setUp(): void |
|
| 13 | + { |
|
| 14 | 14 | $this->cache = new Cacheer(); |
| 15 | 15 | $this->cache->setDriver()->useArrayDriver(); |
| 16 | 16 | $this->cache->setConfig()->setTimeZone('America/Toronto'); |
| 17 | - } |
|
| 17 | + } |
|
| 18 | 18 | |
| 19 | - protected function tearDown(): void |
|
| 20 | - { |
|
| 19 | + protected function tearDown(): void |
|
| 20 | + { |
|
| 21 | 21 | $this->cache->flushCache(); |
| 22 | - } |
|
| 22 | + } |
|
| 23 | 23 | |
| 24 | 24 | public function testUsingArrayDriverSetsProperInstance() |
| 25 | - { |
|
| 25 | + { |
|
| 26 | 26 | $this->assertInstanceOf(ArrayCacheStore::class, $this->cache->cacheStore); |
| 27 | - } |
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | - public function testPutAndGetCacheInArray() |
|
| 30 | - { |
|
| 31 | - $cacheKey = 'test_key'; |
|
| 32 | - $cacheData = ['name' => 'John Doe', 'email' => '[email protected]']; |
|
| 29 | + public function testPutAndGetCacheInArray() |
|
| 30 | + { |
|
| 31 | + $cacheKey = 'test_key'; |
|
| 32 | + $cacheData = ['name' => 'John Doe', 'email' => '[email protected]']; |
|
| 33 | 33 | |
| 34 | - $this->cache->putCache($cacheKey, $cacheData, '', 3600); |
|
| 34 | + $this->cache->putCache($cacheKey, $cacheData, '', 3600); |
|
| 35 | 35 | |
| 36 | - $result = $this->cache->getCache($cacheKey); |
|
| 36 | + $result = $this->cache->getCache($cacheKey); |
|
| 37 | 37 | |
| 38 | - $this->assertNotEmpty($result); |
|
| 39 | - $this->assertEquals($cacheData, $result); |
|
| 40 | - } |
|
| 38 | + $this->assertNotEmpty($result); |
|
| 39 | + $this->assertEquals($cacheData, $result); |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - public function testExpiredCacheInArray() |
|
| 43 | - { |
|
| 42 | + public function testExpiredCacheInArray() |
|
| 43 | + { |
|
| 44 | 44 | $cacheKey = 'expired_key'; |
| 45 | 45 | $cacheData = ['name' => 'Expired User', 'email' => '[email protected]']; |
| 46 | 46 | |
@@ -50,11 +50,11 @@ discard block |
||
| 50 | 50 | $this->assertEquals("Cache stored successfully", $this->cache->getMessage()); |
| 51 | 51 | $this->assertEmpty($this->cache->getCache($cacheKey)); |
| 52 | 52 | $this->assertFalse($this->cache->isSuccess()); |
| 53 | - } |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | 55 | |
| 56 | - public function testOverwriteExistingCacheInArray() |
|
| 57 | - { |
|
| 56 | + public function testOverwriteExistingCacheInArray() |
|
| 57 | + { |
|
| 58 | 58 | $cacheKey = 'overwrite_key'; |
| 59 | 59 | $initialCacheData = ['name' => 'Initial Data', 'email' => '[email protected]']; |
| 60 | 60 | $newCacheData = ['name' => 'New Data', 'email' => '[email protected]']; |
@@ -65,12 +65,12 @@ discard block |
||
| 65 | 65 | $this->cache->appendCache($cacheKey, $newCacheData); |
| 66 | 66 | $this->assertEquals("Cache appended successfully", $this->cache->getMessage()); |
| 67 | 67 | $this->assertEquals($newCacheData, $this->cache->getCache($cacheKey)); |
| 68 | - } |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | 70 | |
| 71 | - public function testPutManyCacheItemsInArray() |
|
| 72 | - { |
|
| 73 | - $items = [ |
|
| 71 | + public function testPutManyCacheItemsInArray() |
|
| 72 | + { |
|
| 73 | + $items = [ |
|
| 74 | 74 | [ |
| 75 | 75 | 'cacheKey' => 'user_1_profile', |
| 76 | 76 | 'cacheData' => [ |
@@ -96,10 +96,10 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | $this->assertEquals($item['cacheData'], $this->cache->getCache($item['cacheKey'])); |
| 98 | 98 | } |
| 99 | - } |
|
| 99 | + } |
|
| 100 | 100 | |
| 101 | - public function testHasCacheFromArray() |
|
| 102 | - { |
|
| 101 | + public function testHasCacheFromArray() |
|
| 102 | + { |
|
| 103 | 103 | $cacheKey = 'test_key'; |
| 104 | 104 | $cacheData = ['name' => 'Sílvio Silva', 'role' => 'Developer']; |
| 105 | 105 | |
@@ -110,10 +110,10 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | $this->cache->has($cacheKey); |
| 112 | 112 | $this->assertTrue($this->cache->isSuccess()); |
| 113 | - } |
|
| 113 | + } |
|
| 114 | 114 | |
| 115 | 115 | public function testRenewCacheFromArray() |
| 116 | - { |
|
| 116 | + { |
|
| 117 | 117 | $cacheKey = 'expired_key'; |
| 118 | 118 | $cacheData = ['name' => 'Expired User', 'email' => '[email protected]']; |
| 119 | 119 | |
@@ -128,10 +128,10 @@ discard block |
||
| 128 | 128 | $this->cache->renewCache($cacheKey, 7200); |
| 129 | 129 | $this->assertTrue($this->cache->isSuccess()); |
| 130 | 130 | $this->assertNotEmpty($this->cache->getCache($cacheKey)); |
| 131 | - } |
|
| 131 | + } |
|
| 132 | 132 | |
| 133 | - public function testRenewCacheWithNamespaceFromArray() |
|
| 134 | - { |
|
| 133 | + public function testRenewCacheWithNamespaceFromArray() |
|
| 134 | + { |
|
| 135 | 135 | $cacheKey = 'expired_key'; |
| 136 | 136 | $namespace = 'expired_namespace'; |
| 137 | 137 | $cacheData = ['name' => 'Expired User', 'email' => '[email protected]']; |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | $this->cache->renewCache($cacheKey, 7200, $namespace); |
| 146 | 146 | $this->assertTrue($this->cache->isSuccess()); |
| 147 | 147 | $this->assertNotEmpty($this->cache->getCache($cacheKey, $namespace)); |
| 148 | - } |
|
| 148 | + } |
|
| 149 | 149 | |
| 150 | 150 | public function testClearCacheDataFromArray() |
| 151 | 151 | { |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | $this->assertEquals("Cache flushed successfully", $this->cache->getMessage()); |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | - public function test_remember_saves_and_recover_values() |
|
| 184 | + public function test_remember_saves_and_recover_values() |
|
| 185 | 185 | { |
| 186 | 186 | $this->cache->flushCache(); |
| 187 | 187 | |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | |
| 219 | - public function test_get_and_forget() |
|
| 219 | + public function test_get_and_forget() |
|
| 220 | 220 | { |
| 221 | 221 | $cacheKey = 'cache_key_test'; |
| 222 | 222 | $this->cache->putCache($cacheKey, 10); |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | $this->assertNull($noCacheData); |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | - public function test_store_if_not_present_with_add_function() |
|
| 240 | + public function test_store_if_not_present_with_add_function() |
|
| 241 | 241 | { |
| 242 | 242 | $existentKey = 'cache_key_test'; |
| 243 | 243 | |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | - public function test_increment_function() { |
|
| 264 | + public function test_increment_function() { |
|
| 265 | 265 | |
| 266 | 266 | $cacheKey = 'test_increment'; |
| 267 | 267 | $cacheData = 2025; |
@@ -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; |
@@ -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; |
@@ -11,11 +11,11 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | class OptionBuilder |
| 13 | 13 | { |
| 14 | - /** |
|
| 15 | - * @return FileOptionBuilder |
|
| 16 | - */ |
|
| 17 | - public static function forFile() |
|
| 18 | - { |
|
| 14 | + /** |
|
| 15 | + * @return FileOptionBuilder |
|
| 16 | + */ |
|
| 17 | + public static function forFile() |
|
| 18 | + { |
|
| 19 | 19 | return new FileOptionBuilder(); |
| 20 | - } |
|
| 20 | + } |
|
| 21 | 21 | } |
@@ -65,8 +65,8 @@ discard block |
||
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
| 68 | - * @return Cacheer |
|
| 69 | - */ |
|
| 68 | + * @return Cacheer |
|
| 69 | + */ |
|
| 70 | 70 | public function useArrayDriver() |
| 71 | 71 | { |
| 72 | 72 | $this->cacheer->cacheStore = new ArrayCacheStore($this->logPath); |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | /** |
| 77 | 77 | * @return Cacheer |
| 78 | - */ |
|
| 78 | + */ |
|
| 79 | 79 | public function useDefaultDriver() |
| 80 | 80 | { |
| 81 | 81 | if (!isset($this->cacheer->options['cacheDir'])) { |
@@ -92,14 +92,14 @@ discard block |
||
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | /** |
| 95 | - * @param mixed $dirName |
|
| 96 | - * @return bool |
|
| 97 | - */ |
|
| 95 | + * @param mixed $dirName |
|
| 96 | + * @return bool |
|
| 97 | + */ |
|
| 98 | 98 | private function isDir(mixed $dirName) |
| 99 | 99 | { |
| 100 | - if (is_dir($dirName)) { |
|
| 101 | - return true; |
|
| 102 | - } |
|
| 103 | - return mkdir($dirName, 0755, true); |
|
| 100 | + if (is_dir($dirName)) { |
|
| 101 | + return true; |
|
| 102 | + } |
|
| 103 | + return mkdir($dirName, 0755, true); |
|
| 104 | 104 | } |
| 105 | 105 | } |
@@ -14,9 +14,9 @@ discard block |
||
| 14 | 14 | { |
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | - * @param string $expiration |
|
| 18 | - * @return int |
|
| 19 | - */ |
|
| 17 | + * @param string $expiration |
|
| 18 | + * @return int |
|
| 19 | + */ |
|
| 20 | 20 | public static function convertExpirationToSeconds(string $expiration) |
| 21 | 21 | { |
| 22 | 22 | $units = [ |
@@ -58,10 +58,10 @@ discard block |
||
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
| 61 | - * @param string|int $ttl |
|
| 62 | - * @param int $defaultTTL |
|
| 63 | - * @return mixed |
|
| 64 | - */ |
|
| 61 | + * @param string|int $ttl |
|
| 62 | + * @param int $defaultTTL |
|
| 63 | + * @return mixed |
|
| 64 | + */ |
|
| 65 | 65 | public static function ttl($ttl = null, ?int $defaultTTL = null) { |
| 66 | 66 | if ($ttl) { |
| 67 | 67 | $ttl = is_string($ttl) ? self::convertExpirationToSeconds($ttl) : $ttl; |
@@ -71,13 +71,13 @@ discard block |
||
| 71 | 71 | return $ttl; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - /** |
|
| 75 | - * @param mixed $currentCacheData |
|
| 76 | - * @param mixed $cacheData |
|
| 77 | - * @return array |
|
| 78 | - */ |
|
| 79 | - public static function arrayIdentifier(mixed $currentCacheData, mixed $cacheData) |
|
| 80 | - { |
|
| 74 | + /** |
|
| 75 | + * @param mixed $currentCacheData |
|
| 76 | + * @param mixed $cacheData |
|
| 77 | + * @return array |
|
| 78 | + */ |
|
| 79 | + public static function arrayIdentifier(mixed $currentCacheData, mixed $cacheData) |
|
| 80 | + { |
|
| 81 | 81 | return CacheerHelper::arrayIdentifier($currentCacheData, $cacheData); |
| 82 | - } |
|
| 82 | + } |
|
| 83 | 83 | } |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | */ |
| 59 | 59 | public function toJson(int $options = 0) |
| 60 | 60 | { |
| 61 | - return parent::toJson($options); |
|
| 61 | + return parent::toJson($options); |
|
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | 64 | |
@@ -7,39 +7,39 @@ discard block |
||
| 7 | 7 | class CacheDatabaseException extends BaseException |
| 8 | 8 | { |
| 9 | 9 | |
| 10 | - /** @param string $before */ |
|
| 11 | - private static string $before = "<Database Cache Store Exception>"; |
|
| 10 | + /** @param string $before */ |
|
| 11 | + private static string $before = "<Database Cache Store Exception>"; |
|
| 12 | 12 | |
| 13 | - /** |
|
| 14 | - * @param string $message |
|
| 15 | - * @param int $code |
|
| 16 | - * @param Exception|null $previous |
|
| 17 | - * @param array $details |
|
| 18 | - * @return self |
|
| 19 | - */ |
|
| 20 | - public static function create(string $message = "", int $code = 0, ?Exception $previous = null, array $details = []) |
|
| 21 | - { |
|
| 13 | + /** |
|
| 14 | + * @param string $message |
|
| 15 | + * @param int $code |
|
| 16 | + * @param Exception|null $previous |
|
| 17 | + * @param array $details |
|
| 18 | + * @return self |
|
| 19 | + */ |
|
| 20 | + public static function create(string $message = "", int $code = 0, ?Exception $previous = null, array $details = []) |
|
| 21 | + { |
|
| 22 | 22 | return new self(self::getBefore() . ": " .$message, $code, $previous, $details); |
| 23 | - } |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * @return string |
|
| 28 | - */ |
|
| 29 | - public static function getBefore(): string |
|
| 30 | - { |
|
| 26 | + /** |
|
| 27 | + * @return string |
|
| 28 | + */ |
|
| 29 | + public static function getBefore(): string |
|
| 30 | + { |
|
| 31 | 31 | return self::$before; |
| 32 | - } |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * @return void |
|
| 36 | - */ |
|
| 37 | - public static function setBefore(string $text): void |
|
| 38 | - { |
|
| 34 | + /** |
|
| 35 | + * @return void |
|
| 36 | + */ |
|
| 37 | + public static function setBefore(string $text): void |
|
| 38 | + { |
|
| 39 | 39 | self::$before = $text; |
| 40 | - } |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - /* |
|
| 42 | + /* |
|
| 43 | 43 | * @return array |
| 44 | 44 | */ |
| 45 | 45 | public function toArray() |
@@ -61,6 +61,6 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | public function toJson(int $options = 0) |
| 63 | 63 | { |
| 64 | - return parent::toJson($options); |
|
| 64 | + return parent::toJson($options); |
|
| 65 | 65 | } |
| 66 | 66 | } |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | public static function create(string $message = "", int $code = 0, ?Exception $previous = null, array $details = []) |
| 21 | 21 | { |
| 22 | - return new self(self::getBefore() . ": " .$message, $code, $previous, $details); |
|
| 22 | + return new self(self::getBefore() . ": " . $message, $code, $previous, $details); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | |