@@ -63,10 +63,10 @@ |
||
63 | 63 | */ |
64 | 64 | class LocalStorage extends AbstractStorage |
65 | 65 | { |
66 | - /** |
|
67 | - * The directory to use to save cache files |
|
68 | - * @var DirectoryInterface |
|
69 | - */ |
|
66 | + /** |
|
67 | + * The directory to use to save cache files |
|
68 | + * @var DirectoryInterface |
|
69 | + */ |
|
70 | 70 | protected DirectoryInterface $directory; |
71 | 71 | |
72 | 72 | /** |
@@ -60,8 +60,7 @@ discard block |
||
60 | 60 | * @class LocalStorage |
61 | 61 | * @package Platine\Cache\Storage |
62 | 62 | */ |
63 | -class LocalStorage extends AbstractStorage |
|
64 | -{ |
|
63 | +class LocalStorage extends AbstractStorage { |
|
65 | 64 | /** |
66 | 65 | * The directory to use to save cache files |
67 | 66 | * @var DirectoryInterface |
@@ -79,8 +78,7 @@ discard block |
||
79 | 78 | * |
80 | 79 | * {@inheritdoc} |
81 | 80 | */ |
82 | - public function __construct(Filesystem $filesystem, ?Configuration $config = null) |
|
83 | - { |
|
81 | + public function __construct(Filesystem $filesystem, ?Configuration $config = null) { |
|
84 | 82 | parent::__construct($config); |
85 | 83 | |
86 | 84 | $this->filesystem = $filesystem; |
@@ -87,7 +87,7 @@ |
||
87 | 87 | /** |
88 | 88 | * {@inheritdoc} |
89 | 89 | */ |
90 | - public function set(string $key, mixed $value, int|DateInterval|null $ttl = null): bool |
|
90 | + public function set(string $key, mixed $value, int | DateInterval | null $ttl = null): bool |
|
91 | 91 | { |
92 | 92 | if ($ttl === null) { |
93 | 93 | $ttl = $this->config->get('ttl'); |
@@ -52,8 +52,7 @@ |
||
52 | 52 | * Class Configuration |
53 | 53 | * @package Platine\Cache |
54 | 54 | */ |
55 | -class Configuration extends AbstractConfiguration |
|
56 | -{ |
|
55 | +class Configuration extends AbstractConfiguration { |
|
57 | 56 | /** |
58 | 57 | * {@inheritdoc} |
59 | 58 | */ |
@@ -122,7 +122,7 @@ |
||
122 | 122 | /** |
123 | 123 | * {@inheritdoc} |
124 | 124 | */ |
125 | - public function set(string $key, mixed $value, int|DateInterval|null $ttl = null): bool |
|
125 | + public function set(string $key, mixed $value, int | DateInterval | null $ttl = null): bool |
|
126 | 126 | { |
127 | 127 | $this->validateKey($key); |
128 | 128 |
@@ -55,8 +55,7 @@ discard block |
||
55 | 55 | * @class Cache |
56 | 56 | * @package Platine\Cache |
57 | 57 | */ |
58 | -class Cache implements CacheInterface |
|
59 | -{ |
|
58 | +class Cache implements CacheInterface { |
|
60 | 59 | /** |
61 | 60 | * The cache storage to use |
62 | 61 | * @var StorageInterface |
@@ -67,8 +66,7 @@ discard block |
||
67 | 66 | * Create new instance |
68 | 67 | * @param StorageInterface|null $storage the cache storage to use |
69 | 68 | */ |
70 | - public function __construct(?StorageInterface $storage = null) |
|
71 | - { |
|
69 | + public function __construct(?StorageInterface $storage = null) { |
|
72 | 70 | $this->storage = $storage ?? new NullStorage(); |
73 | 71 | } |
74 | 72 |
@@ -38,6 +38,5 @@ |
||
38 | 38 | * @class CacheException |
39 | 39 | * @package Platine\Cache\Exception |
40 | 40 | */ |
41 | -class CacheException extends Exception |
|
42 | -{ |
|
41 | +class CacheException extends Exception { |
|
43 | 42 | } |
@@ -36,6 +36,5 @@ |
||
36 | 36 | * @class FilesystemStorageException |
37 | 37 | * @package Platine\Cache\Exception |
38 | 38 | */ |
39 | -class FilesystemStorageException extends CacheException |
|
40 | -{ |
|
39 | +class FilesystemStorageException extends CacheException { |
|
41 | 40 | } |
@@ -74,7 +74,7 @@ |
||
74 | 74 | return false; |
75 | 75 | } |
76 | 76 | |
77 | - public function set(string $key, mixed $value, int|DateInterval|null $ttl = null): bool |
|
77 | + public function set(string $key, mixed $value, int | DateInterval | null $ttl = null): bool |
|
78 | 78 | { |
79 | 79 | return false; |
80 | 80 | } |
@@ -52,8 +52,7 @@ |
||
52 | 52 | * @class NullStorage |
53 | 53 | * @package Platine\Cache\Storage |
54 | 54 | */ |
55 | -class NullStorage implements StorageInterface |
|
56 | -{ |
|
55 | +class NullStorage implements StorageInterface { |
|
57 | 56 | public function clear(): bool |
58 | 57 | { |
59 | 58 | return false; |
@@ -81,7 +81,7 @@ |
||
81 | 81 | * @throws CacheException |
82 | 82 | * MUST be thrown if the $key string is not a legal value. |
83 | 83 | */ |
84 | - public function set(string $key, mixed $value, int|DateInterval|null $ttl = null): bool; |
|
84 | + public function set(string $key, mixed $value, int | DateInterval | null $ttl = null): bool; |
|
85 | 85 | |
86 | 86 | /** |
87 | 87 | * Delete an item from the cache by its unique key. |
@@ -53,8 +53,7 @@ |
||
53 | 53 | * @class StorageInterface |
54 | 54 | * @package Platine\Cache\Storage |
55 | 55 | */ |
56 | -interface StorageInterface |
|
57 | -{ |
|
56 | +interface StorageInterface { |
|
58 | 57 | /** |
59 | 58 | * Fetches a value from the cache. |
60 | 59 | * |
@@ -54,8 +54,7 @@ discard block |
||
54 | 54 | * @class AbstractStorage |
55 | 55 | * @package Platine\Cache\Storage |
56 | 56 | */ |
57 | -abstract class AbstractStorage implements StorageInterface |
|
58 | -{ |
|
57 | +abstract class AbstractStorage implements StorageInterface { |
|
59 | 58 | /** |
60 | 59 | * The cache configuration |
61 | 60 | * @var Configuration |
@@ -66,8 +65,7 @@ discard block |
||
66 | 65 | * Create new instance |
67 | 66 | * @param Configuration|null $config |
68 | 67 | */ |
69 | - public function __construct(?Configuration $config = null) |
|
70 | - { |
|
68 | + public function __construct(?Configuration $config = null) { |
|
71 | 69 | $this->config = $config ?? new Configuration([]); |
72 | 70 | } |
73 | 71 |
@@ -87,7 +87,7 @@ |
||
87 | 87 | /** |
88 | 88 | * {@inheritdoc} |
89 | 89 | */ |
90 | - public function set(string $key, mixed $value, int|DateInterval|null $ttl = null): bool |
|
90 | + public function set(string $key, mixed $value, int | DateInterval | null $ttl = null): bool |
|
91 | 91 | { |
92 | 92 | if ($ttl === null) { |
93 | 93 | $ttl = $this->config->get('ttl'); |
@@ -55,15 +55,13 @@ |
||
55 | 55 | * @class ApcuStorage |
56 | 56 | * @package Platine\Cache\Storage |
57 | 57 | */ |
58 | -class ApcuStorage extends AbstractStorage |
|
59 | -{ |
|
58 | +class ApcuStorage extends AbstractStorage { |
|
60 | 59 | /** |
61 | 60 | * {@inheritdoc} |
62 | 61 | * |
63 | 62 | * Create new instance |
64 | 63 | */ |
65 | - public function __construct(?Configuration $config = null) |
|
66 | - { |
|
64 | + public function __construct(?Configuration $config = null) { |
|
67 | 65 | if ((!extension_loaded('apcu')) || !((bool) ini_get('apc.enabled'))) { |
68 | 66 | throw new CacheException('The cache for APCu driver is not available.' |
69 | 67 | . ' Check if APCu extension is loaded and enabled.'); |