@@ -46,8 +46,7 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | namespace Platine\Cache; |
| 48 | 48 | |
| 49 | -class Cache |
|
| 50 | -{ |
|
| 49 | +class Cache { |
|
| 51 | 50 | |
| 52 | 51 | /** |
| 53 | 52 | * The cache driver to use |
@@ -59,8 +58,7 @@ discard block |
||
| 59 | 58 | * Create new instance |
| 60 | 59 | * @param CacheInterface $handler the cache driver to use |
| 61 | 60 | */ |
| 62 | - public function __construct(CacheInterface $handler) |
|
| 63 | - { |
|
| 61 | + public function __construct(CacheInterface $handler) { |
|
| 64 | 62 | $this->handler = $handler; |
| 65 | 63 | } |
| 66 | 64 | |
@@ -49,8 +49,7 @@ discard block |
||
| 49 | 49 | use Platine\Cache\Exception\FileCacheException; |
| 50 | 50 | use Platine\Cache\Exception\CacheException; |
| 51 | 51 | |
| 52 | -class FileCache extends AbstractCache |
|
| 53 | -{ |
|
| 52 | +class FileCache extends AbstractCache { |
|
| 54 | 53 | |
| 55 | 54 | /** |
| 56 | 55 | * The path to use to save cache files |
@@ -72,8 +71,7 @@ discard block |
||
| 72 | 71 | * @param string $savePath the path to directory to save cache files |
| 73 | 72 | * @param string $filePrefix the cache file prefix |
| 74 | 73 | */ |
| 75 | - public function __construct(string $savePath = '', string $filePrefix = 'cache_', int $defaultTtl = 600) |
|
| 76 | - { |
|
| 74 | + public function __construct(string $savePath = '', string $filePrefix = 'cache_', int $defaultTtl = 600) { |
|
| 77 | 75 | parent::__construct($defaultTtl); |
| 78 | 76 | |
| 79 | 77 | if (empty($savePath)) { |
@@ -87,8 +85,7 @@ discard block |
||
| 87 | 85 | /** |
| 88 | 86 | * {@inheritdoc} |
| 89 | 87 | */ |
| 90 | - public function get(string $key, $default = null) |
|
| 91 | - { |
|
| 88 | + public function get(string $key, $default = null) { |
|
| 92 | 89 | $this->validateKey($key); |
| 93 | 90 | |
| 94 | 91 | $path = $this->savePath . $this->getFileName($key); |
@@ -49,8 +49,7 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | use Platine\Cache\Exception\CacheException; |
| 51 | 51 | |
| 52 | -abstract class AbstractCache implements CacheInterface |
|
| 53 | -{ |
|
| 52 | +abstract class AbstractCache implements CacheInterface { |
|
| 54 | 53 | |
| 55 | 54 | /** |
| 56 | 55 | * The default time to live for cache data |
@@ -63,8 +62,7 @@ discard block |
||
| 63 | 62 | * |
| 64 | 63 | * @param int $defaultTtl the value of default time to live to use |
| 65 | 64 | */ |
| 66 | - public function __construct(int $defaultTtl = 600) |
|
| 67 | - { |
|
| 65 | + public function __construct(int $defaultTtl = 600) { |
|
| 68 | 66 | $this->defaultTtl = $defaultTtl; |
| 69 | 67 | } |
| 70 | 68 | |
@@ -32,7 +32,6 @@ |
||
| 32 | 32 | |
| 33 | 33 | namespace Platine\Cache\Exception; |
| 34 | 34 | |
| 35 | -class FileCacheException extends CacheException |
|
| 36 | -{ |
|
| 35 | +class FileCacheException extends CacheException { |
|
| 37 | 36 | |
| 38 | 37 | } |
@@ -32,7 +32,6 @@ |
||
| 32 | 32 | |
| 33 | 33 | namespace Platine\Cache\Exception; |
| 34 | 34 | |
| 35 | -class CacheException extends \Exception |
|
| 36 | -{ |
|
| 35 | +class CacheException extends \Exception { |
|
| 37 | 36 | |
| 38 | 37 | } |
@@ -46,8 +46,7 @@ |
||
| 46 | 46 | |
| 47 | 47 | namespace Platine\Cache; |
| 48 | 48 | |
| 49 | -interface CacheInterface |
|
| 50 | -{ |
|
| 49 | +interface CacheInterface { |
|
| 51 | 50 | |
| 52 | 51 | /** |
| 53 | 52 | * Fetches a value from the cache. |
@@ -48,16 +48,14 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | use Platine\Cache\Exception\CacheException; |
| 50 | 50 | |
| 51 | -class ApcuCache extends AbstractCache |
|
| 52 | -{ |
|
| 51 | +class ApcuCache extends AbstractCache { |
|
| 53 | 52 | |
| 54 | 53 | /** |
| 55 | 54 | * {@inheritdoc} |
| 56 | 55 | * |
| 57 | 56 | * Create new instance |
| 58 | 57 | */ |
| 59 | - public function __construct(int $defaultTtl = 600) |
|
| 60 | - { |
|
| 58 | + public function __construct(int $defaultTtl = 600) { |
|
| 61 | 59 | if ((!extension_loaded('apcu')) || !((bool) ini_get('apc.enabled'))) { |
| 62 | 60 | throw new CacheException('The cache for APCu driver is not available.' |
| 63 | 61 | . ' Check if APCu extension is loaded and enabled.'); |
@@ -69,8 +67,7 @@ discard block |
||
| 69 | 67 | /** |
| 70 | 68 | * {@inheritdoc} |
| 71 | 69 | */ |
| 72 | - public function get(string $key, $default = null) |
|
| 73 | - { |
|
| 70 | + public function get(string $key, $default = null) { |
|
| 74 | 71 | $this->validateKey($key); |
| 75 | 72 | |
| 76 | 73 | $success = false; |