@@ -41,9 +41,9 @@ |
||
| 41 | 41 | { |
| 42 | 42 | $bytes = (int) $bytes; |
| 43 | 43 | $sz = 'BKMGTP'; |
| 44 | - $factor = floor(( strlen($bytes) - 1 ) / 3); |
|
| 44 | + $factor = floor((strlen($bytes) - 1) / 3); |
|
| 45 | 45 | |
| 46 | - return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)).@$sz[ $factor ].( $factor ? ($octetFormat ? 'O' : 'B') : '' ); |
|
| 46 | + return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . @$sz[$factor] . ($factor ? ($octetFormat ? 'O' : 'B') : ''); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | $callback = function($name) use ($phpFastCache, $output, &$failedInstances) |
| 51 | 51 | { |
| 52 | - try{ |
|
| 52 | + try { |
|
| 53 | 53 | if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) { |
| 54 | 54 | $output->writeln("<fg=yellow>Clearing instance {$name} cache...</>"); |
| 55 | 55 | } |
@@ -57,35 +57,35 @@ discard block |
||
| 57 | 57 | if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) { |
| 58 | 58 | $output->writeln("<fg=green>Cache instance {$name} cleared</>"); |
| 59 | 59 | } |
| 60 | - }catch (phpFastCacheDriverCheckException $e){ |
|
| 60 | + } catch (phpFastCacheDriverCheckException $e) { |
|
| 61 | 61 | $failedInstances[] = $name; |
| 62 | 62 | if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) { |
| 63 | - $output->writeln("<fg=red>Cache instance {$name} not cleared, got exception: " . "<bg=red;options=bold>" . $e->getMessage() ."</>"); |
|
| 64 | - }else{ |
|
| 63 | + $output->writeln("<fg=red>Cache instance {$name} not cleared, got exception: " . "<bg=red;options=bold>" . $e->getMessage() . "</>"); |
|
| 64 | + } else { |
|
| 65 | 65 | $output->writeln("<fg=red>Cache instance {$name} not cleared (increase verbosity to get more information).</>"); |
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | }; |
| 69 | 69 | $caches = $this->getContainer()->getParameter('phpfastcache'); |
| 70 | 70 | |
| 71 | - if($driver) { |
|
| 72 | - if(array_key_exists($driver, $caches['drivers'])){ |
|
| 71 | + if ($driver) { |
|
| 72 | + if (array_key_exists($driver, $caches['drivers'])) { |
|
| 73 | 73 | $callback($driver); |
| 74 | - if(!count($failedInstances)){ |
|
| 74 | + if (!count($failedInstances)) { |
|
| 75 | 75 | $io->success("Cache instance {$driver} cleared"); |
| 76 | - }else{ |
|
| 76 | + } else { |
|
| 77 | 77 | $io->error("Cache instance {$driver} not cleared"); |
| 78 | 78 | } |
| 79 | - }else{ |
|
| 79 | + } else { |
|
| 80 | 80 | $io->error("Cache instance {$driver} does not exists"); |
| 81 | 81 | } |
| 82 | 82 | } else { |
| 83 | - foreach($caches['drivers'] as $name => $parameters) { |
|
| 83 | + foreach ($caches['drivers'] as $name => $parameters) { |
|
| 84 | 84 | $callback($name); |
| 85 | 85 | } |
| 86 | - if(!count($failedInstances)){ |
|
| 86 | + if (!count($failedInstances)) { |
|
| 87 | 87 | $io->success('All caches instances got cleared'); |
| 88 | - }else{ |
|
| 88 | + } else { |
|
| 89 | 89 | $io->success('Almost all caches instances got cleared, except these: ' . implode(', ', $failedInstances)); |
| 90 | 90 | } |
| 91 | 91 | } |
@@ -57,11 +57,11 @@ discard block |
||
| 57 | 57 | if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) { |
| 58 | 58 | $output->writeln("<fg=green>Cache instance {$name} cleared</>"); |
| 59 | 59 | } |
| 60 | - }catch (phpFastCacheDriverCheckException $e){ |
|
| 60 | + } catch (phpFastCacheDriverCheckException $e){ |
|
| 61 | 61 | $failedInstances[] = $name; |
| 62 | 62 | if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) { |
| 63 | 63 | $output->writeln("<fg=red>Cache instance {$name} not cleared, got exception: " . "<bg=red;options=bold>" . $e->getMessage() ."</>"); |
| 64 | - }else{ |
|
| 64 | + } else{ |
|
| 65 | 65 | $output->writeln("<fg=red>Cache instance {$name} not cleared (increase verbosity to get more information).</>"); |
| 66 | 66 | } |
| 67 | 67 | } |
@@ -73,10 +73,10 @@ discard block |
||
| 73 | 73 | $callback($driver); |
| 74 | 74 | if(!count($failedInstances)){ |
| 75 | 75 | $io->success("Cache instance {$driver} cleared"); |
| 76 | - }else{ |
|
| 76 | + } else{ |
|
| 77 | 77 | $io->error("Cache instance {$driver} not cleared"); |
| 78 | 78 | } |
| 79 | - }else{ |
|
| 79 | + } else{ |
|
| 80 | 80 | $io->error("Cache instance {$driver} does not exists"); |
| 81 | 81 | } |
| 82 | 82 | } else { |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | } |
| 86 | 86 | if(!count($failedInstances)){ |
| 87 | 87 | $io->success('All caches instances got cleared'); |
| 88 | - }else{ |
|
| 88 | + } else{ |
|
| 89 | 89 | $io->success('Almost all caches instances got cleared, except these: ' . implode(', ', $failedInstances)); |
| 90 | 90 | } |
| 91 | 91 | } |
@@ -67,10 +67,10 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | public function createInstance($name, ExtendedCacheItemPoolInterface $instance) |
| 69 | 69 | { |
| 70 | - if (array_key_exists($name, $this->cacheInstances) && $this->cacheInstances[ $name ] instanceof ExtendedCacheItemPoolInterface) { |
|
| 70 | + if (array_key_exists($name, $this->cacheInstances) && $this->cacheInstances[$name] instanceof ExtendedCacheItemPoolInterface) { |
|
| 71 | 71 | throw new phpFastCacheDriverException("Cache instance '{$name}' already exists"); |
| 72 | 72 | } |
| 73 | - $this->cacheInstances[ $name ] = $instance; |
|
| 73 | + $this->cacheInstances[$name] = $instance; |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
@@ -89,9 +89,9 @@ discard block |
||
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | if (!array_key_exists($name, $this->cacheInstances)) { |
| 92 | - if (array_key_exists($name, $this->config[ 'drivers' ])) { |
|
| 93 | - $this->createInstance($name, CacheManager::getInstance($this->config[ 'drivers' ][ $name ][ 'type' ], $this->config[ 'drivers' ][ $name ][ 'parameters' ])); |
|
| 94 | - if (!$this->cacheInstances[ $name ] instanceof ExtendedCacheItemPoolInterface) { |
|
| 92 | + if (array_key_exists($name, $this->config['drivers'])) { |
|
| 93 | + $this->createInstance($name, CacheManager::getInstance($this->config['drivers'][$name]['type'], $this->config['drivers'][$name]['parameters'])); |
|
| 94 | + if (!$this->cacheInstances[$name] instanceof ExtendedCacheItemPoolInterface) { |
|
| 95 | 95 | throw new phpFastCacheDriverException("Cache instance '{$name}' does not implements ExtendedCacheItemPoolInterface"); |
| 96 | 96 | } |
| 97 | 97 | } else { |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | if ($this->stopwatch) { |
| 103 | 103 | $this->stopwatch->stop(__METHOD__ . "('{$name}')"); |
| 104 | 104 | } |
| 105 | - return $this->cacheInstances[ $name ]; |
|
| 105 | + return $this->cacheInstances[$name]; |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | /** |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | */ |
| 111 | 111 | public function getTwigCacheInstance() |
| 112 | 112 | { |
| 113 | - return $this->get($this->config[ 'twig_driver' ]); |
|
| 113 | + return $this->get($this->config['twig_driver']); |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | /** |
@@ -40,14 +40,14 @@ |
||
| 40 | 40 | */ |
| 41 | 41 | public function load(array $configs, ContainerBuilder $container) |
| 42 | 42 | { |
| 43 | - $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
|
| 43 | + $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); |
|
| 44 | 44 | $loader->load('services.yml'); |
| 45 | 45 | |
| 46 | 46 | /** |
| 47 | 47 | * Includes services_dev.yml only |
| 48 | 48 | * if we are in debug mode |
| 49 | 49 | */ |
| 50 | - if(in_array($container->getParameter('kernel.environment'), ['dev', 'test'])){ |
|
| 50 | + if (in_array($container->getParameter('kernel.environment'), ['dev', 'test'])) { |
|
| 51 | 51 | $loader->load('services_dev.yml'); |
| 52 | 52 | } |
| 53 | 53 | |
@@ -65,32 +65,32 @@ |
||
| 65 | 65 | } |
| 66 | 66 | $stats[ $instanceName ] = $cache->getStats(); |
| 67 | 67 | $instances[ $instanceName ] = [ |
| 68 | - 'driverName' => $cache->getDriverName(), |
|
| 69 | - 'driverConfig' => $cache->getConfig(), |
|
| 68 | + 'driverName' => $cache->getDriverName(), |
|
| 69 | + 'driverConfig' => $cache->getConfig(), |
|
| 70 | 70 | ]; |
| 71 | 71 | $driverUsed[ $cache->getDriverName() ] = get_class($cache); |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | $this->data = [ |
| 75 | - 'twigCacheBlocks' => $this->twig_cache_blocks, |
|
| 76 | - 'apiVersion' => phpFastCacheApi::getVersion(), |
|
| 77 | - 'bundleVersion' => phpFastCacheBundle::VERSION, |
|
| 78 | - 'apiChangelog' => phpFastCacheApi::getChangelog(), |
|
| 79 | - 'driverUsed' => $driverUsed, |
|
| 80 | - 'instances' => $instances, |
|
| 81 | - 'stats' => $stats, |
|
| 82 | - 'size' => $size, |
|
| 83 | - 'hits' => [ |
|
| 75 | + 'twigCacheBlocks' => $this->twig_cache_blocks, |
|
| 76 | + 'apiVersion' => phpFastCacheApi::getVersion(), |
|
| 77 | + 'bundleVersion' => phpFastCacheBundle::VERSION, |
|
| 78 | + 'apiChangelog' => phpFastCacheApi::getChangelog(), |
|
| 79 | + 'driverUsed' => $driverUsed, |
|
| 80 | + 'instances' => $instances, |
|
| 81 | + 'stats' => $stats, |
|
| 82 | + 'size' => $size, |
|
| 83 | + 'hits' => [ |
|
| 84 | 84 | 'read' => (int) CacheManager::$ReadHits, |
| 85 | 85 | 'write' => (int) CacheManager::$WriteHits, |
| 86 | - ], |
|
| 87 | - 'coreConfig' => [ |
|
| 86 | + ], |
|
| 87 | + 'coreConfig' => [ |
|
| 88 | 88 | 'namespacePath' => CacheManager::getNamespacePath(), |
| 89 | - ], |
|
| 90 | - 'projectConfig' => [ |
|
| 89 | + ], |
|
| 90 | + 'projectConfig' => [ |
|
| 91 | 91 | 'twig_driver' => $this->cache->getConfig()['twig_driver'], |
| 92 | 92 | 'twig_block_debug' => $this->cache->getConfig()['twig_block_debug'], |
| 93 | - ], |
|
| 93 | + ], |
|
| 94 | 94 | ]; |
| 95 | 95 | } |
| 96 | 96 | |
@@ -63,12 +63,12 @@ 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 | 69 | 'driverConfig' => $cache->getConfig(), |
| 70 | 70 | ]; |
| 71 | - $driverUsed[ $cache->getDriverName() ] = get_class($cache); |
|
| 71 | + $driverUsed[$cache->getDriverName()] = get_class($cache); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | $this->data = [ |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | public function getStats() |
| 101 | 101 | { |
| 102 | - return $this->data[ 'stats' ]; |
|
| 102 | + return $this->data['stats']; |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | public function getInstances() |
| 109 | 109 | { |
| 110 | - return $this->data[ 'instances' ]; |
|
| 110 | + return $this->data['instances']; |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | /** |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | */ |
| 116 | 116 | public function getDriverUsed() |
| 117 | 117 | { |
| 118 | - return $this->data[ 'driverUsed' ]; |
|
| 118 | + return $this->data['driverUsed']; |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | /** |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | */ |
| 124 | 124 | public function getHits() |
| 125 | 125 | { |
| 126 | - return $this->data[ 'hits' ]; |
|
| 126 | + return $this->data['hits']; |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | /** |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | */ |
| 132 | 132 | public function getSize() |
| 133 | 133 | { |
| 134 | - return $this->data[ 'size' ]; |
|
| 134 | + return $this->data['size']; |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | /** |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | */ |
| 140 | 140 | public function getCoreConfig() |
| 141 | 141 | { |
| 142 | - return $this->data[ 'coreConfig' ]; |
|
| 142 | + return $this->data['coreConfig']; |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | /** |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | */ |
| 148 | 148 | public function getProjectConfig() |
| 149 | 149 | { |
| 150 | - return $this->data[ 'projectConfig' ]; |
|
| 150 | + return $this->data['projectConfig']; |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | /** |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | */ |
| 156 | 156 | public function getApiVersion() |
| 157 | 157 | { |
| 158 | - return $this->data[ 'apiVersion' ]; |
|
| 158 | + return $this->data['apiVersion']; |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | /** |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | */ |
| 164 | 164 | public function getBundleVersion() |
| 165 | 165 | { |
| 166 | - return $this->data[ 'bundleVersion' ]; |
|
| 166 | + return $this->data['bundleVersion']; |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | /** |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | */ |
| 172 | 172 | public function getApiChangelog() |
| 173 | 173 | { |
| 174 | - return $this->data[ 'apiChangelog' ]; |
|
| 174 | + return $this->data['apiChangelog']; |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | /** |
@@ -181,9 +181,9 @@ discard block |
||
| 181 | 181 | */ |
| 182 | 182 | public function setTwigCacheBlock($blockName, array $cacheBlock) |
| 183 | 183 | { |
| 184 | - if(isset($this->twig_cache_blocks[$blockName])){ |
|
| 184 | + if (isset($this->twig_cache_blocks[$blockName])) { |
|
| 185 | 185 | $this->twig_cache_blocks[$blockName] = array_merge($this->twig_cache_blocks[$blockName], $cacheBlock); |
| 186 | - }else{ |
|
| 186 | + } else { |
|
| 187 | 187 | $this->twig_cache_blocks[$blockName] = $cacheBlock; |
| 188 | 188 | } |
| 189 | 189 | |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | */ |
| 197 | 197 | public function getTwigCacheBlocks() |
| 198 | 198 | { |
| 199 | - return $this->data[ 'twigCacheBlocks' ]; |
|
| 199 | + return $this->data['twigCacheBlocks']; |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | /** |
@@ -183,7 +183,7 @@ |
||
| 183 | 183 | { |
| 184 | 184 | if(isset($this->twig_cache_blocks[$blockName])){ |
| 185 | 185 | $this->twig_cache_blocks[$blockName] = array_merge($this->twig_cache_blocks[$blockName], $cacheBlock); |
| 186 | - }else{ |
|
| 186 | + } else{ |
|
| 187 | 187 | $this->twig_cache_blocks[$blockName] = $cacheBlock; |
| 188 | 188 | } |
| 189 | 189 | |
@@ -41,9 +41,9 @@ |
||
| 41 | 41 | { |
| 42 | 42 | $bytes = (int) $bytes; |
| 43 | 43 | $sz = 'BKMGTP'; |
| 44 | - $factor = floor(( strlen($bytes) - 1 ) / 3); |
|
| 44 | + $factor = floor((strlen($bytes) - 1) / 3); |
|
| 45 | 45 | |
| 46 | - return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)).@$sz[ $factor ].( $factor ? ($octetFormat ? 'O' : 'B') : '' ); |
|
| 46 | + return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . @$sz[$factor] . ($factor ? ($octetFormat ? 'O' : 'B') : ''); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
@@ -77,10 +77,10 @@ discard block |
||
| 77 | 77 | |
| 78 | 78 | if($this->cacheCollector instanceof CacheCollector){ |
| 79 | 79 | $this->cacheCollector->setTwigCacheBlock($unprefixedKey, [ |
| 80 | - 'cacheHit' => $cacheData !== null, |
|
| 81 | - 'cacheTtl' => $key['lifetime'], |
|
| 82 | - 'cacheSize' => mb_strlen((string) $cacheData), |
|
| 83 | - 'cacheGenTime' => $generationTime |
|
| 80 | + 'cacheHit' => $cacheData !== null, |
|
| 81 | + 'cacheTtl' => $key['lifetime'], |
|
| 82 | + 'cacheSize' => mb_strlen((string) $cacheData), |
|
| 83 | + 'cacheGenTime' => $generationTime |
|
| 84 | 84 | ]); |
| 85 | 85 | } |
| 86 | 86 | |
@@ -115,10 +115,10 @@ discard block |
||
| 115 | 115 | |
| 116 | 116 | if($this->cacheCollector instanceof CacheCollector){ |
| 117 | 117 | $this->cacheCollector->setTwigCacheBlock($unprefixedKey, [ |
| 118 | - 'cacheHit' => false, |
|
| 119 | - 'cacheTtl' => $key['lifetime'], |
|
| 120 | - 'cacheSize' => mb_strlen((string) $block), |
|
| 121 | - 'cacheGenTime' => $generationTime |
|
| 118 | + 'cacheHit' => false, |
|
| 119 | + 'cacheTtl' => $key['lifetime'], |
|
| 120 | + 'cacheSize' => mb_strlen((string) $block), |
|
| 121 | + 'cacheGenTime' => $generationTime |
|
| 122 | 122 | ]); |
| 123 | 123 | } |
| 124 | 124 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | $generationTime = microtime(true) - $generationTimeMc; |
| 76 | 76 | $unprefixedKey = substr($key['key'], strlen($this->twigCachePrefix)); |
| 77 | 77 | |
| 78 | - if($this->cacheCollector instanceof CacheCollector){ |
|
| 78 | + if ($this->cacheCollector instanceof CacheCollector) { |
|
| 79 | 79 | $this->cacheCollector->setTwigCacheBlock($unprefixedKey, [ |
| 80 | 80 | 'cacheHit' => $cacheData !== null, |
| 81 | 81 | 'cacheTtl' => $key['lifetime'], |
@@ -84,9 +84,9 @@ discard block |
||
| 84 | 84 | ]); |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - if(!empty($cacheData) && $this->config['twig_block_debug']){ |
|
| 87 | + if (!empty($cacheData) && $this->config['twig_block_debug']) { |
|
| 88 | 88 | return "<!-- BEGIN CACHE BLOCK OUTPUT '{$unprefixedKey}' -->\n{$cacheData}\n<!-- // END CACHE BLOCK OUTPUT '{$unprefixedKey}' -->"; |
| 89 | - }else{ |
|
| 89 | + } else { |
|
| 90 | 90 | return $cacheData; |
| 91 | 91 | } |
| 92 | 92 | } |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | { |
| 114 | 114 | $unprefixedKey = substr($key['key'], strlen($this->twigCachePrefix)); |
| 115 | 115 | |
| 116 | - if($this->cacheCollector instanceof CacheCollector){ |
|
| 116 | + if ($this->cacheCollector instanceof CacheCollector) { |
|
| 117 | 117 | $this->cacheCollector->setTwigCacheBlock($unprefixedKey, [ |
| 118 | 118 | 'cacheHit' => false, |
| 119 | 119 | 'cacheTtl' => $key['lifetime'], |
@@ -86,7 +86,7 @@ |
||
| 86 | 86 | |
| 87 | 87 | if(!empty($cacheData) && $this->config['twig_block_debug']){ |
| 88 | 88 | return "<!-- BEGIN CACHE BLOCK OUTPUT '{$unprefixedKey}' -->\n{$cacheData}\n<!-- // END CACHE BLOCK OUTPUT '{$unprefixedKey}' -->"; |
| 89 | - }else{ |
|
| 89 | + } else{ |
|
| 90 | 90 | return $cacheData; |
| 91 | 91 | } |
| 92 | 92 | } |
@@ -53,14 +53,14 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | $compiler |
| 55 | 55 | ->addDebugInfo($this) |
| 56 | - ->write("\$phpfastcacheCacheStrategy".$i." = \$this->env->getExtension('{$extension}')->getCacheStrategy();\n") |
|
| 57 | - ->write("\$phpfastcacheKey".$i." = \$phpfastcacheCacheStrategy".$i."->generateKey(") |
|
| 56 | + ->write("\$phpfastcacheCacheStrategy" . $i . " = \$this->env->getExtension('{$extension}')->getCacheStrategy();\n") |
|
| 57 | + ->write("\$phpfastcacheKey" . $i . " = \$phpfastcacheCacheStrategy" . $i . "->generateKey(") |
|
| 58 | 58 | ->subcompile($this->getNode('annotation')) |
| 59 | 59 | ->raw(", ") |
| 60 | 60 | ->subcompile($this->getNode('key_info')) |
| 61 | 61 | ->write(");\n") |
| 62 | - ->write("\$phpfastcacheCacheBody".$i." = \$phpfastcacheCacheStrategy".$i."->fetchBlock(\$phpfastcacheKey".$i.");\n") |
|
| 63 | - ->write("if (\$phpfastcacheCacheBody".$i." === false) {\n") |
|
| 62 | + ->write("\$phpfastcacheCacheBody" . $i . " = \$phpfastcacheCacheStrategy" . $i . "->fetchBlock(\$phpfastcacheKey" . $i . ");\n") |
|
| 63 | + ->write("if (\$phpfastcacheCacheBody" . $i . " === false) {\n") |
|
| 64 | 64 | ->indent() |
| 65 | 65 | ->write("ob_start();\n") |
| 66 | 66 | ->write("\$compileMc = microtime(true);\n") |
@@ -69,11 +69,11 @@ discard block |
||
| 69 | 69 | ->outdent() |
| 70 | 70 | ->write("\n") |
| 71 | 71 | // ->write("sleep(2);\n") // For debug purpose |
| 72 | - ->write("\$phpfastcacheCacheBody".$i." = ob_get_clean();\n") |
|
| 73 | - ->write("\$phpfastcacheCacheStrategy".$i."->saveBlock(\$phpfastcacheKey".$i.", \$phpfastcacheCacheBody".$i.", microtime(true) - \$compileMc);\n") |
|
| 72 | + ->write("\$phpfastcacheCacheBody" . $i . " = ob_get_clean();\n") |
|
| 73 | + ->write("\$phpfastcacheCacheStrategy" . $i . "->saveBlock(\$phpfastcacheKey" . $i . ", \$phpfastcacheCacheBody" . $i . ", microtime(true) - \$compileMc);\n") |
|
| 74 | 74 | ->outdent() |
| 75 | 75 | ->write("}\n") |
| 76 | - ->write("echo \$phpfastcacheCacheBody".$i.";\n") |
|
| 76 | + ->write("echo \$phpfastcacheCacheBody" . $i . ";\n") |
|
| 77 | 77 | ; |
| 78 | 78 | } |
| 79 | 79 | } |