Completed
Push — master ( 7e7da0...18ecc7 )
by Georges
01:55
created
src/DependencyInjection/PhpfastcacheExtension.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,14 +37,14 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Resources/Docs/example/Controller/DefaultController.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -123,8 +123,8 @@
 block discarded – undo
123 123
 
124 124
         // replace this example code with whatever you need
125 125
         return $this->render('default/index.html.twig', [
126
-          'pfc_test' => $pfc_test,
127
-          'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..'),
126
+            'pfc_test' => $pfc_test,
127
+            'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..'),
128 128
         ]);
129 129
     }
130 130
 }
131 131
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -29,10 +29,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 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
 
Please login to merge, or discard this patch.
src/Service/Phpfastcache.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -97,11 +97,11 @@
 block discarded – undo
97 97
                     $configClass = $driverClass::getConfigClass();
98 98
                     if(\class_exists($configClass)){
99 99
                         $this->createInstance(
100
-                          $name,
101
-                          CacheManager::getInstance(
100
+                            $name,
101
+                            CacheManager::getInstance(
102 102
                             $this->config[ 'drivers' ][ $name ][ 'type' ],
103 103
                             new $configClass($this->config[ 'drivers' ][ $name ][ 'parameters' ])
104
-                          )
104
+                            )
105 105
                         );
106 106
                     }else{
107 107
                         throw new PhpfastcacheInvalidConfigurationException('Invalid configuration class name: ' . $configClass);
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@
 block discarded – undo
103 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
                 }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -68,10 +68,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     /**
Please login to merge, or discard this patch.
src/Twig/CacheExtension/Extension.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
     public function getTokenParsers()
60 60
     {
61 61
         return [
62
-          new TokenParser\Cache(),
62
+            new TokenParser\Cache(),
63 63
         ];
64 64
     }
65 65
 }
Please login to merge, or discard this patch.
src/Twig/HumanReadableExtension/Extension.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
     public function getFilters()
29 29
     {
30 30
         return [
31
-          new \Twig_SimpleFilter('sizeFormat', [$this, 'size_format']),
31
+            new \Twig_SimpleFilter('sizeFormat', [$this, 'size_format']),
32 32
         ];
33 33
     }
34 34
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,11 +42,11 @@
 block discarded – undo
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
     /**
Please login to merge, or discard this patch.
src/Twig/CacheExtension/Node/CacheNode.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -36,9 +36,9 @@
 block discarded – undo
36 36
     public function __construct(\Twig_Node_Expression $annotation, \Twig_Node_Expression $keyInfo, \Twig_Node $body, $lineno, $tag = null)
37 37
     {
38 38
         parent::__construct([
39
-          'key_info' => $keyInfo,
40
-          'body' => $body,
41
-          'annotation' => $annotation
39
+            'key_info' => $keyInfo,
40
+            'body' => $body,
41
+            'annotation' => $annotation
42 42
         ], [], $lineno, $tag);
43 43
     }
44 44
 
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -58,14 +58,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/DataCollector/CacheCollector.php 3 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -65,35 +65,35 @@
 block discarded – undo
65 65
             }
66 66
             $stats[ $instanceName ] = $cache->getStats();
67 67
             $instances[ $instanceName ] = [
68
-              'driverName' => $cache->getDriverName(),
69
-              'configClassName' => \get_class( $cache->getConfig()),
70
-              'driverConfig' => $cache->getConfig()->toArray()
68
+                'driverName' => $cache->getDriverName(),
69
+                'configClassName' => \get_class( $cache->getConfig()),
70
+                'driverConfig' => $cache->getConfig()->toArray()
71 71
             ];
72 72
             $driverUsed[ $cache->getDriverName() ] = \get_class($cache);
73 73
         }
74 74
 
75 75
         $this->data = [
76
-          'twigCacheBlocks' => $this->twig_cache_blocks,
77
-          'apiVersion' => PhpfastcacheApi::getVersion(),
78
-          'pfcVersion' => PhpfastcacheApi::getPhpFastCacheVersion(),
79
-          'bundleVersion' => phpFastCacheBundle::VERSION,
80
-          'apiChangelog' => PhpfastcacheApi::getChangelog(),
81
-          'driverUsed' => $driverUsed,
82
-          'instances' => $instances,
83
-          'stats' => $stats,
84
-          'size' => $size,
85
-          'hits' => [
76
+            'twigCacheBlocks' => $this->twig_cache_blocks,
77
+            'apiVersion' => PhpfastcacheApi::getVersion(),
78
+            'pfcVersion' => PhpfastcacheApi::getPhpFastCacheVersion(),
79
+            'bundleVersion' => phpFastCacheBundle::VERSION,
80
+            'apiChangelog' => PhpfastcacheApi::getChangelog(),
81
+            'driverUsed' => $driverUsed,
82
+            'instances' => $instances,
83
+            'stats' => $stats,
84
+            'size' => $size,
85
+            'hits' => [
86 86
             'read' => (int) CacheManager::$ReadHits,
87 87
             'write' => (int) CacheManager::$WriteHits,
88
-          ],
89
-          'coreConfig' => [
88
+            ],
89
+            'coreConfig' => [
90 90
             'driverList' => CacheManager::getDriverList(true),
91 91
             'namespacePath (deprecated)' => CacheManager::getNamespacePath(),
92
-          ],
93
-          'projectConfig' => [
92
+            ],
93
+            'projectConfig' => [
94 94
             'twig_driver' => $this->phpfastcache->getConfig()['twig_driver'],
95 95
             'twig_block_debug' => $this->phpfastcache->getConfig()['twig_block_debug'],
96
-          ],
96
+            ],
97 97
         ];
98 98
     }
99 99
 
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     /**
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -194,7 +194,7 @@
 block discarded – undo
194 194
     {
195 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
 
Please login to merge, or discard this patch.
src/Twig/CacheExtension/CacheStrategyInterface.php 1 patch
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -48,9 +48,9 @@
 block discarded – undo
48 48
      *
49 49
      * @param mixed  $key
50 50
      * @param string $block
51
-     * @param int $generationTime
51
+     * @param int $generationTim
52 52
      *
53
-     * @return mixed
53
+     * @return boolean
54 54
      */
55 55
     public function saveBlock($key, $block, $generationTim, \Twig_Source $sourceContext);
56 56
 }
Please login to merge, or discard this patch.
src/Twig/CacheExtension/CacheStrategy/LifetimeCacheStrategy.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -78,12 +78,12 @@  discard block
 block discarded – undo
78 78
 
79 79
         if ($this->cacheCollector instanceof CacheCollector) {
80 80
             $this->cacheCollector->setTwigCacheBlock($unprefixedKey, [
81
-              'cacheHit' => $cacheData !== null,
82
-              'cacheTtl' => $key[ 'lifetime' ],
83
-              'cacheSize' => mb_strlen((string)$cacheData),
84
-              'cacheGenTime' => $generationTime,
85
-              'cacheFileName' => $sourceContext->getName(),
86
-              'cacheFilePath' => $sourceContext->getPath(),
81
+                'cacheHit' => $cacheData !== null,
82
+                'cacheTtl' => $key[ 'lifetime' ],
83
+                'cacheSize' => mb_strlen((string)$cacheData),
84
+                'cacheGenTime' => $generationTime,
85
+                'cacheFileName' => $sourceContext->getName(),
86
+                'cacheFilePath' => $sourceContext->getPath(),
87 87
             ]);
88 88
         }
89 89
 
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
         }
105 105
 
106 106
         return [
107
-          'lifetime' => $value,
108
-          'key' => $this->twigCachePrefix . $annotation,
107
+            'lifetime' => $value,
108
+            'key' => $this->twigCachePrefix . $annotation,
109 109
         ];
110 110
     }
111 111
 
@@ -118,12 +118,12 @@  discard block
 block discarded – undo
118 118
 
119 119
         if ($this->cacheCollector instanceof CacheCollector) {
120 120
             $this->cacheCollector->setTwigCacheBlock($unprefixedKey, [
121
-              'cacheHit' => false,
122
-              'cacheTtl' => $key[ 'lifetime' ],
123
-              'cacheSize' => \mb_strlen((string)$block),
124
-              'cacheGenTime' => $generationTime,
125
-              'cacheFileName' => $sourceContext->getName(),
126
-              'cacheFilePath' => $sourceContext->getPath(),
121
+                'cacheHit' => false,
122
+                'cacheTtl' => $key[ 'lifetime' ],
123
+                'cacheSize' => \mb_strlen((string)$block),
124
+                'cacheGenTime' => $generationTime,
125
+                'cacheFileName' => $sourceContext->getName(),
126
+                'cacheFilePath' => $sourceContext->getPath(),
127 127
             ]);
128 128
         }
129 129
 
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -72,22 +72,22 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.