@@ -37,14 +37,14 @@ |
||
| 37 | 37 | */ |
| 38 | 38 | public function load(array $configs, ContainerBuilder $container) |
| 39 | 39 | { |
| 40 | - $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
|
| 40 | + $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); |
|
| 41 | 41 | $loader->load('services.yml'); |
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | 44 | * Includes services_dev.yml only |
| 45 | 45 | * if we are in debug mode |
| 46 | 46 | */ |
| 47 | - if(\in_array($container->getParameter('kernel.environment'), ['dev', 'test'], true)){ |
|
| 47 | + if (\in_array($container->getParameter('kernel.environment'), ['dev', 'test'], true)) { |
|
| 48 | 48 | $loader->load('services_dev.yml'); |
| 49 | 49 | } |
| 50 | 50 | |
@@ -42,11 +42,11 @@ |
||
| 42 | 42 | */ |
| 43 | 43 | public function size_format($bytes, $decimals = 2, $octetFormat = false, $separator = '') |
| 44 | 44 | { |
| 45 | - $bytes = (int)$bytes; |
|
| 45 | + $bytes = (int) $bytes; |
|
| 46 | 46 | $sz = 'BKMGTP'; |
| 47 | 47 | $factor = floor((\strlen($bytes) - 1) / 3); |
| 48 | 48 | |
| 49 | - return sprintf("%.{$decimals}f", $bytes / (1024 ** $factor)) . $separator . @$sz[ $factor ] . ($factor ? ($octetFormat ? 'O' : 'B') : ''); |
|
| 49 | + return sprintf("%.{$decimals}f", $bytes / (1024 ** $factor)) . $separator . @$sz[$factor] . ($factor ? ($octetFormat ? 'O' : 'B') : ''); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | /** |
@@ -63,13 +63,13 @@ discard block |
||
| 63 | 63 | if ($cache->getStats()->getSize()) { |
| 64 | 64 | $size += $cache->getStats()->getSize(); |
| 65 | 65 | } |
| 66 | - $stats[ $instanceName ] = $cache->getStats(); |
|
| 67 | - $instances[ $instanceName ] = [ |
|
| 66 | + $stats[$instanceName] = $cache->getStats(); |
|
| 67 | + $instances[$instanceName] = [ |
|
| 68 | 68 | 'driverName' => $cache->getDriverName(), |
| 69 | - 'configClassName' => \get_class( $cache->getConfig()), |
|
| 69 | + 'configClassName' => \get_class($cache->getConfig()), |
|
| 70 | 70 | 'driverConfig' => $cache->getConfig()->toArray() |
| 71 | 71 | ]; |
| 72 | - $driverUsed[ $cache->getDriverName() ] = \get_class($cache); |
|
| 72 | + $driverUsed[$cache->getDriverName()] = \get_class($cache); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | $this->data = [ |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | public function getStats(): array |
| 104 | 104 | { |
| 105 | - return $this->data[ 'stats' ] ?? []; |
|
| 105 | + return $this->data['stats'] ?? []; |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | /** |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | */ |
| 111 | 111 | public function getInstances(): array |
| 112 | 112 | { |
| 113 | - return $this->data[ 'instances' ]; |
|
| 113 | + return $this->data['instances']; |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | /** |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | */ |
| 119 | 119 | public function getDriverUsed(): array |
| 120 | 120 | { |
| 121 | - return $this->data[ 'driverUsed' ] ?? []; |
|
| 121 | + return $this->data['driverUsed'] ?? []; |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | /** |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | */ |
| 127 | 127 | public function getHits(): array |
| 128 | 128 | { |
| 129 | - return $this->data[ 'hits' ] ?? []; |
|
| 129 | + return $this->data['hits'] ?? []; |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | /** |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | */ |
| 135 | 135 | public function getSize(): int |
| 136 | 136 | { |
| 137 | - return $this->data[ 'size' ] ?? 0; |
|
| 137 | + return $this->data['size'] ?? 0; |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | /** |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | public function getCoreConfig(): array |
| 144 | 144 | { |
| 145 | - return $this->data[ 'coreConfig' ] ?? []; |
|
| 145 | + return $this->data['coreConfig'] ?? []; |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | /** |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | */ |
| 151 | 151 | public function getProjectConfig(): array |
| 152 | 152 | { |
| 153 | - return $this->data[ 'projectConfig' ] ?? []; |
|
| 153 | + return $this->data['projectConfig'] ?? []; |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | /** |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | */ |
| 159 | 159 | public function getApiVersion(): string |
| 160 | 160 | { |
| 161 | - return $this->data[ 'apiVersion' ]; |
|
| 161 | + return $this->data['apiVersion']; |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | /** |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | */ |
| 167 | 167 | public function getPfcVersion(): string |
| 168 | 168 | { |
| 169 | - return $this->data[ 'pfcVersion' ]; |
|
| 169 | + return $this->data['pfcVersion']; |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | /** |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | */ |
| 175 | 175 | public function getBundleVersion(): string |
| 176 | 176 | { |
| 177 | - return $this->data[ 'bundleVersion' ]; |
|
| 177 | + return $this->data['bundleVersion']; |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | /** |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | */ |
| 183 | 183 | public function getApiChangelog(): string |
| 184 | 184 | { |
| 185 | - return $this->data[ 'apiChangelog' ] ?? ''; |
|
| 185 | + return $this->data['apiChangelog'] ?? ''; |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | /** |
@@ -192,9 +192,9 @@ discard block |
||
| 192 | 192 | */ |
| 193 | 193 | public function setTwigCacheBlock($blockName, array $cacheBlock): self |
| 194 | 194 | { |
| 195 | - if(isset($this->twig_cache_blocks[$blockName])){ |
|
| 195 | + if (isset($this->twig_cache_blocks[$blockName])) { |
|
| 196 | 196 | $this->twig_cache_blocks[$blockName] = \array_merge($this->twig_cache_blocks[$blockName], $cacheBlock); |
| 197 | - }else{ |
|
| 197 | + } else { |
|
| 198 | 198 | $this->twig_cache_blocks[$blockName] = $cacheBlock; |
| 199 | 199 | } |
| 200 | 200 | |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | */ |
| 208 | 208 | public function getTwigCacheBlocks(): array |
| 209 | 209 | { |
| 210 | - return $this->data[ 'twigCacheBlocks' ] ?? []; |
|
| 210 | + return $this->data['twigCacheBlocks'] ?? []; |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | /** |
@@ -68,10 +68,10 @@ discard block |
||
| 68 | 68 | */ |
| 69 | 69 | public function createInstance(string $name, ExtendedCacheItemPoolInterface $instance) |
| 70 | 70 | { |
| 71 | - if (\array_key_exists($name, $this->cacheInstances) && $this->cacheInstances[ $name ] instanceof ExtendedCacheItemPoolInterface) { |
|
| 71 | + if (\array_key_exists($name, $this->cacheInstances) && $this->cacheInstances[$name] instanceof ExtendedCacheItemPoolInterface) { |
|
| 72 | 72 | throw new PhpfastcacheDriverException("Cache instance '{$name}' already exists"); |
| 73 | 73 | } |
| 74 | - $this->cacheInstances[ $name ] = $instance; |
|
| 74 | + $this->cacheInstances[$name] = $instance; |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /** |
@@ -91,24 +91,24 @@ discard block |
||
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | if (!\array_key_exists($name, $this->cacheInstances)) { |
| 94 | - if (\array_key_exists($name, $this->config[ 'drivers' ])) { |
|
| 95 | - $driverClass = CacheManager::getDriverClass($this->config[ 'drivers' ][ $name ][ 'type' ]); |
|
| 96 | - if (\is_a($driverClass, ExtendedCacheItemPoolInterface::class, true)){ |
|
| 94 | + if (\array_key_exists($name, $this->config['drivers'])) { |
|
| 95 | + $driverClass = CacheManager::getDriverClass($this->config['drivers'][$name]['type']); |
|
| 96 | + if (\is_a($driverClass, ExtendedCacheItemPoolInterface::class, true)) { |
|
| 97 | 97 | $configClass = $driverClass::getConfigClass(); |
| 98 | - if(\class_exists($configClass)){ |
|
| 98 | + if (\class_exists($configClass)) { |
|
| 99 | 99 | $this->createInstance( |
| 100 | 100 | $name, |
| 101 | 101 | CacheManager::getInstance( |
| 102 | - $this->config[ 'drivers' ][ $name ][ 'type' ], |
|
| 103 | - new $configClass($this->config[ 'drivers' ][ $name ][ 'parameters' ]) |
|
| 102 | + $this->config['drivers'][$name]['type'], |
|
| 103 | + new $configClass($this->config['drivers'][$name]['parameters']) |
|
| 104 | 104 | ) |
| 105 | 105 | ); |
| 106 | - }else{ |
|
| 106 | + } else { |
|
| 107 | 107 | throw new PhpfastcacheInvalidConfigurationException('Invalid configuration class name: ' . $configClass); |
| 108 | 108 | } |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - if (!isset($this->cacheInstances[ $name ]) || !($this->cacheInstances[ $name ] instanceof ExtendedCacheItemPoolInterface)) { |
|
| 111 | + if (!isset($this->cacheInstances[$name]) || !($this->cacheInstances[$name] instanceof ExtendedCacheItemPoolInterface)) { |
|
| 112 | 112 | throw new PhpfastcacheDriverException("Cache instance '{$name}' does not implements ExtendedCacheItemPoolInterface"); |
| 113 | 113 | } |
| 114 | 114 | } else { |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | if ($this->stopwatch) { |
| 120 | 120 | $this->stopwatch->stop(__METHOD__ . "('{$name}')"); |
| 121 | 121 | } |
| 122 | - return $this->cacheInstances[ $name ]; |
|
| 122 | + return $this->cacheInstances[$name]; |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | /** |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | public function getTwigCacheInstance(): ExtendedCacheItemPoolInterface |
| 129 | 129 | { |
| 130 | - return $this->get($this->config[ 'twig_driver' ]); |
|
| 130 | + return $this->get($this->config['twig_driver']); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | /** |
@@ -58,14 +58,14 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | $compiler |
| 60 | 60 | ->addDebugInfo($this) |
| 61 | - ->write("\$phpfastcacheCacheStrategy".$i." = \$this->env->getExtension('{$extension}')->getCacheStrategy();\n") |
|
| 62 | - ->write("\$phpfastcacheKey".$i." = \$phpfastcacheCacheStrategy".$i."->generateKey(") |
|
| 61 | + ->write("\$phpfastcacheCacheStrategy" . $i . " = \$this->env->getExtension('{$extension}')->getCacheStrategy();\n") |
|
| 62 | + ->write("\$phpfastcacheKey" . $i . " = \$phpfastcacheCacheStrategy" . $i . "->generateKey(") |
|
| 63 | 63 | ->subcompile($this->getNode('annotation')) |
| 64 | 64 | ->raw(", ") |
| 65 | 65 | ->subcompile($this->getNode('key_info')) |
| 66 | 66 | ->write(");\n") |
| 67 | - ->write("\$phpfastcacheCacheBody".$i." = \$phpfastcacheCacheStrategy".$i."->fetchBlock(\$phpfastcacheKey".$i.", \$this->getSourceContext());\n") |
|
| 68 | - ->write("if (\$phpfastcacheCacheBody".$i." === false) {\n") |
|
| 67 | + ->write("\$phpfastcacheCacheBody" . $i . " = \$phpfastcacheCacheStrategy" . $i . "->fetchBlock(\$phpfastcacheKey" . $i . ", \$this->getSourceContext());\n") |
|
| 68 | + ->write("if (\$phpfastcacheCacheBody" . $i . " === false) {\n") |
|
| 69 | 69 | ->indent() |
| 70 | 70 | ->write("\\ob_start();\n") |
| 71 | 71 | ->write("\$compileMc = \\microtime(true);\n") |
@@ -74,11 +74,11 @@ discard block |
||
| 74 | 74 | ->outdent() |
| 75 | 75 | ->write("\n") |
| 76 | 76 | // ->write("sleep(2);\n") // For debug purpose |
| 77 | - ->write("\$phpfastcacheCacheBody".$i." = \\ob_get_clean();\n") |
|
| 78 | - ->write("\$phpfastcacheCacheStrategy".$i."->saveBlock(\$phpfastcacheKey".$i.", \$phpfastcacheCacheBody".$i.", \\microtime(true) - \$compileMc, \$this->getSourceContext());\n") |
|
| 77 | + ->write("\$phpfastcacheCacheBody" . $i . " = \\ob_get_clean();\n") |
|
| 78 | + ->write("\$phpfastcacheCacheStrategy" . $i . "->saveBlock(\$phpfastcacheKey" . $i . ", \$phpfastcacheCacheBody" . $i . ", \\microtime(true) - \$compileMc, \$this->getSourceContext());\n") |
|
| 79 | 79 | ->outdent() |
| 80 | 80 | ->write("}\n") |
| 81 | - ->write("echo \$phpfastcacheCacheBody".$i.";\n") |
|
| 81 | + ->write("echo \$phpfastcacheCacheBody" . $i . ";\n") |
|
| 82 | 82 | ; |
| 83 | 83 | } |
| 84 | 84 | } |
@@ -72,22 +72,22 @@ discard block |
||
| 72 | 72 | public function fetchBlock($key, \Twig_Source $sourceContext) |
| 73 | 73 | { |
| 74 | 74 | $generationTimeMc = \microtime(true); |
| 75 | - $cacheData = $this->cache->fetch($key[ 'key' ]); |
|
| 75 | + $cacheData = $this->cache->fetch($key['key']); |
|
| 76 | 76 | $generationTime = \microtime(true) - $generationTimeMc; |
| 77 | - $unprefixedKey = \substr($key[ 'key' ], \strlen($this->twigCachePrefix)); |
|
| 77 | + $unprefixedKey = \substr($key['key'], \strlen($this->twigCachePrefix)); |
|
| 78 | 78 | |
| 79 | 79 | if ($this->cacheCollector instanceof CacheCollector) { |
| 80 | 80 | $this->cacheCollector->setTwigCacheBlock($unprefixedKey, [ |
| 81 | 81 | 'cacheHit' => $cacheData !== null, |
| 82 | - 'cacheTtl' => $key[ 'lifetime' ], |
|
| 83 | - 'cacheSize' => mb_strlen((string)$cacheData), |
|
| 82 | + 'cacheTtl' => $key['lifetime'], |
|
| 83 | + 'cacheSize' => mb_strlen((string) $cacheData), |
|
| 84 | 84 | 'cacheGenTime' => $generationTime, |
| 85 | 85 | 'cacheFileName' => $sourceContext->getName(), |
| 86 | 86 | 'cacheFilePath' => $sourceContext->getPath(), |
| 87 | 87 | ]); |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - if (!empty($cacheData) && $this->config[ 'twig_block_debug' ]) { |
|
| 90 | + if (!empty($cacheData) && $this->config['twig_block_debug']) { |
|
| 91 | 91 | return "<!-- BEGIN CACHE BLOCK OUTPUT '{$unprefixedKey}' -->\n{$cacheData}\n<!-- // END CACHE BLOCK OUTPUT '{$unprefixedKey}' -->"; |
| 92 | 92 | } |
| 93 | 93 | |
@@ -114,19 +114,19 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | public function saveBlock($key, $block, $generationTime, \Twig_Source $sourceContext) |
| 116 | 116 | { |
| 117 | - $unprefixedKey = \substr($key[ 'key' ], \strlen($this->twigCachePrefix)); |
|
| 117 | + $unprefixedKey = \substr($key['key'], \strlen($this->twigCachePrefix)); |
|
| 118 | 118 | |
| 119 | 119 | if ($this->cacheCollector instanceof CacheCollector) { |
| 120 | 120 | $this->cacheCollector->setTwigCacheBlock($unprefixedKey, [ |
| 121 | 121 | 'cacheHit' => false, |
| 122 | - 'cacheTtl' => $key[ 'lifetime' ], |
|
| 123 | - 'cacheSize' => \mb_strlen((string)$block), |
|
| 122 | + 'cacheTtl' => $key['lifetime'], |
|
| 123 | + 'cacheSize' => \mb_strlen((string) $block), |
|
| 124 | 124 | 'cacheGenTime' => $generationTime, |
| 125 | 125 | 'cacheFileName' => $sourceContext->getName(), |
| 126 | 126 | 'cacheFilePath' => $sourceContext->getPath(), |
| 127 | 127 | ]); |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - return $this->cache->save($key[ 'key' ], $block, $key[ 'lifetime' ]); |
|
| 130 | + return $this->cache->save($key['key'], $block, $key['lifetime']); |
|
| 131 | 131 | } |
| 132 | 132 | } |
@@ -29,10 +29,10 @@ discard block |
||
| 29 | 29 | /** |
| 30 | 30 | * Xcache and APC cannot coexists |
| 31 | 31 | */ |
| 32 | - try{ |
|
| 32 | + try { |
|
| 33 | 33 | $cache9 = $phpfastcache->get('apccache'); |
| 34 | 34 | $cache10 = $phpfastcache->get('apcucache'); |
| 35 | - }catch(PhpfastcacheDriverCheckException $e){ |
|
| 35 | + } catch (PhpfastcacheDriverCheckException $e) { |
|
| 36 | 36 | $cache11 = $phpfastcache->get('xcachecache'); |
| 37 | 37 | } |
| 38 | 38 | |
@@ -50,13 +50,13 @@ discard block |
||
| 50 | 50 | $item8 = $cache7->getItem('test2'); |
| 51 | 51 | $item9 = $cache8->getItem('test2'); |
| 52 | 52 | |
| 53 | - if(isset($cache9) && isset($cache10)) |
|
| 53 | + if (isset($cache9) && isset($cache10)) |
|
| 54 | 54 | { |
| 55 | 55 | $item10 = $cache9->getItem('test2'); |
| 56 | 56 | $item11 = $cache10->getItem('test2'); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - if(isset($cache11)) |
|
| 59 | + if (isset($cache11)) |
|
| 60 | 60 | { |
| 61 | 61 | $item12 = $cache11->getItem('test2'); |
| 62 | 62 | } |
@@ -80,13 +80,13 @@ discard block |
||
| 80 | 80 | $item8->set('Loaded from cache2')->expiresAfter(10); |
| 81 | 81 | $item9->set('Loaded from cache +' . str_repeat('-', rand(1000, 5000)))->expiresAfter(10); |
| 82 | 82 | |
| 83 | - if(isset($item10) && isset($item11)) |
|
| 83 | + if (isset($item10) && isset($item11)) |
|
| 84 | 84 | { |
| 85 | 85 | $item10->set('Loaded from cache +' . str_repeat('-', rand(1000, 5000)))->expiresAfter(10); |
| 86 | 86 | $item11->set('Loaded from cache +' . str_repeat('-', rand(1000, 5000)))->expiresAfter(10); |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - if(isset($item12)) |
|
| 89 | + if (isset($item12)) |
|
| 90 | 90 | { |
| 91 | 91 | $item12->set('Loaded from cache +' . str_repeat('-', rand(1000, 5000)))->expiresAfter(10); |
| 92 | 92 | } |
@@ -105,13 +105,13 @@ discard block |
||
| 105 | 105 | $cache7->save($item8); |
| 106 | 106 | $cache8->save($item9); |
| 107 | 107 | |
| 108 | - if(isset($cache9) && isset($cache10)) |
|
| 108 | + if (isset($cache9) && isset($cache10)) |
|
| 109 | 109 | { |
| 110 | 110 | $cache9->save($item10); |
| 111 | 111 | $cache10->save($item11); |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - if(isset($cache11)) |
|
| 114 | + if (isset($cache11)) |
|
| 115 | 115 | { |
| 116 | 116 | $cache11->save($item12); |
| 117 | 117 | } |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | // replace this example code with whatever you need |
| 126 | 126 | return $this->render('default/index.html.twig', [ |
| 127 | 127 | 'pfc_test' => $pfc_test, |
| 128 | - 'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..'), |
|
| 128 | + 'base_dir' => realpath($this->getParameter('kernel.root_dir') . '/..'), |
|
| 129 | 129 | ]); |
| 130 | 130 | } |
| 131 | 131 | } |
| 132 | 132 | \ No newline at end of file |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | if (!($cacheResponse instanceof Response)) { |
| 66 | 66 | $response = $callback(); |
| 67 | - if($response instanceof Response){ |
|
| 67 | + if ($response instanceof Response) { |
|
| 68 | 68 | $cacheItem->expiresAfter($expiresAfter); |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -80,10 +80,10 @@ discard block |
||
| 80 | 80 | $cacheItem->set($response); |
| 81 | 81 | $this->cacheInstance->save($cacheItem); |
| 82 | 82 | $cacheResponse = $response; |
| 83 | - }else{ |
|
| 83 | + } else { |
|
| 84 | 84 | throw new PhpfastcacheLogicException('Your callback response MUST return a valid Symfony HTTP Foundation Response object'); |
| 85 | 85 | } |
| 86 | - }else{ |
|
| 86 | + } else { |
|
| 87 | 87 | $cacheResponse->isNotModified($this->request); |
| 88 | 88 | } |
| 89 | 89 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | { |
| 55 | 55 | $this |
| 56 | 56 | ->setName('phpfastcache:del') |
| 57 | - ->setAliases([ 'phpfastcache:delete', 'phpfastcache:rem', 'phpfastcache:remove']) |
|
| 57 | + ->setAliases(['phpfastcache:delete', 'phpfastcache:rem', 'phpfastcache:remove']) |
|
| 58 | 58 | ->setDescription('Delete phpfastcache cache value') |
| 59 | 59 | ->addArgument( |
| 60 | 60 | 'driver', |
@@ -81,14 +81,14 @@ discard block |
||
| 81 | 81 | $driver = $input->getArgument('driver'); |
| 82 | 82 | $cacheKey = $input->getArgument('key'); |
| 83 | 83 | |
| 84 | - if (\array_key_exists($driver, $caches[ 'drivers' ])) { |
|
| 84 | + if (\array_key_exists($driver, $caches['drivers'])) { |
|
| 85 | 85 | $io->section($driver); |
| 86 | 86 | $driverInstance = $this->phpfastcache->get($driver); |
| 87 | 87 | $cacheItem = $driverInstance->getItem($cacheKey); |
| 88 | 88 | |
| 89 | - if(!$cacheItem->isHit()){ |
|
| 89 | + if (!$cacheItem->isHit()) { |
|
| 90 | 90 | $io->note(\sprintf('Cache item "%s" does not exists in the cache', $cacheKey)); |
| 91 | - }else{ |
|
| 91 | + } else { |
|
| 92 | 92 | $driverInstance->deleteItem($cacheItem->getKey()); |
| 93 | 93 | $io->success(\sprintf('Cache item "%s" has been deleted from cache', $cacheKey)); |
| 94 | 94 | } |