Completed
Push — master ( c8fd93...a9ab00 )
by Georges
01:49
created
Service/Cache.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     /**
Please login to merge, or discard this patch.
DependencyInjection/phpFastCacheExtension.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,14 +40,14 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
DataCollector/CacheCollector.php 3 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -65,32 +65,32 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -63,12 +63,12 @@  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 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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     /**
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -183,7 +183,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Twig/HumanReadableExtension/Extension.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,9 +41,9 @@
 block discarded – undo
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
     /**
Please login to merge, or discard this patch.
Twig/CacheExtension/CacheStrategy/LifetimeCacheStrategy.php 3 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -77,10 +77,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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'],
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
Twig/CacheExtension/Node/CacheNode.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -53,14 +53,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.