@@ -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; |
@@ -100,9 +100,9 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | if(array_diff_key($array, get_object_vars($this))){ |
| 102 | 102 | throw new PhpfastcacheInvalidConfigurationException(\sprintf( |
| 103 | - 'Invalid option(s) for the config %s: %s', |
|
| 104 | - static::class, |
|
| 105 | - implode(', ', array_keys(array_diff_key($array, get_object_vars($this)))) |
|
| 103 | + 'Invalid option(s) for the config %s: %s', |
|
| 104 | + static::class, |
|
| 105 | + implode(', ', array_keys(array_diff_key($array, get_object_vars($this)))) |
|
| 106 | 106 | )); |
| 107 | 107 | } |
| 108 | 108 | |
@@ -134,10 +134,10 @@ discard block |
||
| 134 | 134 | $typeHintExpected = ($parameter instanceof \ReflectionParameter ? ($parameter->getType() === 'object' ? $parameter->getClass() : $parameter->getType()) : 'Unknown type'); |
| 135 | 135 | |
| 136 | 136 | throw new PhpfastcacheInvalidConfigurationException(\sprintf( |
| 137 | - 'Invalid type hint found for "%s", expected "%s" got "%s"', |
|
| 138 | - lcfirst(substr($method, 3)), |
|
| 139 | - $typeHintExpected, |
|
| 140 | - $typeHintGot |
|
| 137 | + 'Invalid type hint found for "%s", expected "%s" got "%s"', |
|
| 138 | + lcfirst(substr($method, 3)), |
|
| 139 | + $typeHintExpected, |
|
| 140 | + $typeHintGot |
|
| 141 | 141 | )); |
| 142 | 142 | } |
| 143 | 143 | } |
@@ -331,9 +331,9 @@ discard block |
||
| 331 | 331 | { |
| 332 | 332 | if($fallbackConfig !== null && !($fallbackConfig instanceof self)){ |
| 333 | 333 | throw new PhpfastcacheInvalidArgumentException(\sprintf( |
| 334 | - 'Invalid argument "%s" for %s', |
|
| 335 | - gettype($fallbackConfig) === 'object' ? get_class($fallbackConfig) : gettype($fallbackConfig), |
|
| 336 | - __METHOD__ |
|
| 334 | + 'Invalid argument "%s" for %s', |
|
| 335 | + gettype($fallbackConfig) === 'object' ? get_class($fallbackConfig) : gettype($fallbackConfig), |
|
| 336 | + __METHOD__ |
|
| 337 | 337 | )); |
| 338 | 338 | } |
| 339 | 339 | $this->fallbackConfig = $fallbackConfig; |
@@ -432,10 +432,10 @@ discard block |
||
| 432 | 432 | * by opening a pull request :) |
| 433 | 433 | */ |
| 434 | 434 | static $safeFileExtensions = [ |
| 435 | - 'txt', |
|
| 436 | - 'cache', |
|
| 437 | - 'db', |
|
| 438 | - 'pfc', |
|
| 435 | + 'txt', |
|
| 436 | + 'cache', |
|
| 437 | + 'db', |
|
| 438 | + 'pfc', |
|
| 439 | 439 | ]; |
| 440 | 440 | |
| 441 | 441 | if (\strpos($cacheFileExtension, '.') !== false) { |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | } |
| 444 | 444 | if (!\in_array($cacheFileExtension, $safeFileExtensions, true)) { |
| 445 | 445 | throw new PhpfastcacheInvalidConfigurationException( |
| 446 | - "{$cacheFileExtension} is not a safe extension, currently allowed extension: " . \implode(', ', $safeFileExtensions) |
|
| 446 | + "{$cacheFileExtension} is not a safe extension, currently allowed extension: " . \implode(', ', $safeFileExtensions) |
|
| 447 | 447 | ); |
| 448 | 448 | } |
| 449 | 449 | |
@@ -92,33 +92,33 @@ discard block |
||
| 92 | 92 | public function __construct(...$args) |
| 93 | 93 | { |
| 94 | 94 | parent::__construct(...$args); |
| 95 | - $array =& $this->getArray(); |
|
| 95 | + $array = & $this->getArray(); |
|
| 96 | 96 | |
| 97 | 97 | /** |
| 98 | 98 | * Detect unwanted keys and throw an exception. |
| 99 | 99 | * No more kidding now, it's 21th century. |
| 100 | 100 | */ |
| 101 | - if(array_diff_key($array, get_object_vars($this))){ |
|
| 101 | + if (array_diff_key($array, get_object_vars($this))) { |
|
| 102 | 102 | throw new PhpfastcacheInvalidConfigurationException(\sprintf( |
| 103 | 103 | 'Invalid option(s) for the config %s: %s', |
| 104 | 104 | static::class, |
| 105 | - implode(', ', array_keys(array_diff_key($array, get_object_vars($this)))) |
|
| 105 | + implode(', ', array_keys(array_diff_key($array, get_object_vars($this)))) |
|
| 106 | 106 | )); |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | foreach (get_object_vars($this) as $property => $value) { |
| 110 | 110 | |
| 111 | - if(array_key_exists($property, $array)){ |
|
| 112 | - $this->$property = &$array[ $property ]; |
|
| 113 | - }else{ |
|
| 114 | - $array[ $property ] = &$this->$property; |
|
| 111 | + if (array_key_exists($property, $array)) { |
|
| 112 | + $this->$property = &$array[$property]; |
|
| 113 | + } else { |
|
| 114 | + $array[$property] = &$this->$property; |
|
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | foreach (get_class_methods($this) as $method) { |
| 119 | - if(strpos($method, 'set') === 0){ |
|
| 119 | + if (strpos($method, 'set') === 0) { |
|
| 120 | 120 | $value = null; |
| 121 | - try{ |
|
| 121 | + try { |
|
| 122 | 122 | /** |
| 123 | 123 | * We use property instead of getter |
| 124 | 124 | * because of is/get conditions and |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | $value = $this->{lcfirst(substr($method, 3))}; |
| 129 | 129 | $this->{$method}($value); |
| 130 | - }catch(\TypeError $e){ |
|
| 130 | + } catch (\TypeError $e) { |
|
| 131 | 131 | $typeHintGot = \is_object($value) ? \get_class($value) : \gettype($value); |
| 132 | 132 | $reflectionMethod = new \ReflectionMethod($this, $method); |
| 133 | 133 | $parameter = $reflectionMethod->getParameters()[0] ?? null; |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | */ |
| 215 | 215 | public function setIgnoreSymfonyNotice(bool $ignoreSymfonyNotice): self |
| 216 | 216 | { |
| 217 | - if($ignoreSymfonyNotice){ |
|
| 217 | + if ($ignoreSymfonyNotice) { |
|
| 218 | 218 | trigger_error('Configuration option "ignoreSymfonyNotice" is deprecated as of the V7', E_USER_DEPRECATED); |
| 219 | 219 | } |
| 220 | 220 | $this->ignoreSymfonyNotice = $ignoreSymfonyNotice; |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | */ |
| 330 | 330 | public function setFallbackConfig($fallbackConfig): self |
| 331 | 331 | { |
| 332 | - if($fallbackConfig !== null && !($fallbackConfig instanceof self)){ |
|
| 332 | + if ($fallbackConfig !== null && !($fallbackConfig instanceof self)) { |
|
| 333 | 333 | throw new PhpfastcacheInvalidArgumentException(\sprintf( |
| 334 | 334 | 'Invalid argument "%s" for %s', |
| 335 | 335 | gettype($fallbackConfig) === 'object' ? get_class($fallbackConfig) : gettype($fallbackConfig), |
@@ -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 | |
@@ -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 @@ 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 @@ |
||
| 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 | |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | use Phpfastcache\Entities\DriverStatistic; |
| 22 | 22 | use Phpfastcache\EventManager; |
| 23 | 23 | use Phpfastcache\Exceptions\{ |
| 24 | - PhpfastcacheInvalidArgumentException, PhpfastcacheLogicException |
|
| 24 | + PhpfastcacheInvalidArgumentException, PhpfastcacheLogicException |
|
| 25 | 25 | }; |
| 26 | 26 | use Phpfastcache\Util\ArrayObject; |
| 27 | 27 | use Psr\Cache\{CacheItemInterface, CacheItemPoolInterface}; |
@@ -83,8 +83,8 @@ |
||
| 83 | 83 | |
| 84 | 84 | $files = new RecursiveIteratorIterator |
| 85 | 85 | ( |
| 86 | - new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS), |
|
| 87 | - RecursiveIteratorIterator::CHILD_FIRST |
|
| 86 | + new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS), |
|
| 87 | + RecursiveIteratorIterator::CHILD_FIRST |
|
| 88 | 88 | ); |
| 89 | 89 | |
| 90 | 90 | foreach ($files as $fileinfo) { |
@@ -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\Util; |
| 17 | 17 | |
@@ -87,8 +87,7 @@ discard block |
||
| 87 | 87 | return \unlink($source); |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - $files = new RecursiveIteratorIterator |
|
| 91 | - ( |
|
| 90 | + $files = new RecursiveIteratorIterator( |
|
| 92 | 91 | new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS), |
| 93 | 92 | RecursiveIteratorIterator::CHILD_FIRST |
| 94 | 93 | ); |
@@ -138,8 +137,8 @@ discard block |
||
| 138 | 137 | /** |
| 139 | 138 | * Allows to dereference char |
| 140 | 139 | */ |
| 141 | - $__FILE__ = \preg_replace('~^(([a-z0-9\-]+)://)~', '', __FILE__);// remove file protocols such as "phar://" etc. |
|
| 142 | - $prefix = $__FILE__[ 0 ] === DIRECTORY_SEPARATOR ? DIRECTORY_SEPARATOR : ''; |
|
| 140 | + $__FILE__ = \preg_replace('~^(([a-z0-9\-]+)://)~', '', __FILE__); // remove file protocols such as "phar://" etc. |
|
| 141 | + $prefix = $__FILE__[0] === DIRECTORY_SEPARATOR ? DIRECTORY_SEPARATOR : ''; |
|
| 143 | 142 | return $prefix . \implode(DIRECTORY_SEPARATOR, $absolutes); |
| 144 | 143 | } |
| 145 | 144 | } |
| 146 | 145 | \ No newline at end of file |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | * Date: 01/10/2017 |
| 6 | 6 | * Time: 00:08 |
| 7 | 7 | */ |
| 8 | -declare(strict_types=1); |
|
| 8 | +declare(strict_types = 1); |
|
| 9 | 9 | |
| 10 | 10 | namespace Phpfastcache\Util; |
| 11 | 11 | |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | public function __construct(...$args) |
| 34 | 34 | { |
| 35 | - $this->array = (\count($args) === 1 && \is_array($args[ 0 ]) ? $args[ 0 ] : $args); |
|
| 35 | + $this->array = (\count($args) === 1 && \is_array($args[0]) ? $args[0] : $args); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | public function current() |
| 42 | 42 | { |
| 43 | - return $this->array[ $this->position ]; |
|
| 43 | + return $this->array[$this->position]; |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | /** |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | */ |
| 99 | 99 | public function offsetGet($offset) |
| 100 | 100 | { |
| 101 | - return $this->array[ $offset ] ?? null; |
|
| 101 | + return $this->array[$offset] ?? null; |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | /** |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | if ($offset === null) { |
| 114 | 114 | $this->array[] = $value; |
| 115 | 115 | } else { |
| 116 | - $this->array[ $offset ] = $value; |
|
| 116 | + $this->array[$offset] = $value; |
|
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | */ |
| 123 | 123 | public function offsetUnset($offset) |
| 124 | 124 | { |
| 125 | - unset($this->array[ $offset ]); |
|
| 125 | + unset($this->array[$offset]); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | /** |