Completed
Push — V3 ( 7c7d16...167141 )
by Georges
01:47
created
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/Node/CacheNode.php 1 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/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.
src/Resources/Docs/example/Controller/DefaultController.php 2 patches
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.