@@ -54,8 +54,7 @@ discard block |
||
54 | 54 | * Class Cache |
55 | 55 | * @package Platine\Cache |
56 | 56 | */ |
57 | -class Cache implements CacheInterface |
|
58 | -{ |
|
57 | +class Cache implements CacheInterface { |
|
59 | 58 | /** |
60 | 59 | * The cache storage to use |
61 | 60 | * @var StorageInterface |
@@ -66,8 +65,7 @@ discard block |
||
66 | 65 | * Create new instance |
67 | 66 | * @param StorageInterface|null $storage the cache storage to use |
68 | 67 | */ |
69 | - public function __construct(?StorageInterface $storage = null) |
|
70 | - { |
|
68 | + public function __construct(?StorageInterface $storage = null) { |
|
71 | 69 | $this->storage = $storage ?? new NullStorage(); |
72 | 70 | } |
73 | 71 | |
@@ -101,8 +99,7 @@ discard block |
||
101 | 99 | /** |
102 | 100 | * {@inheritdoc} |
103 | 101 | */ |
104 | - public function get(string $key, $default = null) |
|
105 | - { |
|
102 | + public function get(string $key, $default = null) { |
|
106 | 103 | $this->validateKey($key); |
107 | 104 | |
108 | 105 | return $this->storage->get($key, $default); |
@@ -53,8 +53,7 @@ |
||
53 | 53 | * Class CacheInterface |
54 | 54 | * @package Platine\Cache |
55 | 55 | */ |
56 | -interface CacheInterface |
|
57 | -{ |
|
56 | +interface CacheInterface { |
|
58 | 57 | /** |
59 | 58 | * Fetches a value from the cache. |
60 | 59 | * |
@@ -50,8 +50,7 @@ discard block |
||
50 | 50 | * Class NullStorage |
51 | 51 | * @package Platine\Cache\Storage |
52 | 52 | */ |
53 | -class NullStorage implements StorageInterface |
|
54 | -{ |
|
53 | +class NullStorage implements StorageInterface { |
|
55 | 54 | public function clear(): bool |
56 | 55 | { |
57 | 56 | return false; |
@@ -62,8 +61,7 @@ discard block |
||
62 | 61 | return false; |
63 | 62 | } |
64 | 63 | |
65 | - public function get(string $key, $default = null) |
|
66 | - { |
|
64 | + public function get(string $key, $default = null) { |
|
67 | 65 | return false; |
68 | 66 | } |
69 | 67 |
@@ -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 | * |
@@ -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 | /** |
@@ -61,8 +61,7 @@ discard block |
||
61 | 61 | * Class LocalStorage |
62 | 62 | * @package Platine\Cache\Storage |
63 | 63 | */ |
64 | -class LocalStorage extends AbstractStorage |
|
65 | -{ |
|
64 | +class LocalStorage extends AbstractStorage { |
|
66 | 65 | /** |
67 | 66 | * The directory to use to save cache files |
68 | 67 | * @var DirectoryInterface |
@@ -80,8 +79,7 @@ discard block |
||
80 | 79 | * |
81 | 80 | * {@inheritdoc} |
82 | 81 | */ |
83 | - public function __construct(Filesystem $filesystem, ?Configuration $config = null) |
|
84 | - { |
|
82 | + public function __construct(Filesystem $filesystem, ?Configuration $config = null) { |
|
85 | 83 | parent::__construct($config); |
86 | 84 | |
87 | 85 | $this->filesystem = $filesystem; |
@@ -102,8 +100,7 @@ discard block |
||
102 | 100 | /** |
103 | 101 | * {@inheritdoc} |
104 | 102 | */ |
105 | - public function get(string $key, $default = null) |
|
106 | - { |
|
103 | + public function get(string $key, $default = null) { |
|
107 | 104 | $file = $this->getCacheFile($key); |
108 | 105 | |
109 | 106 | if (!$file->exists() || $file->getMtime() <= time()) { |
@@ -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 |
@@ -55,15 +55,13 @@ discard block |
||
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.'); |
@@ -75,8 +73,7 @@ discard block |
||
75 | 73 | /** |
76 | 74 | * {@inheritdoc} |
77 | 75 | */ |
78 | - public function get(string $key, $default = null) |
|
79 | - { |
|
76 | + public function get(string $key, $default = null) { |
|
80 | 77 | $success = false; |
81 | 78 | /** @var mixed */ |
82 | 79 | $data = apcu_fetch($key, $success); |
@@ -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 | */ |