Completed
Push — v5 ( 7507e4...206e9b )
by Georges
03:31 queued 12s
created
src/phpFastCache/Drivers/Apcu/Driver.php 3 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -136,9 +136,9 @@
 block discarded – undo
136 136
         $date = (new \DateTime())->setTimestamp($stats[ 'start_time' ]);
137 137
 
138 138
         return (new driverStatistic())
139
-          ->setData(implode(', ', array_keys($this->itemInstances)))
140
-          ->setInfo(sprintf("The APCU cache is up since %s, and have %d item(s) in cache.\n For more information see RawData.", $date->format(DATE_RFC2822), $stats[ 'num_entries' ]))
141
-          ->setRawData($stats)
142
-          ->setSize($stats[ 'mem_size' ]);
139
+            ->setData(implode(', ', array_keys($this->itemInstances)))
140
+            ->setInfo(sprintf("The APCU cache is up since %s, and have %d item(s) in cache.\n For more information see RawData.", $date->format(DATE_RFC2822), $stats[ 'num_entries' ]))
141
+            ->setRawData($stats)
142
+            ->setSize($stats[ 'mem_size' ]);
143 143
     }
144 144
 }
145 145
\ No newline at end of file
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,6 @@
 block discarded – undo
15 15
 namespace phpFastCache\Drivers\Apcu;
16 16
 
17 17
 use phpFastCache\Core\DriverAbstract;
18
-use phpFastCache\Core\StandardPsr6StructureTrait;
19 18
 use phpFastCache\Entities\driverStatistic;
20 19
 use phpFastCache\Exceptions\phpFastCacheDriverCheckException;
21 20
 use phpFastCache\Exceptions\phpFastCacheDriverException;
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -131,12 +131,12 @@
 block discarded – undo
131 131
     public function getStats()
132 132
     {
133 133
         $stats = (array) apcu_cache_info('user');
134
-        $date = (new \DateTime())->setTimestamp($stats[ 'start_time' ]);
134
+        $date = (new \DateTime())->setTimestamp($stats['start_time']);
135 135
 
136 136
         return (new driverStatistic())
137 137
           ->setData(implode(', ', array_keys($this->itemInstances)))
138
-          ->setInfo(sprintf("The APCU cache is up since %s, and have %d item(s) in cache.\n For more information see RawData.", $date->format(DATE_RFC2822), $stats[ 'num_entries' ]))
138
+          ->setInfo(sprintf("The APCU cache is up since %s, and have %d item(s) in cache.\n For more information see RawData.", $date->format(DATE_RFC2822), $stats['num_entries']))
139 139
           ->setRawData($stats)
140
-          ->setSize($stats[ 'mem_size' ]);
140
+          ->setSize($stats['mem_size']);
141 141
     }
142 142
 }
143 143
\ No newline at end of file
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Wincache/Driver.php 3 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -132,9 +132,9 @@
 block discarded – undo
132 132
         $date = (new \DateTime())->setTimestamp(time() - $info[ 'total_cache_uptime' ]);
133 133
 
134 134
         return (new driverStatistic())
135
-          ->setInfo(sprintf("The Wincache daemon is up since %s.\n For more information see RawData.", $date->format(DATE_RFC2822)))
136
-          ->setSize($memInfo[ 'memory_free' ] - $memInfo[ 'memory_total' ])
137
-          ->setData(implode(', ', array_keys($this->itemInstances)))
138
-          ->setRawData($memInfo);
135
+            ->setInfo(sprintf("The Wincache daemon is up since %s.\n For more information see RawData.", $date->format(DATE_RFC2822)))
136
+            ->setSize($memInfo[ 'memory_free' ] - $memInfo[ 'memory_total' ])
137
+            ->setData(implode(', ', array_keys($this->itemInstances)))
138
+            ->setRawData($memInfo);
139 139
     }
140 140
 }
141 141
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -129,11 +129,11 @@
 block discarded – undo
129 129
     {
130 130
         $memInfo = wincache_ucache_meminfo();
131 131
         $info = wincache_ucache_info();
132
-        $date = (new \DateTime())->setTimestamp(time() - $info[ 'total_cache_uptime' ]);
132
+        $date = (new \DateTime())->setTimestamp(time() - $info['total_cache_uptime']);
133 133
 
134 134
         return (new driverStatistic())
135 135
           ->setInfo(sprintf("The Wincache daemon is up since %s.\n For more information see RawData.", $date->format(DATE_RFC2822)))
136
-          ->setSize($memInfo[ 'memory_free' ] - $memInfo[ 'memory_total' ])
136
+          ->setSize($memInfo['memory_free'] - $memInfo['memory_total'])
137 137
           ->setData(implode(', ', array_keys($this->itemInstances)))
138 138
           ->setRawData($memInfo);
139 139
     }
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,6 @@
 block discarded – undo
15 15
 namespace phpFastCache\Drivers\Wincache;
16 16
 
17 17
 use phpFastCache\Core\DriverAbstract;
18
-use phpFastCache\Core\StandardPsr6StructureTrait;
19 18
 use phpFastCache\Entities\driverStatistic;
20 19
 use phpFastCache\Exceptions\phpFastCacheDriverCheckException;
21 20
 use phpFastCache\Exceptions\phpFastCacheDriverException;
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Couchbase/Driver.php 4 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -142,10 +142,10 @@  discard block
 block discarded – undo
142 142
             $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : '';
143 143
             $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : '';
144 144
             $buckets = isset($this->config[ 'buckets' ]) ? $this->config[ 'buckets' ] : [
145
-              [
145
+                [
146 146
                 'bucket' => 'default',
147 147
                 'password' => '',
148
-              ],
148
+                ],
149 149
             ];
150 150
 
151 151
             $this->instance = $this->instance ?: new CouchbaseClient("couchbase://{$host}", $username, $password);
@@ -193,9 +193,9 @@  discard block
 block discarded – undo
193 193
         $info = $this->getBucket()->manager()->info();
194 194
 
195 195
         return (new driverStatistic())
196
-          ->setSize($info[ 'basicStats' ][ 'diskUsed' ])
197
-          ->setRawData($info)
198
-          ->setData(implode(', ', array_keys($this->itemInstances)))
199
-          ->setInfo('CouchBase version ' . $info[ 'nodes' ][ 0 ][ 'version' ] . ', Uptime (in days): ' . round($info[ 'nodes' ][ 0 ][ 'uptime' ] / 86400, 1) . "\n For more information see RawData.");
196
+            ->setSize($info[ 'basicStats' ][ 'diskUsed' ])
197
+            ->setRawData($info)
198
+            ->setData(implode(', ', array_keys($this->itemInstances)))
199
+            ->setInfo('CouchBase version ' . $info[ 'nodes' ][ 0 ][ 'version' ] . ', Uptime (in days): ' . round($info[ 'nodes' ][ 0 ][ 'uptime' ] / 86400, 1) . "\n For more information see RawData.");
200 200
     }
201 201
 }
202 202
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -137,11 +137,11 @@  discard block
 block discarded – undo
137 137
         } else {
138 138
 
139 139
 
140
-            $host = isset($this->config[ 'host' ]) ? $this->config[ 'host' ] : '127.0.0.1';
140
+            $host = isset($this->config['host']) ? $this->config['host'] : '127.0.0.1';
141 141
             //$port = isset($server[ 'port' ]) ? $server[ 'port' ] : '11211';
142
-            $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : '';
143
-            $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : '';
144
-            $buckets = isset($this->config[ 'buckets' ]) ? $this->config[ 'buckets' ] : [
142
+            $password = isset($this->config['password']) ? $this->config['password'] : '';
143
+            $username = isset($this->config['username']) ? $this->config['username'] : '';
144
+            $buckets = isset($this->config['buckets']) ? $this->config['buckets'] : [
145 145
               [
146 146
                 'bucket' => 'default',
147 147
                 'password' => '',
@@ -151,8 +151,8 @@  discard block
 block discarded – undo
151 151
             $this->instance = $this->instance ?: new CouchbaseClient("couchbase://{$host}", $username, $password);
152 152
 
153 153
             foreach ($buckets as $bucket) {
154
-                $this->bucketCurrent = $this->bucketCurrent ?: $bucket[ 'bucket' ];
155
-                $this->setBucket($bucket[ 'bucket' ], $this->instance->openBucket($bucket[ 'bucket' ], $bucket[ 'password' ]));
154
+                $this->bucketCurrent = $this->bucketCurrent ?: $bucket['bucket'];
155
+                $this->setBucket($bucket['bucket'], $this->instance->openBucket($bucket['bucket'], $bucket['password']));
156 156
             }
157 157
         }
158 158
     }
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
      */
163 163
     protected function getBucket()
164 164
     {
165
-        return $this->bucketInstances[ $this->bucketCurrent ];
165
+        return $this->bucketInstances[$this->bucketCurrent];
166 166
     }
167 167
 
168 168
     /**
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
     protected function setBucket($bucketName, \CouchbaseBucket $CouchbaseBucket)
174 174
     {
175 175
         if (!array_key_exists($bucketName, $this->bucketInstances)) {
176
-            $this->bucketInstances[ $bucketName ] = $CouchbaseBucket;
176
+            $this->bucketInstances[$bucketName] = $CouchbaseBucket;
177 177
         } else {
178 178
             throw new \LogicException('A bucket instance with this name already exists.');
179 179
         }
@@ -193,9 +193,9 @@  discard block
 block discarded – undo
193 193
         $info = $this->getBucket()->manager()->info();
194 194
 
195 195
         return (new driverStatistic())
196
-          ->setSize($info[ 'basicStats' ][ 'diskUsed' ])
196
+          ->setSize($info['basicStats']['diskUsed'])
197 197
           ->setRawData($info)
198 198
           ->setData(implode(', ', array_keys($this->itemInstances)))
199
-          ->setInfo('CouchBase version ' . $info[ 'nodes' ][ 0 ][ 'version' ] . ', Uptime (in days): ' . round($info[ 'nodes' ][ 0 ][ 'uptime' ] / 86400, 1) . "\n For more information see RawData.");
199
+          ->setInfo('CouchBase version ' . $info['nodes'][0]['version'] . ', Uptime (in days): ' . round($info['nodes'][0]['uptime'] / 86400, 1) . "\n For more information see RawData.");
200 200
     }
201 201
 }
202 202
\ No newline at end of file
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,6 @@
 block discarded – undo
16 16
 
17 17
 use CouchbaseCluster as CouchbaseClient;
18 18
 use phpFastCache\Core\DriverAbstract;
19
-use phpFastCache\Core\StandardPsr6StructureTrait;
20 19
 use phpFastCache\Entities\driverStatistic;
21 20
 use phpFastCache\Exceptions\phpFastCacheDriverCheckException;
22 21
 use phpFastCache\Exceptions\phpFastCacheDriverException;
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@
 block discarded – undo
126 126
     }
127 127
 
128 128
     /**
129
-     * @return bool
129
+     * @return boolean|null
130 130
      */
131 131
     protected function driverConnect()
132 132
     {
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Xcache/Driver.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -136,10 +136,10 @@
 block discarded – undo
136 136
             $info = xcache_info(XC_TYPE_VAR, 0);
137 137
 
138 138
             return (new driverStatistic())
139
-              ->setSize(abs($info[ 'size' ] - $info[ 'avail' ]))
140
-              ->setData(implode(', ', array_keys($this->itemInstances)))
141
-              ->setInfo(sprintf("Xcache v%s with following modules loaded:\n %s", XCACHE_VERSION, str_replace(' ', ', ', XCACHE_MODULES)))
142
-              ->setRawData($info);
139
+                ->setSize(abs($info[ 'size' ] - $info[ 'avail' ]))
140
+                ->setData(implode(', ', array_keys($this->itemInstances)))
141
+                ->setInfo(sprintf("Xcache v%s with following modules loaded:\n %s", XCACHE_VERSION, str_replace(' ', ', ', XCACHE_MODULES)))
142
+                ->setRawData($info);
143 143
         } else {
144 144
             throw new \RuntimeException("PhpFastCache is not able to read Xcache configuration. Please put this to your php.ini:\n
145 145
             [xcache.admin]
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@
 block discarded – undo
136 136
             $info = xcache_info(XC_TYPE_VAR, 0);
137 137
 
138 138
             return (new driverStatistic())
139
-              ->setSize(abs($info[ 'size' ] - $info[ 'avail' ]))
139
+              ->setSize(abs($info['size'] - $info['avail']))
140 140
               ->setData(implode(', ', array_keys($this->itemInstances)))
141 141
               ->setInfo(sprintf("Xcache v%s with following modules loaded:\n %s", XCACHE_VERSION, str_replace(' ', ', ', XCACHE_MODULES)))
142 142
               ->setRawData($info);
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Apc/Driver.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -136,10 +136,10 @@
 block discarded – undo
136 136
         $date = (new \DateTime())->setTimestamp($stats[ 'start_time' ]);
137 137
 
138 138
         return (new driverStatistic())
139
-          ->setData(implode(', ', array_keys($this->itemInstances)))
140
-          ->setInfo(sprintf("The APC cache is up since %s, and have %d item(s) in cache.\n For more information see RawData.", $date->format(DATE_RFC2822),
139
+            ->setData(implode(', ', array_keys($this->itemInstances)))
140
+            ->setInfo(sprintf("The APC cache is up since %s, and have %d item(s) in cache.\n For more information see RawData.", $date->format(DATE_RFC2822),
141 141
             $stats[ 'num_entries' ]))
142
-          ->setRawData($stats)
143
-          ->setSize($stats[ 'mem_size' ]);
142
+            ->setRawData($stats)
143
+            ->setSize($stats[ 'mem_size' ]);
144 144
     }
145 145
 }
146 146
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -133,13 +133,13 @@
 block discarded – undo
133 133
     public function getStats()
134 134
     {
135 135
         $stats = (array) apc_cache_info('user');
136
-        $date = (new \DateTime())->setTimestamp($stats[ 'start_time' ]);
136
+        $date = (new \DateTime())->setTimestamp($stats['start_time']);
137 137
 
138 138
         return (new driverStatistic())
139 139
           ->setData(implode(', ', array_keys($this->itemInstances)))
140 140
           ->setInfo(sprintf("The APC cache is up since %s, and have %d item(s) in cache.\n For more information see RawData.", $date->format(DATE_RFC2822),
141
-            $stats[ 'num_entries' ]))
141
+            $stats['num_entries']))
142 142
           ->setRawData($stats)
143
-          ->setSize($stats[ 'mem_size' ]);
143
+          ->setSize($stats['mem_size']);
144 144
     }
145 145
 }
146 146
\ No newline at end of file
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Ssdb/Driver.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -139,10 +139,10 @@  discard block
 block discarded – undo
139 139
     {
140 140
         try {
141 141
             $server = isset($this->config[ 'ssdb' ]) ? $this->config[ 'ssdb' ] : [
142
-              'host' => "127.0.0.1",
143
-              'port' => 8888,
144
-              'password' => '',
145
-              'timeout' => 2000,
142
+                'host' => "127.0.0.1",
143
+                'port' => 8888,
144
+                'password' => '',
145
+                'timeout' => 2000,
146 146
             ];
147 147
 
148 148
             $host = $server[ 'host' ];
@@ -183,9 +183,9 @@  discard block
 block discarded – undo
183 183
          * using hardcoded offset of pair key-value :-(
184 184
          */
185 185
         $stat->setInfo(sprintf("Ssdb-server v%s with a total of %s call(s).\n For more information see RawData.", $info[ 2 ], $info[ 6 ]))
186
-          ->setRawData($info)
187
-          ->setData(implode(', ', array_keys($this->itemInstances)))
188
-          ->setSize($this->instance->dbsize());
186
+            ->setRawData($info)
187
+            ->setData(implode(', ', array_keys($this->itemInstances)))
188
+            ->setSize($this->instance->dbsize());
189 189
 
190 190
         return $stat;
191 191
     }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -138,17 +138,17 @@  discard block
 block discarded – undo
138 138
     protected function driverConnect()
139 139
     {
140 140
         try {
141
-            $server = isset($this->config[ 'ssdb' ]) ? $this->config[ 'ssdb' ] : [
141
+            $server = isset($this->config['ssdb']) ? $this->config['ssdb'] : [
142 142
               'host' => "127.0.0.1",
143 143
               'port' => 8888,
144 144
               'password' => '',
145 145
               'timeout' => 2000,
146 146
             ];
147 147
 
148
-            $host = $server[ 'host' ];
149
-            $port = isset($server[ 'port' ]) ? (int) $server[ 'port' ] : 8888;
150
-            $password = isset($server[ 'password' ]) ? $server[ 'password' ] : '';
151
-            $timeout = !empty($server[ 'timeout' ]) ? (int) $server[ 'timeout' ] : 2000;
148
+            $host = $server['host'];
149
+            $port = isset($server['port']) ? (int) $server['port'] : 8888;
150
+            $password = isset($server['password']) ? $server['password'] : '';
151
+            $timeout = !empty($server['timeout']) ? (int) $server['timeout'] : 2000;
152 152
             $this->instance = new SimpleSSDB($host, $port, $timeout);
153 153
             if (!empty($password)) {
154 154
                 $this->instance->auth($password);
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
          * Data returned by Ssdb are very poorly formatted
183 183
          * using hardcoded offset of pair key-value :-(
184 184
          */
185
-        $stat->setInfo(sprintf("Ssdb-server v%s with a total of %s call(s).\n For more information see RawData.", $info[ 2 ], $info[ 6 ]))
185
+        $stat->setInfo(sprintf("Ssdb-server v%s with a total of %s call(s).\n For more information see RawData.", $info[2], $info[6]))
186 186
           ->setRawData($info)
187 187
           ->setData(implode(', ', array_keys($this->itemInstances)))
188 188
           ->setSize($this->instance->dbsize());
Please login to merge, or discard this patch.
src/phpFastCache/Proxy/phpFastCacheAbstractProxy.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -74,9 +74,9 @@
 block discarded – undo
74 74
      */
75 75
     public function __call($name, $args)
76 76
     {
77
-        if(method_exists($this->instance, $name)){
77
+        if (method_exists($this->instance, $name)) {
78 78
             return call_user_func_array([$this->instance, $name], $args);
79
-        }else{
79
+        } else {
80 80
             throw new \BadMethodCallException(sprintf('Method %s does not exists', $name));
81 81
         }
82 82
     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@
 block discarded – undo
76 76
     {
77 77
         if(method_exists($this->instance, $name)){
78 78
             return call_user_func_array([$this->instance, $name], $args);
79
-        }else{
79
+        } else{
80 80
             throw new \BadMethodCallException(sprintf('Method %s does not exists', $name));
81 81
         }
82 82
     }
Please login to merge, or discard this patch.
src/phpFastCache/CacheManager.php 3 patches
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -95,13 +95,13 @@  discard block
 block discarded – undo
95 95
             $class = self::getNamespacePath() . $driver . '\Driver';
96 96
             try{
97 97
                 self::$instances[ $instance ] = new $class($config);
98
-            }catch(phpFastCacheDriverCheckException $e){
98
+            } catch(phpFastCacheDriverCheckException $e){
99 99
                 $fallback = self::standardizeDriverName($config['fallback']);
100 100
                 if($fallback && $fallback !== $driver){
101 101
                     $class = self::getNamespacePath() . $fallback . '\Driver';
102 102
                     self::$instances[ $instance ] = new $class($config);
103 103
                     trigger_error(sprintf('The "%s" driver is unavailable at the moment, the fallback driver "%s" has been used instead.', $driver, $fallback), E_USER_WARNING);
104
-                }else{
104
+                } else{
105 105
                     throw new phpFastCacheDriverCheckException($e->getMessage(), $e->getCode(), $e);
106 106
                 }
107 107
             }
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
             self::$config = array_merge(self::$config, $name);
199 199
         } else if (is_string($name)){
200 200
             self::$config[ $name ] = $value;
201
-        }else{
201
+        } else{
202 202
             throw new \InvalidArgumentException('Invalid variable type: $name');
203 203
         }
204 204
     }
Please login to merge, or discard this patch.
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -57,15 +57,15 @@  discard block
 block discarded – undo
57 57
      * @var array
58 58
      */
59 59
     protected static $config = [
60
-      'securityKey' => 'auto', // The securityKey that will be used to create the sub-directory
61
-      'ignoreSymfonyNotice' => false, // Ignore Symfony notices for Symfony projects that do not makes use of PhpFastCache's Symfony Bundle
62
-      'defaultTtl' => 900, // Default time-to-live in seconds
63
-      'htaccess' => true, // Auto-generate .htaccess if it is missing
64
-      'default_chmod' => 0777, // 0777 is recommended
65
-      'path' => '', // If not set will be the value of sys_get_temp_dir()
66
-      'fallback' => false, // Fall back when old driver is not supported
67
-      'limited_memory_each_object' => 4096, // Maximum size (bytes) of object store in memory
68
-      'compress_data' => false, // Compress stored data if the backend supports it
60
+        'securityKey' => 'auto', // The securityKey that will be used to create the sub-directory
61
+        'ignoreSymfonyNotice' => false, // Ignore Symfony notices for Symfony projects that do not makes use of PhpFastCache's Symfony Bundle
62
+        'defaultTtl' => 900, // Default time-to-live in seconds
63
+        'htaccess' => true, // Auto-generate .htaccess if it is missing
64
+        'default_chmod' => 0777, // 0777 is recommended
65
+        'path' => '', // If not set will be the value of sys_get_temp_dir()
66
+        'fallback' => false, // Fall back when old driver is not supported
67
+        'limited_memory_each_object' => 4096, // Maximum size (bytes) of object store in memory
68
+        'compress_data' => false, // Compress stored data if the backend supports it
69 69
     ];
70 70
 
71 71
     /**
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
                 }
117 117
             }
118 118
         } else if(++$badPracticeOmeter[$driver] >= 5){
119
-           trigger_error('[' . $driver . '] Calling many times CacheManager::getInstance() for already instanced drivers is a bad practice and have a significant impact on performances.
119
+            trigger_error('[' . $driver . '] Calling many times CacheManager::getInstance() for already instanced drivers is a bad practice and have a significant impact on performances.
120 120
            See https://github.com/PHPSocialNetwork/phpfastcache/wiki/[V5]-Why-calling-getInstance%28%29-each-time-is-a-bad-practice-%3F');
121 121
         }
122 122
 
@@ -227,23 +227,23 @@  discard block
 block discarded – undo
227 227
     public static function getStaticSystemDrivers()
228 228
     {
229 229
         return [
230
-          'Sqlite',
231
-          'Files',
232
-          'Apc',
233
-          'Apcu',
234
-          'Memcache',
235
-          'Memcached',
236
-          'Couchbase',
237
-          'Mongodb',
238
-          'Predis',
239
-          'Redis',
240
-          'Ssdb',
241
-          'Leveldb',
242
-          'Wincache',
243
-          'Xcache',
244
-          'Zenddisk',
245
-          'Zendshm',
246
-          'Devnull',
230
+            'Sqlite',
231
+            'Files',
232
+            'Apc',
233
+            'Apcu',
234
+            'Memcache',
235
+            'Memcached',
236
+            'Couchbase',
237
+            'Mongodb',
238
+            'Predis',
239
+            'Redis',
240
+            'Ssdb',
241
+            'Leveldb',
242
+            'Wincache',
243
+            'Xcache',
244
+            'Zenddisk',
245
+            'Zendshm',
246
+            'Devnull',
247 247
         ];
248 248
     }
249 249
 
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -97,30 +97,30 @@  discard block
 block discarded – undo
97 97
         }
98 98
 
99 99
         $instance = crc32($driver . serialize($config));
100
-        if (!isset(self::$instances[ $instance ])) {
100
+        if (!isset(self::$instances[$instance])) {
101 101
             $badPracticeOmeter[$driver] = 1;
102
-            if(!$config['ignoreSymfonyNotice'] && interface_exists('Symfony\Component\HttpKernel\KernelInterface') && !class_exists('phpFastCache\Bundle\phpFastCacheBundle')){
102
+            if (!$config['ignoreSymfonyNotice'] && interface_exists('Symfony\Component\HttpKernel\KernelInterface') && !class_exists('phpFastCache\Bundle\phpFastCacheBundle')) {
103 103
                 trigger_error('A Symfony Bundle to make the PhpFastCache integration more easier is now available here: https://github.com/PHPSocialNetwork/phpfastcache-bundle', E_USER_NOTICE);
104 104
             }
105 105
             $class = self::getNamespacePath() . $driver . '\Driver';
106
-            try{
107
-                self::$instances[ $instance ] = new $class($config);
108
-            }catch(phpFastCacheDriverCheckException $e){
106
+            try {
107
+                self::$instances[$instance] = new $class($config);
108
+            } catch (phpFastCacheDriverCheckException $e) {
109 109
                 $fallback = self::standardizeDriverName($config['fallback']);
110
-                if($fallback && $fallback !== $driver){
110
+                if ($fallback && $fallback !== $driver) {
111 111
                     $class = self::getNamespacePath() . $fallback . '\Driver';
112
-                    self::$instances[ $instance ] = new $class($config);
112
+                    self::$instances[$instance] = new $class($config);
113 113
                     trigger_error(sprintf('The "%s" driver is unavailable at the moment, the fallback driver "%s" has been used instead.', $driver, $fallback), E_USER_WARNING);
114
-                }else{
114
+                } else {
115 115
                     throw new phpFastCacheDriverCheckException($e->getMessage(), $e->getCode(), $e);
116 116
                 }
117 117
             }
118
-        } else if(++$badPracticeOmeter[$driver] >= 5){
118
+        } else if (++$badPracticeOmeter[$driver] >= 5) {
119 119
            trigger_error('[' . $driver . '] Calling many times CacheManager::getInstance() for already instanced drivers is a bad practice and have a significant impact on performances.
120 120
            See https://github.com/PHPSocialNetwork/phpfastcache/wiki/[V5]-Why-calling-getInstance%28%29-each-time-is-a-bad-practice-%3F');
121 121
         }
122 122
 
123
-        return self::$instances[ $instance ];
123
+        return self::$instances[$instance];
124 124
     }
125 125
 
126 126
     /**
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
      */
154 154
     public static function __callStatic($name, $arguments)
155 155
     {
156
-        $options = (array_key_exists(0, $arguments) && is_array($arguments) ? $arguments[ 0 ] : []);
156
+        $options = (array_key_exists(0, $arguments) && is_array($arguments) ? $arguments[0] : []);
157 157
 
158 158
         return self::getInstance($name, $options);
159 159
     }
@@ -206,9 +206,9 @@  discard block
 block discarded – undo
206 206
     {
207 207
         if (is_array($name)) {
208 208
             self::$config = array_merge(self::$config, $name);
209
-        } else if (is_string($name)){
210
-            self::$config[ $name ] = $value;
211
-        }else{
209
+        } else if (is_string($name)) {
210
+            self::$config[$name] = $value;
211
+        } else {
212 212
             throw new \InvalidArgumentException('Invalid variable type: $name');
213 213
         }
214 214
     }
Please login to merge, or discard this patch.
src/phpFastCache/Core/PathSeekerTrait.php 4 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -185,9 +185,9 @@
 block discarded – undo
185 185
     protected static function cleanFileName($filename)
186 186
     {
187 187
         $regex = [
188
-          '/[\?\[\]\/\\\=\<\>\:\;\,\'\"\&\$\#\*\(\)\|\~\`\!\{\}]/',
189
-          '/\.$/',
190
-          '/^\./',
188
+            '/[\?\[\]\/\\\=\<\>\:\;\,\'\"\&\$\#\*\(\)\|\~\`\!\{\}]/',
189
+            '/\.$/',
190
+            '/^\./',
191 191
         ];
192 192
         $replace = ['-', '', ''];
193 193
 
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
     }
142 142
 
143 143
     /**
144
-     * @param $keyword
144
+     * @param string|false $keyword
145 145
      * @param bool $skip
146 146
      * @return string
147 147
      * @throws phpFastCacheDriverException
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 
188 188
     /**
189 189
      * @param $filename
190
-     * @return mixed
190
+     * @return string
191 191
      */
192 192
     protected static function cleanFileName($filename)
193 193
     {
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
     }
203 203
 
204 204
     /**
205
-     * @param $path
205
+     * @param string $path
206 206
      * @param bool $create
207 207
      * @throws \Exception
208 208
      */
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -78,11 +78,11 @@
 block discarded – undo
78 78
                 return $full_path_tmp;
79 79
             }
80 80
             return $full_path;
81
-        }else{
81
+        } else{
82 82
             if (!isset($this->tmp[ $full_path_hash ]) || (!@file_exists($full_path) || !@is_writable($full_path))) {
83 83
                 if (!@file_exists($full_path)) {
84 84
                     @mkdir($full_path, $this->setChmodAuto(), true);
85
-                }elseif (!@is_writable($full_path)) {
85
+                } elseif (!@is_writable($full_path)) {
86 86
                     if (!@chmod($full_path, $this->setChmodAuto()))
87 87
                     {
88 88
                         /**
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -45,10 +45,10 @@  discard block
 block discarded – undo
45 45
          * Calculate the security key
46 46
          */
47 47
         {
48
-            $securityKey = array_key_exists('securityKey', $this->config) ? $this->config[ 'securityKey' ] : '';
48
+            $securityKey = array_key_exists('securityKey', $this->config) ? $this->config['securityKey'] : '';
49 49
             if (!$securityKey || $securityKey === 'auto') {
50
-                if (isset($_SERVER[ 'HTTP_HOST' ])) {
51
-                    $securityKey = preg_replace('/^www./', '', strtolower(str_replace(':', '_', $_SERVER[ 'HTTP_HOST' ])));
50
+                if (isset($_SERVER['HTTP_HOST'])) {
51
+                    $securityKey = preg_replace('/^www./', '', strtolower(str_replace(':', '_', $_SERVER['HTTP_HOST'])));
52 52
                 } else {
53 53
                     $securityKey = ($this->isPHPModule() ? 'web' : 'cli');
54 54
                 }
@@ -63,10 +63,10 @@  discard block
 block discarded – undo
63 63
          * with the security key and the driver name
64 64
          */
65 65
         $tmp_dir = rtrim($tmp_dir, '/') . DIRECTORY_SEPARATOR;
66
-        if (empty($this->config[ 'path' ]) || !is_string($this->config[ 'path' ])) {
66
+        if (empty($this->config['path']) || !is_string($this->config['path'])) {
67 67
             $path = $tmp_dir;
68 68
         } else {
69
-            $path = rtrim($this->config[ 'path' ], '/') . DIRECTORY_SEPARATOR;
69
+            $path = rtrim($this->config['path'], '/') . DIRECTORY_SEPARATOR;
70 70
         }
71 71
         $path_suffix = $securityKey . DIRECTORY_SEPARATOR . $this->getDriverName();
72 72
         $full_path = Directory::getAbsolutePath($path . $path_suffix);
@@ -79,12 +79,12 @@  discard block
 block discarded – undo
79 79
          * return the temp dir
80 80
          */
81 81
         if ($readonly === true) {
82
-            if(!@file_exists($full_path) || !@is_writable($full_path)){
82
+            if (!@file_exists($full_path) || !@is_writable($full_path)) {
83 83
                 return $full_path_tmp;
84 84
             }
85 85
             return $full_path;
86
-        }else{
87
-            if (!isset($this->tmp[ $full_path_hash ]) || (!@file_exists($full_path) || !@is_writable($full_path))) {
86
+        } else {
87
+            if (!isset($this->tmp[$full_path_hash]) || (!@file_exists($full_path) || !@is_writable($full_path))) {
88 88
                 if (!@file_exists($full_path)) {
89 89
                     @mkdir($full_path, $this->setChmodAuto(), true);
90 90
                 }elseif (!@is_writable($full_path)) {
@@ -109,8 +109,8 @@  discard block
 block discarded – undo
109 109
                 if (!@file_exists($full_path) || !@is_writable($full_path)) {
110 110
                     throw new phpFastCacheDriverException('PLEASE CREATE OR CHMOD ' . $full_path . ' - 0777 OR ANY WRITABLE PERMISSION!');
111 111
                 }
112
-                $this->tmp[ $full_path_hash ] = $full_path;
113
-                $this->htaccessGen($full_path, array_key_exists('htaccess', $this->config) ? $this->config[ 'htaccess' ] : false);
112
+                $this->tmp[$full_path_hash] = $full_path;
113
+                $this->htaccessGen($full_path, array_key_exists('htaccess', $this->config) ? $this->config['htaccess'] : false);
114 114
             }
115 115
         }
116 116
         return realpath($full_path);
@@ -184,10 +184,10 @@  discard block
 block discarded – undo
184 184
      */
185 185
     public function setChmodAuto()
186 186
     {
187
-        if (!isset($this->config[ 'default_chmod' ]) || $this->config[ 'default_chmod' ] == '' || is_null($this->config[ 'default_chmod' ])) {
187
+        if (!isset($this->config['default_chmod']) || $this->config['default_chmod'] == '' || is_null($this->config['default_chmod'])) {
188 188
             return 0777;
189 189
         } else {
190
-            return $this->config[ 'default_chmod' ];
190
+            return $this->config['default_chmod'];
191 191
         }
192 192
     }
193 193
 
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
         if ($create === true) {
218 218
             if (!is_writable($path)) {
219 219
                 try {
220
-                    if(!chmod($path, 0777)){
220
+                    if (!chmod($path, 0777)) {
221 221
                         throw new phpFastCacheDriverException('Chmod failed on : ' . $path);
222 222
                     }
223 223
                 } catch (phpFastCacheDriverException $e) {
Please login to merge, or discard this patch.