@@ -10,9 +10,9 @@ discard block |
||
| 10 | 10 | { |
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | - * @param string $dir |
|
| 14 | - * @return void |
|
| 15 | - */ |
|
| 13 | + * @param string $dir |
|
| 14 | + * @return void |
|
| 15 | + */ |
|
| 16 | 16 | public function createDirectory(string $dir) |
| 17 | 17 | { |
| 18 | 18 | if ((!file_exists($dir) || !is_dir($dir)) && !mkdir($dir, 0777, true)) { |
@@ -21,10 +21,10 @@ discard block |
||
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | - * @param string $filename |
|
| 25 | - * @param string $data |
|
| 26 | - * @return void |
|
| 27 | - */ |
|
| 24 | + * @param string $filename |
|
| 25 | + * @param string $data |
|
| 26 | + * @return void |
|
| 27 | + */ |
|
| 28 | 28 | public function writeFile(string $filename, string $data) |
| 29 | 29 | { |
| 30 | 30 | if (!@file_put_contents($filename, $data, LOCK_EX)) { |
@@ -33,9 +33,9 @@ discard block |
||
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | - * @param string $filename |
|
| 37 | - * @return string |
|
| 38 | - */ |
|
| 36 | + * @param string $filename |
|
| 37 | + * @return string |
|
| 38 | + */ |
|
| 39 | 39 | public function readFile(string $filename) |
| 40 | 40 | { |
| 41 | 41 | if (!$this->fileExists($filename)) { |
@@ -45,18 +45,18 @@ discard block |
||
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | - * @param string $filename |
|
| 49 | - * @return bool |
|
| 50 | - */ |
|
| 48 | + * @param string $filename |
|
| 49 | + * @return bool |
|
| 50 | + */ |
|
| 51 | 51 | public function fileExists(string $filename) |
| 52 | 52 | { |
| 53 | 53 | return file_exists($filename); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |
| 57 | - * @param string $filename |
|
| 58 | - * @return void |
|
| 59 | - */ |
|
| 57 | + * @param string $filename |
|
| 58 | + * @return void |
|
| 59 | + */ |
|
| 60 | 60 | public function removeFile(string $filename) |
| 61 | 61 | { |
| 62 | 62 | if (file_exists($filename)) { |
@@ -65,9 +65,9 @@ discard block |
||
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
| 68 | - * @param string $dir |
|
| 69 | - * @return void |
|
| 70 | - */ |
|
| 68 | + * @param string $dir |
|
| 69 | + * @return void |
|
| 70 | + */ |
|
| 71 | 71 | public function clearDirectory(string $dir) |
| 72 | 72 | { |
| 73 | 73 | $iterator = new RecursiveIteratorIterator( |
@@ -81,9 +81,9 @@ discard block |
||
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | /** |
| 84 | - * @param mixed $data |
|
| 85 | - * @param bool $serealize |
|
| 86 | - */ |
|
| 84 | + * @param mixed $data |
|
| 85 | + * @param bool $serealize |
|
| 86 | + */ |
|
| 87 | 87 | public function serialize(mixed $data, bool $serealize = true) |
| 88 | 88 | { |
| 89 | 89 | if($serealize) { |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | * @param string|int $ttl |
| 73 | 73 | * @return string|null |
| 74 | 74 | */ |
| 75 | - public function getCache(string $cacheKey, string $namespace = '', string|int $ttl = 3600) |
|
| 75 | + public function getCache(string $cacheKey, string $namespace = '', string | int $ttl = 3600) |
|
| 76 | 76 | { |
| 77 | 77 | |
| 78 | 78 | $ttl = CacheFileHelper::ttl($ttl, $this->defaultTTL); |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | * @param string|int $ttl |
| 98 | 98 | * @return void |
| 99 | 99 | */ |
| 100 | - public function putCache(string $cacheKey, mixed $cacheData, string $namespace = '', string|int $ttl = 3600) |
|
| 100 | + public function putCache(string $cacheKey, mixed $cacheData, string $namespace = '', string | int $ttl = 3600) |
|
| 101 | 101 | { |
| 102 | 102 | $cacheFile = $this->buildCacheFilePath($cacheKey, $namespace); |
| 103 | 103 | $data = $this->fileManager->serialize($cacheData); |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | * @param string $namespace |
| 172 | 172 | * @return void |
| 173 | 173 | */ |
| 174 | - public function renewCache(string $cacheKey, string|int $ttl, string $namespace = '') |
|
| 174 | + public function renewCache(string $cacheKey, string | int $ttl, string $namespace = '') |
|
| 175 | 175 | { |
| 176 | 176 | $cacheData = $this->getCache($cacheKey, $namespace); |
| 177 | 177 | if ($cacheData) { |
@@ -278,12 +278,12 @@ discard block |
||
| 278 | 278 | { |
| 279 | 279 | $flushAfterSeconds = CacheFileHelper::convertExpirationToSeconds($flushAfter); |
| 280 | 280 | |
| 281 | - if(!$this->fileManager->fileExists($this->lastFlushTimeFile)) { |
|
| 281 | + if (!$this->fileManager->fileExists($this->lastFlushTimeFile)) { |
|
| 282 | 282 | $this->fileManager->writeFile($this->lastFlushTimeFile, time()); |
| 283 | 283 | return; |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | - $lastFlushTime = (int) $this->fileManager->readFile($this->lastFlushTimeFile); |
|
| 286 | + $lastFlushTime = (int)$this->fileManager->readFile($this->lastFlushTimeFile); |
|
| 287 | 287 | |
| 288 | 288 | if ((time() - $lastFlushTime) >= $flushAfterSeconds) { |
| 289 | 289 | $this->flushCache(); |