@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | public function __construct(?string $path = null) |
| 27 | 27 | { |
| 28 | 28 | if (null === $path) { |
| 29 | - $path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'blitz-php' . DIRECTORY_SEPARATOR . 'cache'; |
|
| 29 | + $path = sys_get_temp_dir().DIRECTORY_SEPARATOR.'blitz-php'.DIRECTORY_SEPARATOR.'cache'; |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | $this->path = rtrim($path, '/\\'); |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | /** |
| 48 | 48 | * {@inheritDoc} |
| 49 | 49 | */ |
| 50 | - public function init(array $config = []): bool |
|
| 50 | + public function init(array $config = [ ]): bool |
|
| 51 | 51 | { |
| 52 | 52 | return true; |
| 53 | 53 | } |
@@ -57,21 +57,21 @@ discard block |
||
| 57 | 57 | * |
| 58 | 58 | * @param array|bool|float|int|object|string|null $value |
| 59 | 59 | */ |
| 60 | - public function set(string $key, mixed $value, null|DateInterval|int $ttl = null): bool |
|
| 60 | + public function set(string $key, mixed $value, null | DateInterval | int $ttl = null): bool |
|
| 61 | 61 | { |
| 62 | 62 | $value = var_export($value, true); |
| 63 | 63 | |
| 64 | 64 | // Écrire d'abord dans le fichier temporaire pour assurer l'atomicité |
| 65 | - $tmp = $this->path . "/{$key}." . uniqid('', true) . '.tmp'; |
|
| 66 | - file_put_contents($tmp, '<?php return ' . $value . ';', LOCK_EX); |
|
| 65 | + $tmp = $this->path."/{$key}.".uniqid('', true).'.tmp'; |
|
| 66 | + file_put_contents($tmp, '<?php return '.$value.';', LOCK_EX); |
|
| 67 | 67 | |
| 68 | - return rename($tmp, $this->path . "/{$key}"); |
|
| 68 | + return rename($tmp, $this->path."/{$key}"); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
| 72 | 72 | * {@inheritDoc} |
| 73 | 73 | */ |
| 74 | - public function setMultiple(iterable $values, null|DateInterval|int $ttl = null): bool |
|
| 74 | + public function setMultiple(iterable $values, null | DateInterval | int $ttl = null): bool |
|
| 75 | 75 | { |
| 76 | 76 | return true; |
| 77 | 77 | } |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | public function get(string $key, mixed $default = null): mixed |
| 85 | 85 | { |
| 86 | - return @include $this->path . "/{$key}"; |
|
| 86 | + return @include $this->path."/{$key}"; |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | /** |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | public function getMultiple(iterable $keys, mixed $default = null): iterable |
| 93 | 93 | { |
| 94 | - return []; |
|
| 94 | + return [ ]; |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /** |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | */ |
| 116 | 116 | public function delete(string $key): bool |
| 117 | 117 | { |
| 118 | - return @unlink($this->path . "/{$key}"); |
|
| 118 | + return @unlink($this->path."/{$key}"); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | /** |
@@ -131,11 +131,11 @@ discard block |
||
| 131 | 131 | */ |
| 132 | 132 | public function clear(): bool |
| 133 | 133 | { |
| 134 | - if (! is_dir($this->path)) { |
|
| 134 | + if (!is_dir($this->path)) { |
|
| 135 | 135 | return false; |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - $files = glob($this->path . '/*'); |
|
| 138 | + $files = glob($this->path.'/*'); |
|
| 139 | 139 | foreach ($files as $file) { |
| 140 | 140 | if (is_file($file)) { |
| 141 | 141 | unlink($file); |