Completed
Branch master (329ddf)
by Georges
13:20
created
Twig/HumanReadableExtension.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
 class HumanReadableExtension extends \Twig_Extension
23 23
 {
24 24
     /**
25
-     * @return array
25
+     * @return \Twig_SimpleFilter[]
26 26
      */
27 27
     public function getFilters()
28 28
     {
Please login to merge, or discard this 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.
Docs/Example/app/AppKernel.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -8,18 +8,18 @@
 block discarded – undo
8 8
     public function registerBundles()
9 9
     {
10 10
         $bundles = [
11
-          new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
12
-          new Symfony\Bundle\SecurityBundle\SecurityBundle(),
13
-          new Symfony\Bundle\TwigBundle\TwigBundle(),
14
-          new Symfony\Bundle\MonologBundle\MonologBundle(),
15
-          new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
16
-          new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
17
-          new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
18
-          new AppBundle\AppBundle(),
11
+            new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
12
+            new Symfony\Bundle\SecurityBundle\SecurityBundle(),
13
+            new Symfony\Bundle\TwigBundle\TwigBundle(),
14
+            new Symfony\Bundle\MonologBundle\MonologBundle(),
15
+            new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
16
+            new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
17
+            new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
18
+            new AppBundle\AppBundle(),
19 19
             /**
20 20
              * PhpFastCache Bundle
21 21
              */
22
-          new phpFastCache\Bundle\phpFastCacheBundle(),
22
+            new phpFastCache\Bundle\phpFastCacheBundle(),
23 23
         ];
24 24
 
25 25
         if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -39,16 +39,16 @@
 block discarded – undo
39 39
 
40 40
     public function getCacheDir()
41 41
     {
42
-        return dirname(__DIR__).'/var/cache/'.$this->getEnvironment();
42
+        return dirname(__DIR__) . '/var/cache/' . $this->getEnvironment();
43 43
     }
44 44
 
45 45
     public function getLogDir()
46 46
     {
47
-        return dirname(__DIR__).'/var/logs';
47
+        return dirname(__DIR__) . '/var/logs';
48 48
     }
49 49
 
50 50
     public function registerContainerConfiguration(LoaderInterface $loader)
51 51
     {
52
-        $loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml');
52
+        $loader->load($this->getRootDir() . '/config/config_' . $this->getEnvironment() . '.yml');
53 53
     }
54 54
 }
Please login to merge, or discard this patch.
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
@@ -28,10 +28,10 @@  discard block
 block discarded – undo
28 28
         /**
29 29
          * Xcache and APC cannot coexists
30 30
          */
31
-        try{
31
+        try {
32 32
             $cache9 = $this->get('phpfastcache')->get('apccache');
33 33
             $cache10 = $this->get('phpfastcache')->get('apcucache');
34
-        }catch(phpFastCacheDriverCheckException $e){
34
+        } catch (phpFastCacheDriverCheckException $e) {
35 35
             $cache11 = $this->get('phpfastcache')->get('xcachecache');
36 36
         }
37 37
 
@@ -49,13 +49,13 @@  discard block
 block discarded – undo
49 49
         $item8 = $cache7->getItem('test2');
50 50
         $item9 = $cache8->getItem('test2');
51 51
 
52
-        if(isset($cache9) && isset($cache10))
52
+        if (isset($cache9) && isset($cache10))
53 53
         {
54 54
             $item10 = $cache9->getItem('test2');
55 55
             $item11 = $cache10->getItem('test2');
56 56
         }
57 57
 
58
-        if(isset($cache11))
58
+        if (isset($cache11))
59 59
         {
60 60
             $item12 = $cache11->getItem('test2');
61 61
         }
@@ -79,13 +79,13 @@  discard block
 block discarded – undo
79 79
             $item8->set('Loaded from cache2')->expiresAfter(10);
80 80
             $item9->set('Loaded from cache +' . str_repeat('-', rand(1000, 5000)))->expiresAfter(10);
81 81
 
82
-            if(isset($item10) && isset($item11))
82
+            if (isset($item10) && isset($item11))
83 83
             {
84 84
                 $item10->set('Loaded from cache +' . str_repeat('-', rand(1000, 5000)))->expiresAfter(10);
85 85
                 $item11->set('Loaded from cache +' . str_repeat('-', rand(1000, 5000)))->expiresAfter(10);
86 86
             }
87 87
 
88
-            if(isset($item12))
88
+            if (isset($item12))
89 89
             {
90 90
                 $item12->set('Loaded from cache +' . str_repeat('-', rand(1000, 5000)))->expiresAfter(10);
91 91
             }
@@ -104,13 +104,13 @@  discard block
 block discarded – undo
104 104
             $cache7->save($item8);
105 105
             $cache8->save($item9);
106 106
 
107
-            if(isset($cache9) && isset($cache10))
107
+            if (isset($cache9) && isset($cache10))
108 108
             {
109 109
                 $cache9->save($item10);
110 110
                 $cache10->save($item11);
111 111
             }
112 112
 
113
-            if(isset($cache11))
113
+            if (isset($cache11))
114 114
             {
115 115
                 $cache11->save($item12);
116 116
             }
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
         // replace this example code with whatever you need
125 125
         return $this->render('default/index.html.twig', [
126 126
           'pfc_test' => $pfc_test,
127
-          'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..'),
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.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
         try{
32 32
             $cache9 = $this->get('phpfastcache')->get('apccache');
33 33
             $cache10 = $this->get('phpfastcache')->get('apcucache');
34
-        }catch(phpFastCacheDriverCheckException $e){
34
+        } catch(phpFastCacheDriverCheckException $e){
35 35
             $cache11 = $this->get('phpfastcache')->get('xcachecache');
36 36
         }
37 37
 
Please login to merge, or discard this patch.
DataCollector/CacheCollector.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -46,26 +46,26 @@
 block discarded – undo
46 46
             }
47 47
             $stats[ $instanceName ] = $cache->getStats();
48 48
             $instances[ $instanceName ] = [
49
-              'driverName' => $cache->getDriverName(),
50
-              'driverConfig' => $cache->getConfig(),
49
+                'driverName' => $cache->getDriverName(),
50
+                'driverConfig' => $cache->getConfig(),
51 51
             ];
52 52
             $driverUsed[ $cache->getDriverName() ] = get_class($cache);
53 53
         }
54 54
 
55 55
         $this->data = [
56
-          'apiVersion' => phpFastCacheApi::getVersion(),
57
-          'apiChangelog' => phpFastCacheApi::getChangelog(),
58
-          'driverUsed' => $driverUsed,
59
-          'instances' => $instances,
60
-          'stats' => $stats,
61
-          'size' => $size,
62
-          'hits' => [
56
+            'apiVersion' => phpFastCacheApi::getVersion(),
57
+            'apiChangelog' => phpFastCacheApi::getChangelog(),
58
+            'driverUsed' => $driverUsed,
59
+            'instances' => $instances,
60
+            'stats' => $stats,
61
+            'size' => $size,
62
+            'hits' => [
63 63
             'read' => (int) CacheManager::$ReadHits,
64 64
             'write' => (int) CacheManager::$WriteHits,
65
-          ],
66
-          'coreConfig' => [
65
+            ],
66
+            'coreConfig' => [
67 67
             'namespacePath' => CacheManager::getNamespacePath()
68
-          ],
68
+            ],
69 69
         ];
70 70
     }
71 71
 
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -44,12 +44,12 @@  discard block
 block discarded – undo
44 44
             if ($cache->getStats()->getSize()) {
45 45
                 $size += $cache->getStats()->getSize();
46 46
             }
47
-            $stats[ $instanceName ] = $cache->getStats();
48
-            $instances[ $instanceName ] = [
47
+            $stats[$instanceName] = $cache->getStats();
48
+            $instances[$instanceName] = [
49 49
               'driverName' => $cache->getDriverName(),
50 50
               'driverConfig' => $cache->getConfig(),
51 51
             ];
52
-            $driverUsed[ $cache->getDriverName() ] = get_class($cache);
52
+            $driverUsed[$cache->getDriverName()] = get_class($cache);
53 53
         }
54 54
 
55 55
         $this->data = [
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
      */
75 75
     public function getStats()
76 76
     {
77
-        return $this->data[ 'stats' ];
77
+        return $this->data['stats'];
78 78
     }
79 79
 
80 80
     /**
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
      */
83 83
     public function getInstances()
84 84
     {
85
-        return $this->data[ 'instances' ];
85
+        return $this->data['instances'];
86 86
     }
87 87
 
88 88
     /**
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
      */
91 91
     public function getDriverUsed()
92 92
     {
93
-        return $this->data[ 'driverUsed' ];
93
+        return $this->data['driverUsed'];
94 94
     }
95 95
 
96 96
     /**
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
      */
99 99
     public function getHits()
100 100
     {
101
-        return $this->data[ 'hits' ];
101
+        return $this->data['hits'];
102 102
     }
103 103
 
104 104
     /**
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
      */
107 107
     public function getSize()
108 108
     {
109
-        return $this->data[ 'size' ];
109
+        return $this->data['size'];
110 110
     }
111 111
 
112 112
     /**
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
      */
115 115
     public function getCoreConfig()
116 116
     {
117
-        return $this->data[ 'coreConfig' ];
117
+        return $this->data['coreConfig'];
118 118
     }
119 119
 
120 120
     /**
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
      */
123 123
     public function getApiVersion()
124 124
     {
125
-        return $this->data[ 'apiVersion' ];
125
+        return $this->data['apiVersion'];
126 126
     }
127 127
 
128 128
     /**
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
      */
131 131
     public function getApiChangelog()
132 132
     {
133
-        return $this->data[ 'apiChangelog' ];
133
+        return $this->data['apiChangelog'];
134 134
     }
135 135
 
136 136
     /**
Please login to merge, or discard this patch.
Command/phpFastCacheCommand.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -57,11 +57,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
DependencyInjection/phpFastCacheExtension.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
      */
40 40
     public function load(array $configs, ContainerBuilder $container)
41 41
     {
42
-        $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
42
+        $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
43 43
         $loader->load('services.yml');
44 44
 
45 45
         $configuration = new Configuration();
Please login to merge, or discard this patch.
Service/Cache.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      */
54 54
     public function __construct($drivers, Stopwatch $stopwatch = null)
55 55
     {
56
-        $this->drivers = (array) $drivers[ 'drivers' ];
56
+        $this->drivers = (array) $drivers['drivers'];
57 57
         $this->stopwatch = $stopwatch;
58 58
     }
59 59
 
@@ -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
     /**
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
 
91 91
         if (!array_key_exists($name, $this->cacheInstances)) {
92 92
             if (array_key_exists($name, $this->drivers)) {
93
-                $this->createInstance($name, CacheManager::getInstance($this->drivers[ $name ][ 'type' ], $this->drivers[ $name ][ 'parameters' ]));
94
-                if (!$this->cacheInstances[ $name ] instanceof ExtendedCacheItemPoolInterface) {
93
+                $this->createInstance($name, CacheManager::getInstance($this->drivers[$name]['type'], $this->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
     /**
Please login to merge, or discard this patch.