@@ -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\Proxy; |
17 | 17 |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | use Phpfastcache\Config\ConfigurationOption; |
19 | 19 | use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface; |
20 | 20 | use Phpfastcache\Exceptions\{ |
21 | - phpFastCacheDeprecatedException, phpFastCacheDriverCheckException, phpFastCacheDriverNotFoundException, phpFastCacheInstanceNotFoundException, phpFastCacheInvalidArgumentException, phpFastCacheInvalidConfigurationException |
|
21 | + phpFastCacheDeprecatedException, phpFastCacheDriverCheckException, phpFastCacheDriverNotFoundException, phpFastCacheInstanceNotFoundException, phpFastCacheInvalidArgumentException, phpFastCacheInvalidConfigurationException |
|
22 | 22 | }; |
23 | 23 | |
24 | 24 | /** |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | if (is_array($config)) { |
100 | 100 | $config = new ConfigurationOption($config); |
101 | 101 | trigger_error( |
102 | - 'The CacheManager will drops the support of primitive configuration arrays, use a "\Phpfastcache\Config\ConfigurationOption" object instead', |
|
103 | - E_USER_DEPRECATED |
|
102 | + 'The CacheManager will drops the support of primitive configuration arrays, use a "\Phpfastcache\Config\ConfigurationOption" object instead', |
|
103 | + E_USER_DEPRECATED |
|
104 | 104 | ); |
105 | 105 | }elseif ($config === null){ |
106 | 106 | $config = self::getDefaultConfig(); |
@@ -291,27 +291,27 @@ discard block |
||
291 | 291 | * @todo Reflection reader |
292 | 292 | */ |
293 | 293 | return [ |
294 | - 'Apc', |
|
295 | - 'Apcu', |
|
296 | - 'Cassandra', |
|
297 | - 'Couchbase', |
|
298 | - 'Couchdb', |
|
299 | - 'Devnull', |
|
300 | - 'Files', |
|
301 | - 'Leveldb', |
|
302 | - 'Memcache', |
|
303 | - 'Memcached', |
|
304 | - 'Memstatic', |
|
305 | - 'Mongodb', |
|
306 | - 'Predis', |
|
307 | - 'Redis', |
|
308 | - 'Riak', |
|
309 | - 'Ssdb', |
|
310 | - 'Sqlite', |
|
311 | - 'Wincache', |
|
312 | - 'Xcache', |
|
313 | - 'Zenddisk', |
|
314 | - 'Zendshm', |
|
294 | + 'Apc', |
|
295 | + 'Apcu', |
|
296 | + 'Cassandra', |
|
297 | + 'Couchbase', |
|
298 | + 'Couchdb', |
|
299 | + 'Devnull', |
|
300 | + 'Files', |
|
301 | + 'Leveldb', |
|
302 | + 'Memcache', |
|
303 | + 'Memcached', |
|
304 | + 'Memstatic', |
|
305 | + 'Mongodb', |
|
306 | + 'Predis', |
|
307 | + 'Redis', |
|
308 | + 'Riak', |
|
309 | + 'Ssdb', |
|
310 | + 'Sqlite', |
|
311 | + 'Wincache', |
|
312 | + 'Xcache', |
|
313 | + 'Zenddisk', |
|
314 | + 'Zendshm', |
|
315 | 315 | ]; |
316 | 316 | } |
317 | 317 | |
@@ -324,9 +324,9 @@ discard block |
||
324 | 324 | * @todo Reflection reader |
325 | 325 | */ |
326 | 326 | return \array_merge(self::getStaticSystemDrivers(), [ |
327 | - 'Devtrue', |
|
328 | - 'Devfalse', |
|
329 | - 'Cookie', |
|
327 | + 'Devtrue', |
|
328 | + 'Devfalse', |
|
329 | + 'Cookie', |
|
330 | 330 | ]); |
331 | 331 | } |
332 | 332 |
@@ -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; |
17 | 17 | |
@@ -102,9 +102,9 @@ discard block |
||
102 | 102 | 'The CacheManager will drops the support of primitive configuration arrays, use a "\Phpfastcache\Config\ConfigurationOption" object instead', |
103 | 103 | E_USER_DEPRECATED |
104 | 104 | ); |
105 | - }elseif ($config === null){ |
|
105 | + }elseif ($config === null) { |
|
106 | 106 | $config = self::getDefaultConfig(); |
107 | - }else if(!($config instanceof ConfigurationOption)){ |
|
107 | + } else if (!($config instanceof ConfigurationOption)) { |
|
108 | 108 | throw new phpFastCacheInvalidArgumentException(sprintf('Unsupported config type: %s', gettype($config))); |
109 | 109 | } |
110 | 110 | |
@@ -116,14 +116,14 @@ discard block |
||
116 | 116 | |
117 | 117 | $instance = $instanceId ?: md5($driver . \serialize($config->toArray())); |
118 | 118 | |
119 | - if (!isset(self::$instances[ $instance ])) { |
|
120 | - $badPracticeOmeter[ $driver ] = 1; |
|
119 | + if (!isset(self::$instances[$instance])) { |
|
120 | + $badPracticeOmeter[$driver] = 1; |
|
121 | 121 | $driverClass = self::getNamespacePath() . $driver . '\Driver'; |
122 | 122 | try { |
123 | 123 | if (\class_exists($driverClass)) { |
124 | 124 | $configClass = $driverClass::getConfigClass(); |
125 | - self::$instances[ $instance ] = new $driverClass(new $configClass($config->toArray()), $instance); |
|
126 | - self::$instances[ $instance ]->setEventManager(EventManager::getInstance()); |
|
125 | + self::$instances[$instance] = new $driverClass(new $configClass($config->toArray()), $instance); |
|
126 | + self::$instances[$instance]->setEventManager(EventManager::getInstance()); |
|
127 | 127 | } else { |
128 | 128 | throw new phpFastCacheDriverNotFoundException(sprintf('The driver "%s" does not exists', $driver)); |
129 | 129 | } |
@@ -142,14 +142,14 @@ discard block |
||
142 | 142 | throw new phpFastCacheDriverCheckException($e->getMessage(), $e->getCode(), $e); |
143 | 143 | } |
144 | 144 | } |
145 | - } else if ($badPracticeOmeter[ $driver ] >= 2) { |
|
145 | + } else if ($badPracticeOmeter[$driver] >= 2) { |
|
146 | 146 | trigger_error('[' . $driver . '] Calling many times CacheManager::getInstance() for already instanced drivers is a bad practice and have a significant impact on performances. |
147 | 147 | See https://github.com/PHPSocialNetwork/phpfastcache/wiki/[V5]-Why-calling-getInstance%28%29-each-time-is-a-bad-practice-%3F'); |
148 | 148 | } |
149 | 149 | |
150 | - $badPracticeOmeter[ $driver ]++; |
|
150 | + $badPracticeOmeter[$driver]++; |
|
151 | 151 | |
152 | - return self::$instances[ $instance ]; |
|
152 | + return self::$instances[$instance]; |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | /** |
@@ -166,8 +166,8 @@ discard block |
||
166 | 166 | throw new phpFastCacheInvalidArgumentException('The Instance ID must be a string'); |
167 | 167 | } |
168 | 168 | |
169 | - if (isset(self::$instances[ $instanceId ])) { |
|
170 | - return self::$instances[ $instanceId ]; |
|
169 | + if (isset(self::$instances[$instanceId])) { |
|
170 | + return self::$instances[$instanceId]; |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | throw new phpFastCacheInstanceNotFoundException(sprintf('Instance ID %s not found', $instanceId)); |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | */ |
235 | 235 | public static function __callStatic($name, $arguments) |
236 | 236 | { |
237 | - $options = (\array_key_exists(0, $arguments) && \is_array($arguments) ? $arguments[ 0 ] : []); |
|
237 | + $options = (\array_key_exists(0, $arguments) && \is_array($arguments) ? $arguments[0] : []); |
|
238 | 238 | |
239 | 239 | return self::getInstance($name, $options); |
240 | 240 | } |
@@ -102,9 +102,9 @@ |
||
102 | 102 | 'The CacheManager will drops the support of primitive configuration arrays, use a "\Phpfastcache\Config\ConfigurationOption" object instead', |
103 | 103 | E_USER_DEPRECATED |
104 | 104 | ); |
105 | - }elseif ($config === null){ |
|
105 | + } elseif ($config === null){ |
|
106 | 106 | $config = self::getDefaultConfig(); |
107 | - }else if(!($config instanceof ConfigurationOption)){ |
|
107 | + } else if(!($config instanceof ConfigurationOption)){ |
|
108 | 108 | throw new phpFastCacheInvalidArgumentException(sprintf('Unsupported config type: %s', gettype($config))); |
109 | 109 | } |
110 | 110 |
@@ -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 |
@@ -18,7 +18,7 @@ |
||
18 | 18 | use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface; |
19 | 19 | use Phpfastcache\EventManager; |
20 | 20 | use Phpfastcache\Exceptions\{ |
21 | - phpFastCacheInvalidArgumentException, phpFastCacheLogicException |
|
21 | + phpFastCacheInvalidArgumentException, phpFastCacheLogicException |
|
22 | 22 | }; |
23 | 23 | use Psr\Cache\CacheItemInterface; |
24 | 24 |
@@ -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 |
@@ -18,7 +18,7 @@ |
||
18 | 18 | use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface; |
19 | 19 | use Phpfastcache\EventManager; |
20 | 20 | use Phpfastcache\Exceptions\{ |
21 | - phpFastCacheInvalidArgumentException, phpFastCacheInvalidArgumentTypeException, phpFastCacheLogicException |
|
21 | + phpFastCacheInvalidArgumentException, phpFastCacheInvalidArgumentTypeException, phpFastCacheLogicException |
|
22 | 22 | }; |
23 | 23 | |
24 | 24 | /** |
@@ -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\Item; |
17 | 17 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $this->driver = $driver; |
70 | 70 | $this->driver->setItem($this); |
71 | 71 | $this->expirationDate = new \DateTime(); |
72 | - if($this->driver->getConfigOption('itemDetailedDate')){ |
|
72 | + if ($this->driver->getConfigOption('itemDetailedDate')) { |
|
73 | 73 | $this->creationDate = new \DateTime(); |
74 | 74 | $this->modificationDate = new \DateTime(); |
75 | 75 | } |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | if (\is_array($this->data)) { |
246 | 246 | $this->data[] = $data; |
247 | 247 | } else if (\is_string($data)) { |
248 | - $this->data .= (string)$data; |
|
248 | + $this->data .= (string) $data; |
|
249 | 249 | } else { |
250 | 250 | throw new phpFastCacheInvalidArgumentException('$data must be either array nor string.'); |
251 | 251 | } |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | if (\is_array($this->data)) { |
265 | 265 | \array_unshift($this->data, $data); |
266 | 266 | } else if (\is_string($data)) { |
267 | - $this->data = (string)$data . $this->data; |
|
267 | + $this->data = (string) $data . $this->data; |
|
268 | 268 | } else { |
269 | 269 | throw new phpFastCacheInvalidArgumentException('$data must be either array nor string.'); |
270 | 270 | } |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | public function removeTag($tagName): ExtendedCacheItemInterface |
344 | 344 | { |
345 | 345 | if (($key = array_search($tagName, $this->tags)) !== false) { |
346 | - unset($this->tags[ $key ]); |
|
346 | + unset($this->tags[$key]); |
|
347 | 347 | $this->removedTags[] = $tagName; |
348 | 348 | } |
349 | 349 | |
@@ -422,8 +422,8 @@ discard block |
||
422 | 422 | final public function __debugInfo() |
423 | 423 | { |
424 | 424 | $info = \get_object_vars($this); |
425 | - $info[ 'driver' ] = 'object(' . \get_class($info[ 'driver' ]) . ')'; |
|
425 | + $info['driver'] = 'object(' . \get_class($info['driver']) . ')'; |
|
426 | 426 | |
427 | - return (array)$info; |
|
427 | + return (array) $info; |
|
428 | 428 | } |
429 | 429 | } |
430 | 430 | \ No newline at end of file |
@@ -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 || $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 |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | use Phpfastcache\Config\ConfigurationOption; |
19 | 19 | use Phpfastcache\Core\Item\ExtendedCacheItemInterface; |
20 | 20 | use Phpfastcache\Exceptions\{ |
21 | - phpFastCacheInvalidArgumentException, phpFastCacheDriverCheckException, phpFastCacheLogicException |
|
21 | + phpFastCacheInvalidArgumentException, phpFastCacheDriverCheckException, phpFastCacheLogicException |
|
22 | 22 | }; |
23 | 23 | use Phpfastcache\Util\ArrayObject; |
24 | 24 | |
@@ -161,9 +161,9 @@ discard block |
||
161 | 161 | public function driverPreWrap(ExtendedCacheItemInterface $item): array |
162 | 162 | { |
163 | 163 | $wrap = [ |
164 | - self::DRIVER_DATA_WRAPPER_INDEX => $item->get(), |
|
165 | - self::DRIVER_TAGS_WRAPPER_INDEX => $item->getTags(), |
|
166 | - self::DRIVER_EDATE_WRAPPER_INDEX => $item->getExpirationDate(), |
|
164 | + self::DRIVER_DATA_WRAPPER_INDEX => $item->get(), |
|
165 | + self::DRIVER_TAGS_WRAPPER_INDEX => $item->getTags(), |
|
166 | + self::DRIVER_EDATE_WRAPPER_INDEX => $item->getExpirationDate(), |
|
167 | 167 | ]; |
168 | 168 | |
169 | 169 | if ($this->config->getOption('itemDetailedDate')) { |
@@ -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; |
17 | 17 | |
@@ -167,15 +167,15 @@ discard block |
||
167 | 167 | ]; |
168 | 168 | |
169 | 169 | if ($this->config->getOption('itemDetailedDate')) { |
170 | - $wrap[ self::DRIVER_MDATE_WRAPPER_INDEX ] = new \DateTime(); |
|
170 | + $wrap[self::DRIVER_MDATE_WRAPPER_INDEX] = new \DateTime(); |
|
171 | 171 | /** |
172 | 172 | * If the creation date exists |
173 | 173 | * reuse it else set a new Date |
174 | 174 | */ |
175 | - $wrap[ self::DRIVER_CDATE_WRAPPER_INDEX ] = $item->getCreationDate() ?: new \DateTime(); |
|
175 | + $wrap[self::DRIVER_CDATE_WRAPPER_INDEX] = $item->getCreationDate() ?: new \DateTime(); |
|
176 | 176 | } else { |
177 | - $wrap[ self::DRIVER_MDATE_WRAPPER_INDEX ] = null; |
|
178 | - $wrap[ self::DRIVER_CDATE_WRAPPER_INDEX ] = null; |
|
177 | + $wrap[self::DRIVER_MDATE_WRAPPER_INDEX] = null; |
|
178 | + $wrap[self::DRIVER_CDATE_WRAPPER_INDEX] = null; |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | return $wrap; |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | */ |
188 | 188 | public function driverUnwrapData(array $wrapper) |
189 | 189 | { |
190 | - return $wrapper[ self::DRIVER_DATA_WRAPPER_INDEX ]; |
|
190 | + return $wrapper[self::DRIVER_DATA_WRAPPER_INDEX]; |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | /** |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | */ |
197 | 197 | public function driverUnwrapTags(array $wrapper) |
198 | 198 | { |
199 | - return $wrapper[ self::DRIVER_TAGS_WRAPPER_INDEX ]; |
|
199 | + return $wrapper[self::DRIVER_TAGS_WRAPPER_INDEX]; |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | */ |
207 | 207 | public function driverUnwrapEdate(array $wrapper) |
208 | 208 | { |
209 | - return $wrapper[ self::DRIVER_EDATE_WRAPPER_INDEX ]; |
|
209 | + return $wrapper[self::DRIVER_EDATE_WRAPPER_INDEX]; |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | /** |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | */ |
216 | 216 | public function driverUnwrapCdate(array $wrapper) |
217 | 217 | { |
218 | - return $wrapper[ self::DRIVER_CDATE_WRAPPER_INDEX ]; |
|
218 | + return $wrapper[self::DRIVER_CDATE_WRAPPER_INDEX]; |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | */ |
226 | 226 | public function driverUnwrapMdate(array $wrapper) |
227 | 227 | { |
228 | - return $wrapper[ self::DRIVER_MDATE_WRAPPER_INDEX ]; |
|
228 | + return $wrapper[self::DRIVER_MDATE_WRAPPER_INDEX]; |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | /** |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | * that has slow performances |
283 | 283 | */ |
284 | 284 | |
285 | - $tagsItem->set(array_merge((array)$data, [$item->getKey() => $expTimestamp])); |
|
285 | + $tagsItem->set(array_merge((array) $data, [$item->getKey() => $expTimestamp])); |
|
286 | 286 | |
287 | 287 | /** |
288 | 288 | * Set the expiration date |
@@ -304,9 +304,9 @@ discard block |
||
304 | 304 | $tagsItems = $this->getItems($this->getTagKeys($item->getRemovedTags())); |
305 | 305 | |
306 | 306 | foreach ($tagsItems as $tagsItem) { |
307 | - $data = (array)$tagsItem->get(); |
|
307 | + $data = (array) $tagsItem->get(); |
|
308 | 308 | |
309 | - unset($data[ $item->getKey() ]); |
|
309 | + unset($data[$item->getKey()]); |
|
310 | 310 | $tagsItem->set($data); |
311 | 311 | |
312 | 312 | /** |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | public static function getConfigClass(): string |
388 | 388 | { |
389 | 389 | $localConfigClass = substr(static::class, 0, strrpos(static::class, '\\')) . '\Config'; |
390 | - if(\class_exists($localConfigClass) && is_a($localConfigClass, ConfigurationOption::class, true)){ |
|
390 | + if (\class_exists($localConfigClass) && is_a($localConfigClass, ConfigurationOption::class, true)) { |
|
391 | 391 | return $localConfigClass; |
392 | 392 | } |
393 | 393 | return ConfigurationOption::class; |
@@ -18,7 +18,7 @@ |
||
18 | 18 | use Phpfastcache\Core\Item\ExtendedCacheItemInterface; |
19 | 19 | use Phpfastcache\EventManager; |
20 | 20 | use Phpfastcache\Exceptions\{ |
21 | - phpFastCacheInvalidArgumentException, phpFastCacheLogicException |
|
21 | + phpFastCacheInvalidArgumentException, phpFastCacheLogicException |
|
22 | 22 | }; |
23 | 23 | use Psr\Cache\CacheItemInterface; |
24 | 24 |
@@ -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; |
17 | 17 | |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public function getItemsAsJsonString(array $keys = [], $option = 0, $depth = 512): string |
34 | 34 | { |
35 | - $callback = function (CacheItemInterface $item) { |
|
35 | + $callback = function(CacheItemInterface $item) { |
|
36 | 36 | return $item->get(); |
37 | 37 | }; |
38 | 38 | return \json_encode(array_map($callback, array_values($this->getItems($keys))), $option, $depth); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | if (\is_string($tagName)) { |
47 | 47 | $driverResponse = $this->getItem($this->getTagKey($tagName)); |
48 | 48 | if ($driverResponse->isHit()) { |
49 | - $items = (array)$driverResponse->get(); |
|
49 | + $items = (array) $driverResponse->get(); |
|
50 | 50 | |
51 | 51 | /** |
52 | 52 | * getItems() may provides expired item(s) |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * |
59 | 59 | * #headache |
60 | 60 | */ |
61 | - return \array_filter($this->getItems(\array_unique(\array_keys($items))), function (ExtendedCacheItemInterface $item) { |
|
61 | + return \array_filter($this->getItems(\array_unique(\array_keys($items))), function(ExtendedCacheItemInterface $item) { |
|
62 | 62 | return $item->isHit(); |
63 | 63 | }); |
64 | 64 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | |
96 | 96 | foreach ($items as $key => $item) { |
97 | 97 | if (\array_diff($tagNames, $item->getTags())) { |
98 | - unset($items[ $key ]); |
|
98 | + unset($items[$key]); |
|
99 | 99 | } |
100 | 100 | } |
101 | 101 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function getItemsByTagsAsJsonString(array $tagNames, $option = 0, $depth = 512) |
110 | 110 | { |
111 | - $callback = function (CacheItemInterface $item) { |
|
111 | + $callback = function(CacheItemInterface $item) { |
|
112 | 112 | return $item->get(); |
113 | 113 | }; |
114 | 114 | |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | */ |
380 | 380 | public function detachItem(CacheItemInterface $item) |
381 | 381 | { |
382 | - if (isset($this->itemInstances[ $item->getKey() ])) { |
|
382 | + if (isset($this->itemInstances[$item->getKey()])) { |
|
383 | 383 | $this->deregisterItem($item); |
384 | 384 | } |
385 | 385 | } |
@@ -399,11 +399,11 @@ discard block |
||
399 | 399 | */ |
400 | 400 | public function attachItem(CacheItemInterface $item) |
401 | 401 | { |
402 | - if (isset($this->itemInstances[ $item->getKey() ]) && \spl_object_hash($item) !== \spl_object_hash($this->itemInstances[ $item->getKey() ])) { |
|
402 | + if (isset($this->itemInstances[$item->getKey()]) && \spl_object_hash($item) !== \spl_object_hash($this->itemInstances[$item->getKey()])) { |
|
403 | 403 | throw new phpFastCacheLogicException('The item already exists and cannot be overwritten because the Spl object hash mismatches ! You probably tried to re-attach a detached item which has been already retrieved from cache.'); |
404 | 404 | } |
405 | 405 | |
406 | - $this->itemInstances[ $item->getKey() ] = $item; |
|
406 | + $this->itemInstances[$item->getKey()] = $item; |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | |
@@ -415,10 +415,10 @@ discard block |
||
415 | 415 | protected function deregisterItem($item) |
416 | 416 | { |
417 | 417 | if ($item instanceof CacheItemInterface) { |
418 | - unset($this->itemInstances[ $item->getKey() ]); |
|
418 | + unset($this->itemInstances[$item->getKey()]); |
|
419 | 419 | |
420 | 420 | } else if (\is_string($item)) { |
421 | - unset($this->itemInstances[ $item ]); |
|
421 | + unset($this->itemInstances[$item]); |
|
422 | 422 | } else { |
423 | 423 | throw new phpFastCacheInvalidArgumentException('Invalid type for $item variable'); |
424 | 424 | } |
@@ -445,8 +445,8 @@ discard block |
||
445 | 445 | */ |
446 | 446 | public function isAttached(CacheItemInterface $item) |
447 | 447 | { |
448 | - if (isset($this->itemInstances[ $item->getKey() ])) { |
|
449 | - return \spl_object_hash($item) === \spl_object_hash($this->itemInstances[ $item->getKey() ]); |
|
448 | + if (isset($this->itemInstances[$item->getKey()])) { |
|
449 | + return \spl_object_hash($item) === \spl_object_hash($this->itemInstances[$item->getKey()]); |
|
450 | 450 | } |
451 | 451 | return null; |
452 | 452 | } |
@@ -469,8 +469,8 @@ discard block |
||
469 | 469 | */ |
470 | 470 | public function saveMultiple(...$items): bool |
471 | 471 | { |
472 | - if (isset($items[ 0 ]) && \is_array($items[ 0 ])) { |
|
473 | - foreach ($items[ 0 ] as $item) { |
|
472 | + if (isset($items[0]) && \is_array($items[0])) { |
|
473 | + foreach ($items[0] as $item) { |
|
474 | 474 | $this->save($item); |
475 | 475 | } |
476 | 476 | return true; |