@@ -11,7 +11,7 @@ |
||
11 | 11 | * @author Georges.L (Geolim4) <[email protected]> |
12 | 12 | * |
13 | 13 | */ |
14 | -declare(strict_types=1); |
|
14 | +declare(strict_types = 1); |
|
15 | 15 | |
16 | 16 | namespace Phpfastcache\Drivers\Leveldb; |
17 | 17 |
@@ -19,7 +19,7 @@ |
||
19 | 19 | use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface; |
20 | 20 | use Phpfastcache\Drivers\Leveldb\Driver as LeveldbDriver; |
21 | 21 | use Phpfastcache\Exceptions\{ |
22 | - PhpfastcacheInvalidArgumentException, PhpfastcacheInvalidArgumentTypeException |
|
22 | + PhpfastcacheInvalidArgumentException, PhpfastcacheInvalidArgumentTypeException |
|
23 | 23 | }; |
24 | 24 | |
25 | 25 | /** |
@@ -14,4 +14,4 @@ |
||
14 | 14 | * @package phpFastCache\Config |
15 | 15 | * @see ConfigurationOption |
16 | 16 | */ |
17 | -class Config extends ConfigurationOption{} |
|
18 | 17 | \ No newline at end of file |
18 | +class Config extends ConfigurationOption {} |
|
19 | 19 | \ No newline at end of file |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | |
105 | 105 | if(array_key_exists($property, $array)){ |
106 | 106 | $this->$property = &$array[ $property ]; |
107 | - }else{ |
|
107 | + } else{ |
|
108 | 108 | $array[ $property ] = &$this->$property; |
109 | 109 | } |
110 | 110 | } |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | $value = $this->{lcfirst(substr($method, 3))}; |
123 | 123 | $this->{$method}($value); |
124 | - }catch(\TypeError $e){ |
|
124 | + } catch(\TypeError $e){ |
|
125 | 125 | $typeHintGot = \is_object($value) ? \get_class($value) : \gettype($value); |
126 | 126 | $reflectionMethod = new \ReflectionMethod($this, $method); |
127 | 127 | $parameter = $reflectionMethod->getParameters()[0] ?? null; |
@@ -94,9 +94,9 @@ discard block |
||
94 | 94 | */ |
95 | 95 | if(array_diff_key($array, get_object_vars($this))){ |
96 | 96 | throw new PhpfastcacheInvalidConfigurationException(sprintf( |
97 | - 'Invalid option(s) for the config %s: %s', |
|
98 | - static::class, |
|
99 | - implode(', ', array_keys(array_diff_key($array, get_object_vars($this)))) |
|
97 | + 'Invalid option(s) for the config %s: %s', |
|
98 | + static::class, |
|
99 | + implode(', ', array_keys(array_diff_key($array, get_object_vars($this)))) |
|
100 | 100 | )); |
101 | 101 | } |
102 | 102 | |
@@ -128,10 +128,10 @@ discard block |
||
128 | 128 | $typeHintExpected = ($parameter instanceof \ReflectionParameter ? ($parameter->getType() === 'object' ? $parameter->getClass() : $parameter->getType()) : 'Unknown type'); |
129 | 129 | |
130 | 130 | throw new PhpfastcacheInvalidConfigurationException(sprintf( |
131 | - 'Invalid type hint found for "%s", expected "%s" got "%s"', |
|
132 | - lcfirst(substr($method, 3)), |
|
133 | - $typeHintExpected, |
|
134 | - $typeHintGot |
|
131 | + 'Invalid type hint found for "%s", expected "%s" got "%s"', |
|
132 | + lcfirst(substr($method, 3)), |
|
133 | + $typeHintExpected, |
|
134 | + $typeHintGot |
|
135 | 135 | )); |
136 | 136 | } |
137 | 137 | } |
@@ -396,10 +396,10 @@ discard block |
||
396 | 396 | * by opening a pull request :) |
397 | 397 | */ |
398 | 398 | static $safeFileExtensions = [ |
399 | - 'txt', |
|
400 | - 'cache', |
|
401 | - 'db', |
|
402 | - 'pfc', |
|
399 | + 'txt', |
|
400 | + 'cache', |
|
401 | + 'db', |
|
402 | + 'pfc', |
|
403 | 403 | ]; |
404 | 404 | |
405 | 405 | if (\strpos($cacheFileExtension, '.') !== false) { |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | } |
408 | 408 | if (!\in_array($cacheFileExtension, $safeFileExtensions, true)) { |
409 | 409 | throw new PhpfastcacheInvalidConfigurationException( |
410 | - "{$cacheFileExtension} is not a safe extension, currently allowed extension: " . \implode(', ', $safeFileExtensions) |
|
410 | + "{$cacheFileExtension} is not a safe extension, currently allowed extension: " . \implode(', ', $safeFileExtensions) |
|
411 | 411 | ); |
412 | 412 | } |
413 | 413 |
@@ -86,33 +86,33 @@ discard block |
||
86 | 86 | public function __construct(...$args) |
87 | 87 | { |
88 | 88 | parent::__construct(...$args); |
89 | - $array =& $this->getArray(); |
|
89 | + $array = & $this->getArray(); |
|
90 | 90 | |
91 | 91 | /** |
92 | 92 | * Detect unwanted keys and throw an exception. |
93 | 93 | * No more kidding now, it's 21th century. |
94 | 94 | */ |
95 | - if(array_diff_key($array, get_object_vars($this))){ |
|
95 | + if (array_diff_key($array, get_object_vars($this))) { |
|
96 | 96 | throw new PhpfastcacheInvalidConfigurationException(sprintf( |
97 | 97 | 'Invalid option(s) for the config %s: %s', |
98 | 98 | static::class, |
99 | - implode(', ', array_keys(array_diff_key($array, get_object_vars($this)))) |
|
99 | + implode(', ', array_keys(array_diff_key($array, get_object_vars($this)))) |
|
100 | 100 | )); |
101 | 101 | } |
102 | 102 | |
103 | 103 | foreach (get_object_vars($this) as $property => $value) { |
104 | 104 | |
105 | - if(array_key_exists($property, $array)){ |
|
106 | - $this->$property = &$array[ $property ]; |
|
107 | - }else{ |
|
108 | - $array[ $property ] = &$this->$property; |
|
105 | + if (array_key_exists($property, $array)) { |
|
106 | + $this->$property = &$array[$property]; |
|
107 | + } else { |
|
108 | + $array[$property] = &$this->$property; |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | |
112 | 112 | foreach (get_class_methods($this) as $method) { |
113 | - if(strpos($method, 'set') === 0){ |
|
113 | + if (strpos($method, 'set') === 0) { |
|
114 | 114 | $value = null; |
115 | - try{ |
|
115 | + try { |
|
116 | 116 | /** |
117 | 117 | * We use property instead of getter |
118 | 118 | * because of is/get conditions and |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | $value = $this->{lcfirst(substr($method, 3))}; |
123 | 123 | $this->{$method}($value); |
124 | - }catch(\TypeError $e){ |
|
124 | + } catch (\TypeError $e) { |
|
125 | 125 | $typeHintGot = \is_object($value) ? \get_class($value) : \gettype($value); |
126 | 126 | $reflectionMethod = new \ReflectionMethod($this, $method); |
127 | 127 | $parameter = $reflectionMethod->getParameters()[0] ?? null; |
@@ -188,11 +188,11 @@ |
||
188 | 188 | $this->printSkipText('A driver could not be initialized due to missing requirement: ' . $exception->getMessage()); |
189 | 189 | }else{ |
190 | 190 | $this->printFailText(sprintf( |
191 | - 'Uncaught exception "%s" in "%s" line %d with message: "%s"', |
|
192 | - \get_class($exception), |
|
193 | - $exception->getFile(), |
|
194 | - $exception->getLine(), |
|
195 | - $exception->getMessage() |
|
191 | + 'Uncaught exception "%s" in "%s" line %d with message: "%s"', |
|
192 | + \get_class($exception), |
|
193 | + $exception->getFile(), |
|
194 | + $exception->getLine(), |
|
195 | + $exception->getMessage() |
|
196 | 196 | )); |
197 | 197 | } |
198 | 198 | $this->terminateTest(); |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @author Georges.L (Geolim4) <[email protected]> |
12 | 12 | * |
13 | 13 | */ |
14 | -declare(strict_types=1); |
|
14 | +declare(strict_types = 1); |
|
15 | 15 | |
16 | 16 | namespace Phpfastcache\Helper; |
17 | 17 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public function __construct($testName) |
37 | 37 | { |
38 | - $this->printText('[PhpFastCache CORE v' . Api::getPhpFastCacheVersion() . Api::getPhpFastCacheGitHeadHash() . ']', true); |
|
38 | + $this->printText('[PhpFastCache CORE v' . Api::getPhpFastCacheVersion() . Api::getPhpFastCacheGitHeadHash() . ']', true); |
|
39 | 39 | $this->printText('[PhpFastCache API v' . Api::getVersion() . ']', true); |
40 | 40 | $this->printText('[PHP v' . PHP_VERSION . ']', true); |
41 | 41 | $this->printText("[Begin Test: '{$testName}']"); |
@@ -184,9 +184,9 @@ discard block |
||
184 | 184 | * @param \Throwable $exception |
185 | 185 | */ |
186 | 186 | public function exceptionHandler(\Throwable $exception) { |
187 | - if($exception instanceof PhpfastcacheDriverCheckException){ |
|
187 | + if ($exception instanceof PhpfastcacheDriverCheckException) { |
|
188 | 188 | $this->printSkipText('A driver could not be initialized due to missing requirement: ' . $exception->getMessage()); |
189 | - }else{ |
|
189 | + } else { |
|
190 | 190 | $this->printFailText(sprintf( |
191 | 191 | 'Uncaught exception "%s" in "%s" line %d with message: "%s"', |
192 | 192 | \get_class($exception), |
@@ -186,7 +186,7 @@ |
||
186 | 186 | public function exceptionHandler(\Throwable $exception) { |
187 | 187 | if($exception instanceof PhpfastcacheDriverCheckException){ |
188 | 188 | $this->printSkipText('A driver could not be initialized due to missing requirement: ' . $exception->getMessage()); |
189 | - }else{ |
|
189 | + } else{ |
|
190 | 190 | $this->printFailText(sprintf( |
191 | 191 | 'Uncaught exception "%s" in "%s" line %d with message: "%s"', |
192 | 192 | \get_class($exception), |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @author Georges.L (Geolim4) <[email protected]> |
12 | 12 | * |
13 | 13 | */ |
14 | -declare(strict_types=1); |
|
14 | +declare(strict_types = 1); |
|
15 | 15 | |
16 | 16 | namespace Phpfastcache\Helper; |
17 | 17 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | if (!$cacheItem->isHit()) { |
51 | 51 | $cacheItem->set($callback()); |
52 | - if($expiresAfter){ |
|
52 | + if ($expiresAfter) { |
|
53 | 53 | $cacheItem->expiresAfter($expiresAfter); |
54 | 54 | } |
55 | 55 | $this->cacheInstance->save($cacheItem); |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @author Georges.L (Geolim4) <[email protected]> |
12 | 12 | * |
13 | 13 | */ |
14 | -declare(strict_types=1); |
|
14 | +declare(strict_types = 1); |
|
15 | 15 | |
16 | 16 | namespace Phpfastcache\Helper; |
17 | 17 | |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function __construct() |
39 | 39 | { |
40 | - $this->instances =& CacheManager::getInternalInstances(); |
|
40 | + $this->instances = & CacheManager::getInternalInstances(); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | */ |
46 | 46 | protected function getGenericCallback(): \Closure |
47 | 47 | { |
48 | - return function ($method, $args) { |
|
48 | + return function($method, $args) { |
|
49 | 49 | $return = []; |
50 | 50 | foreach ($this->instances as $instance) { |
51 | 51 | $reflectionMethod = new \ReflectionMethod(\get_class($instance), $method); |
52 | - $return[ $instance->getDriverName() ] = $reflectionMethod->invokeArgs($instance, $args); |
|
52 | + $return[$instance->getDriverName()] = $reflectionMethod->invokeArgs($instance, $args); |
|
53 | 53 | } |
54 | 54 | return $return; |
55 | 55 | }; |
@@ -62,5 +62,5 @@ |
||
62 | 62 | |
63 | 63 | if ((!\defined('PFC_IGNORE_COMPOSER_WARNING') || !PFC_IGNORE_COMPOSER_WARNING) && \class_exists('Composer\Autoload\ClassLoader')) { |
64 | 64 | trigger_error('Your project already makes use of Composer. You SHOULD use the composer dependency "phpfastcache/phpfastcache" instead of hard-autoloading.', |
65 | - E_USER_WARNING); |
|
65 | + E_USER_WARNING); |
|
66 | 66 | } |
67 | 67 | \ No newline at end of file |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | namespace Phpfastcache\Autoload; |
4 | 4 | |
5 | 5 | /** |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | * |
16 | 16 | */ |
17 | 17 | |
18 | -class Autoload{} |
|
18 | +class Autoload {} |
|
19 | 19 | |
20 | 20 | \define('PFC_PHP_EXT', 'php'); |
21 | 21 | \define('PFC_BIN_DIR', __DIR__ . '/../../../bin/'); |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | /** |
25 | 25 | * Register Autoload |
26 | 26 | */ |
27 | -spl_autoload_register(function ($entity) { |
|
27 | +spl_autoload_register(function($entity) { |
|
28 | 28 | $module = \explode('\\', $entity, 2); |
29 | - if (!\in_array($module[ 0 ], ['Phpfastcache', 'Psr'])) { |
|
29 | + if (!\in_array($module[0], ['Phpfastcache', 'Psr'])) { |
|
30 | 30 | /** |
31 | 31 | * Not a part of phpFastCache file |
32 | 32 | * then we return here. |
@@ -11,7 +11,7 @@ |
||
11 | 11 | * @author Georges.L (Geolim4) <[email protected]> |
12 | 12 | * |
13 | 13 | */ |
14 | -declare(strict_types=1); |
|
14 | +declare(strict_types = 1); |
|
15 | 15 | |
16 | 16 | namespace Phpfastcache\Core\Item; |
17 | 17 |
@@ -192,9 +192,9 @@ discard block |
||
192 | 192 | protected static function cleanFileName($filename): string |
193 | 193 | { |
194 | 194 | $regex = [ |
195 | - '/[\?\[\]\/\\\=\<\>\:\;\,\'\"\&\$\#\*\(\)\|\~\`\!\{\}]/', |
|
196 | - '/\.$/', |
|
197 | - '/^\./', |
|
195 | + '/[\?\[\]\/\\\=\<\>\:\;\,\'\"\&\$\#\*\(\)\|\~\`\!\{\}]/', |
|
196 | + '/\.$/', |
|
197 | + '/^\./', |
|
198 | 198 | ]; |
199 | 199 | $replace = ['-', '', '']; |
200 | 200 | |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | $tmpFilename = Directory::getAbsolutePath(\dirname($file) . '/tmp_' . \md5( |
291 | 291 | str_shuffle(\uniqid($this->getDriverName(), false)) |
292 | 292 | . str_shuffle(\uniqid($this->getDriverName(), false)) |
293 | - )); |
|
293 | + )); |
|
294 | 294 | |
295 | 295 | $f = fopen($tmpFilename, 'w+'); |
296 | 296 | flock($f, LOCK_EX); |
@@ -332,11 +332,11 @@ discard block |
||
332 | 332 | } |
333 | 333 | |
334 | 334 | $stat->setData(\implode(', ', \array_keys($this->itemInstances))) |
335 | - ->setRawData([ |
|
335 | + ->setRawData([ |
|
336 | 336 | 'tmp' => $this->tmp, |
337 | - ]) |
|
338 | - ->setSize(Directory::dirSize($path)) |
|
339 | - ->setInfo('Number of files used to build the cache: ' . Directory::getFileCount($path)); |
|
337 | + ]) |
|
338 | + ->setSize(Directory::dirSize($path)) |
|
339 | + ->setInfo('Number of files used to build the cache: ' . Directory::getFileCount($path)); |
|
340 | 340 | |
341 | 341 | return $stat; |
342 | 342 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @author Georges.L (Geolim4) <[email protected]> |
12 | 12 | * |
13 | 13 | */ |
14 | -declare(strict_types=1); |
|
14 | +declare(strict_types = 1); |
|
15 | 15 | |
16 | 16 | namespace Phpfastcache\Core\Pool\IO; |
17 | 17 | |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | { |
55 | 55 | $securityKey = \array_key_exists('securityKey', $this->config) ? $this->config->getOption('securityKey') : ''; |
56 | 56 | if (!$securityKey || mb_strtolower($securityKey) === 'auto') { |
57 | - if (isset($_SERVER[ 'HTTP_HOST' ])) { |
|
58 | - $securityKey = preg_replace('/^www./', '', \strtolower(\str_replace(':', '_', $_SERVER[ 'HTTP_HOST' ]))); |
|
57 | + if (isset($_SERVER['HTTP_HOST'])) { |
|
58 | + $securityKey = preg_replace('/^www./', '', \strtolower(\str_replace(':', '_', $_SERVER['HTTP_HOST']))); |
|
59 | 59 | } else { |
60 | 60 | $securityKey = ($this->isPHPModule() ? 'web' : 'cli'); |
61 | 61 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | return $full_path; |
99 | 99 | } |
100 | 100 | |
101 | - if (!isset($this->tmp[ $full_path_hash ]) || (!@\file_exists($full_path) || !@\is_writable($full_path))) { |
|
101 | + if (!isset($this->tmp[$full_path_hash]) || (!@\file_exists($full_path) || !@\is_writable($full_path))) { |
|
102 | 102 | if (!@\file_exists($full_path)) { |
103 | 103 | @mkdir($full_path, $this->getDefaultChmod(), true); |
104 | 104 | } else if (!@\is_writable($full_path)) { |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | throw new PhpfastcacheIOException('Path "' . $full_path . '" is not writable, please set a chmod 0777 or any writable permission and make sure to make use of an absolute path !'); |
124 | 124 | } |
125 | 125 | |
126 | - $this->tmp[ $full_path_hash ] = $full_path; |
|
126 | + $this->tmp[$full_path_hash] = $full_path; |
|
127 | 127 | $this->htaccessGen($full_path, \array_key_exists('htaccess', $this->config) ? $this->config->getOption('htaccess') : false); |
128 | 128 | } |
129 | 129 |