Completed
Push — V6 ( 2f3d58...8b729c )
by Georges
02:32
created
src/phpFastCache/Drivers/Cookie/Driver.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
             $keyword = self::PREFIX . $item->getKey();
81 81
             $v = json_encode($this->driverPreWrap($item));
82 82
 
83
-            if (isset($this->config[ 'limited_memory_each_object' ]) && strlen($v) > $this->config[ 'limited_memory_each_object' ]) {
83
+            if (isset($this->config['limited_memory_each_object']) && strlen($v) > $this->config['limited_memory_each_object']) {
84 84
                 return false;
85 85
             }
86 86
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
         // return null if no caching
102 102
         // return value if in caching
103 103
         $keyword = self::PREFIX . $item->getKey();
104
-        $x = isset($_COOKIE[ $keyword ]) ? json_decode($_COOKIE[ $keyword ], true) : false;
104
+        $x = isset($_COOKIE[$keyword]) ? json_decode($_COOKIE[$keyword], true) : false;
105 105
 
106 106
         if ($x == false) {
107 107
             return null;
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
     {
123 123
         $this->driverConnect();
124 124
         $keyword = self::PREFIX . $key;
125
-        $x = isset($_COOKIE[ $keyword ]) ? $this->decode(json_decode($_COOKIE[ $keyword ])->t) : false;
125
+        $x = isset($_COOKIE[$keyword]) ? $this->decode(json_decode($_COOKIE[$keyword])->t) : false;
126 126
 
127 127
         return $x ? $x - time() : $x;
128 128
     }
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
         if ($item instanceof Item) {
141 141
             $this->driverConnect();
142 142
             $keyword = self::PREFIX . $item->getKey();
143
-            $_COOKIE[ $keyword ] = null;
143
+            $_COOKIE[$keyword] = null;
144 144
 
145 145
             return @setcookie($keyword, null, -10);
146 146
         } else {
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
         $this->driverConnect();
158 158
         foreach ($_COOKIE as $keyword => $value) {
159 159
             if (strpos($keyword, self::PREFIX) !== false) {
160
-                $_COOKIE[ $keyword ] = null;
160
+                $_COOKIE[$keyword] = null;
161 161
                 $result = @setcookie($keyword, null, -10);
162 162
                 if ($return !== false) {
163 163
                     $return = $result;
Please login to merge, or discard this patch.
src/phpFastCache/Core/Pool/IO/IOHelperTrait.php 4 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 
131 131
 
132 132
     /**
133
-     * @param $keyword
133
+     * @param false|string $keyword
134 134
      * @param bool $skip
135 135
      * @return string
136 136
      * @throws phpFastCacheIOException
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 
198 198
     /**
199 199
      * @param $filename
200
-     * @return mixed
200
+     * @return string
201 201
      */
202 202
     protected static function cleanFileName($filename)
203 203
     {
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
     }
213 213
 
214 214
     /**
215
-     * @param $path
215
+     * @param string $path
216 216
      * @param bool $create
217 217
      * @throws phpFastCacheIOException
218 218
      */
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 
250 250
 
251 251
     /**
252
-     * @param $file
252
+     * @param string $file
253 253
      * @return string
254 254
      * @throws phpFastCacheIOException
255 255
      */
Please login to merge, or discard this patch.
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -202,9 +202,9 @@  discard block
 block discarded – undo
202 202
     protected static function cleanFileName($filename)
203 203
     {
204 204
         $regex = [
205
-          '/[\?\[\]\/\\\=\<\>\:\;\,\'\"\&\$\#\*\(\)\|\~\`\!\{\}]/',
206
-          '/\.$/',
207
-          '/^\./',
205
+            '/[\?\[\]\/\\\=\<\>\:\;\,\'\"\&\$\#\*\(\)\|\~\`\!\{\}]/',
206
+            '/\.$/',
207
+            '/^\./',
208 208
         ];
209 209
         $replace = ['-', '', ''];
210 210
 
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
             $tmpFilename = Directory::getAbsolutePath(dirname($file) . '/tmp_' . md5(
297 297
                 str_shuffle(uniqid($this->getDriverName(), false))
298 298
                 . str_shuffle(uniqid($this->getDriverName(), false))
299
-              ));
299
+                ));
300 300
 
301 301
             $f = fopen($tmpFilename, 'w+');
302 302
             flock($f, LOCK_EX);
@@ -338,11 +338,11 @@  discard block
 block discarded – undo
338 338
         }
339 339
 
340 340
         $stat->setData(implode(', ', array_keys($this->itemInstances)))
341
-          ->setRawData([
341
+            ->setRawData([
342 342
             'tmp' => $this->tmp
343
-          ])
344
-          ->setSize(Directory::dirSize($path))
345
-          ->setInfo('Number of files used to build the cache: ' . Directory::getFileCount($path));
343
+            ])
344
+            ->setSize(Directory::dirSize($path))
345
+            ->setInfo('Number of files used to build the cache: ' . Directory::getFileCount($path));
346 346
 
347 347
         return $stat;
348 348
     }
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -51,10 +51,10 @@  discard block
 block discarded – undo
51 51
          * Calculate the security key
52 52
          */
53 53
         {
54
-            $securityKey = array_key_exists('securityKey', $this->config) ? $this->config[ 'securityKey' ] : '';
54
+            $securityKey = array_key_exists('securityKey', $this->config) ? $this->config['securityKey'] : '';
55 55
             if (!$securityKey || $securityKey === 'auto') {
56
-                if (isset($_SERVER[ 'HTTP_HOST' ])) {
57
-                    $securityKey = preg_replace('/^www./', '', strtolower(str_replace(':', '_', $_SERVER[ 'HTTP_HOST' ])));
56
+                if (isset($_SERVER['HTTP_HOST'])) {
57
+                    $securityKey = preg_replace('/^www./', '', strtolower(str_replace(':', '_', $_SERVER['HTTP_HOST'])));
58 58
                 } else {
59 59
                     $securityKey = ($this->isPHPModule() ? 'web' : 'cli');
60 60
                 }
@@ -73,10 +73,10 @@  discard block
 block discarded – undo
73 73
          */
74 74
         $tmp_dir = rtrim($tmp_dir, '/') . DIRECTORY_SEPARATOR;
75 75
 
76
-        if (empty($this->config[ 'path' ]) || !is_string($this->config[ 'path' ])) {
76
+        if (empty($this->config['path']) || !is_string($this->config['path'])) {
77 77
             $path = $tmp_dir;
78 78
         } else {
79
-            $path = rtrim($this->config[ 'path' ], '/') . DIRECTORY_SEPARATOR;
79
+            $path = rtrim($this->config['path'], '/') . DIRECTORY_SEPARATOR;
80 80
         }
81 81
 
82 82
         $path_suffix = $securityKey . DIRECTORY_SEPARATOR . $this->getDriverName();
@@ -91,16 +91,16 @@  discard block
 block discarded – undo
91 91
          * return the temp dir
92 92
          */
93 93
         if ($readonly === true) {
94
-            if($this->config[ 'autoTmpFallback' ] && (!@file_exists($full_path) || !@is_writable($full_path))){
94
+            if ($this->config['autoTmpFallback'] && (!@file_exists($full_path) || !@is_writable($full_path))) {
95 95
                 return $full_path_tmp;
96 96
             }
97 97
             return $full_path;
98
-        }else{
99
-            if (!isset($this->tmp[ $full_path_hash ]) || (!@file_exists($full_path) || !@is_writable($full_path))) {
98
+        } else {
99
+            if (!isset($this->tmp[$full_path_hash]) || (!@file_exists($full_path) || !@is_writable($full_path))) {
100 100
                 if (!@file_exists($full_path)) {
101 101
                     @mkdir($full_path, $this->getDefaultChmod(), true);
102
-                }else if (!@is_writable($full_path)) {
103
-                    if (!@chmod($full_path, $this->getDefaultChmod()) && $this->config[ 'autoTmpFallback' ])
102
+                } else if (!@is_writable($full_path)) {
103
+                    if (!@chmod($full_path, $this->getDefaultChmod()) && $this->config['autoTmpFallback'])
104 104
                     {
105 105
                         /**
106 106
                          * Switch back to tmp dir
@@ -122,8 +122,8 @@  discard block
 block discarded – undo
122 122
                     throw new phpFastCacheIOException('PLEASE CREATE OR CHMOD ' . $full_path . ' - 0777 OR ANY WRITABLE PERMISSION!');
123 123
                 }
124 124
 
125
-                $this->tmp[ $full_path_hash ] = $full_path;
126
-                $this->htaccessGen($full_path, array_key_exists('htaccess', $this->config) ? $this->config[ 'htaccess' ] : false);
125
+                $this->tmp[$full_path_hash] = $full_path;
126
+                $this->htaccessGen($full_path, array_key_exists('htaccess', $this->config) ? $this->config['htaccess'] : false);
127 127
             }
128 128
         }
129 129
 
@@ -180,10 +180,10 @@  discard block
 block discarded – undo
180 180
      */
181 181
     protected function getDefaultChmod()
182 182
     {
183
-        if (!isset($this->config[ 'default_chmod' ]) || $this->config[ 'default_chmod' ] == '' || is_null($this->config[ 'default_chmod' ])) {
183
+        if (!isset($this->config['default_chmod']) || $this->config['default_chmod'] == '' || is_null($this->config['default_chmod'])) {
184 184
             return 0777;
185 185
         } else {
186
-            return $this->config[ 'default_chmod' ];
186
+            return $this->config['default_chmod'];
187 187
         }
188 188
     }
189 189
 
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
         if ($create === true) {
214 214
             if (!is_writable($path)) {
215 215
                 try {
216
-                    if(!chmod($path, 0777)){
216
+                    if (!chmod($path, 0777)) {
217 217
                         throw new phpFastCacheIOException('Chmod failed on : ' . $path);
218 218
                     }
219 219
                 } catch (phpFastCacheIOException $e) {
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
          */
285 285
         $this->eventManager->dispatch('CacheWriteFileOnDisk', $this, $file, $secureFileManipulation);
286 286
 
287
-        if($secureFileManipulation){
287
+        if ($secureFileManipulation) {
288 288
             $tmpFilename = Directory::getAbsolutePath(dirname($file) . '/tmp_' . md5(
289 289
                 str_shuffle(uniqid($this->getDriverName(), false))
290 290
                 . str_shuffle(uniqid($this->getDriverName(), false))
@@ -296,10 +296,10 @@  discard block
 block discarded – undo
296 296
             flock($f, LOCK_UN);
297 297
             fclose($f);
298 298
 
299
-            if(!rename($tmpFilename, $file)){
299
+            if (!rename($tmpFilename, $file)) {
300 300
                 throw new phpFastCacheIOException(sprintf('Failed to rename %s to %s', $tmpFilename, $file));
301 301
             }
302
-        }else{
302
+        } else {
303 303
             $f = fopen($file, 'w+');
304 304
             $octetWritten = fwrite($f, $data);
305 305
             fclose($f);
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -95,11 +95,11 @@  discard block
 block discarded – undo
95 95
                 return $full_path_tmp;
96 96
             }
97 97
             return $full_path;
98
-        }else{
98
+        } else{
99 99
             if (!isset($this->tmp[ $full_path_hash ]) || (!@file_exists($full_path) || !@is_writable($full_path))) {
100 100
                 if (!@file_exists($full_path)) {
101 101
                     @mkdir($full_path, $this->getDefaultChmod(), true);
102
-                }else if (!@is_writable($full_path)) {
102
+                } else if (!@is_writable($full_path)) {
103 103
                     if (!@chmod($full_path, $this->getDefaultChmod()) && $this->config[ 'autoTmpFallback' ])
104 104
                     {
105 105
                         /**
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
             if(!rename($tmpFilename, $file)){
300 300
                 throw new phpFastCacheIOException(sprintf('Failed to rename %s to %s', $tmpFilename, $file));
301 301
             }
302
-        }else{
302
+        } else{
303 303
             $f = fopen($file, 'w+');
304 304
             $octetWritten = fwrite($f, $data);
305 305
             fclose($f);
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Couchbase/Driver.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -137,10 +137,10 @@  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';
141
-            $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : '';
142
-            $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : '';
143
-            $buckets = isset($this->config[ 'buckets' ]) ? $this->config[ 'buckets' ] : [
140
+            $host = isset($this->config['host']) ? $this->config['host'] : '127.0.0.1';
141
+            $password = isset($this->config['password']) ? $this->config['password'] : '';
142
+            $username = isset($this->config['username']) ? $this->config['username'] : '';
143
+            $buckets = isset($this->config['buckets']) ? $this->config['buckets'] : [
144 144
               [
145 145
                 'bucket' => 'default',
146 146
                 'password' => '',
@@ -150,8 +150,8 @@  discard block
 block discarded – undo
150 150
             $this->instance = new CouchbaseClient("couchbase://{$host}", $username, $password);
151 151
 
152 152
             foreach ($buckets as $bucket) {
153
-                $this->bucketCurrent = $this->bucketCurrent ?: $bucket[ 'bucket' ];
154
-                $this->setBucket($bucket[ 'bucket' ], $this->instance->openBucket($bucket[ 'bucket' ], $bucket[ 'password' ]));
153
+                $this->bucketCurrent = $this->bucketCurrent ?: $bucket['bucket'];
154
+                $this->setBucket($bucket['bucket'], $this->instance->openBucket($bucket['bucket'], $bucket['password']));
155 155
             }
156 156
         }
157 157
 
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
      */
164 164
     protected function getBucket()
165 165
     {
166
-        return $this->bucketInstances[ $this->bucketCurrent ];
166
+        return $this->bucketInstances[$this->bucketCurrent];
167 167
     }
168 168
 
169 169
     /**
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
     protected function setBucket($bucketName, \CouchbaseBucket $CouchbaseBucket)
175 175
     {
176 176
         if (!array_key_exists($bucketName, $this->bucketInstances)) {
177
-            $this->bucketInstances[ $bucketName ] = $CouchbaseBucket;
177
+            $this->bucketInstances[$bucketName] = $CouchbaseBucket;
178 178
         } else {
179 179
             throw new \LogicException('A bucket instance with this name already exists.');
180 180
         }
@@ -194,9 +194,9 @@  discard block
 block discarded – undo
194 194
         $info = $this->getBucket()->manager()->info();
195 195
 
196 196
         return (new driverStatistic())
197
-          ->setSize($info[ 'basicStats' ][ 'diskUsed' ])
197
+          ->setSize($info['basicStats']['diskUsed'])
198 198
           ->setRawData($info)
199 199
           ->setData(implode(', ', array_keys($this->itemInstances)))
200
-          ->setInfo('CouchBase version ' . $info[ 'nodes' ][ 0 ][ 'version' ] . ', Uptime (in days): ' . round($info[ 'nodes' ][ 0 ][ 'uptime' ] / 86400, 1) . "\n For more information see RawData.");
200
+          ->setInfo('CouchBase version ' . $info['nodes'][0]['version'] . ', Uptime (in days): ' . round($info['nodes'][0]['uptime'] / 86400, 1) . "\n For more information see RawData.");
201 201
     }
202 202
 }
203 203
\ No newline at end of file
Please login to merge, or discard this patch.
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 = new CouchbaseClient("couchbase://{$host}", $username, $password);
@@ -195,9 +195,9 @@  discard block
 block discarded – undo
195 195
         $info = $this->getBucket()->manager()->info();
196 196
 
197 197
         return (new driverStatistic())
198
-          ->setSize($info[ 'basicStats' ][ 'diskUsed' ])
199
-          ->setRawData($info)
200
-          ->setData(implode(', ', array_keys($this->itemInstances)))
201
-          ->setInfo('CouchBase version ' . $info[ 'nodes' ][ 0 ][ 'version' ] . ', Uptime (in days): ' . round($info[ 'nodes' ][ 0 ][ 'uptime' ] / 86400, 1) . "\n For more information see RawData.");
198
+            ->setSize($info[ 'basicStats' ][ 'diskUsed' ])
199
+            ->setRawData($info)
200
+            ->setData(implode(', ', array_keys($this->itemInstances)))
201
+            ->setInfo('CouchBase version ' . $info[ 'nodes' ][ 0 ][ 'version' ] . ', Uptime (in days): ' . round($info[ 'nodes' ][ 0 ][ 'uptime' ] / 86400, 1) . "\n For more information see RawData.");
202 202
     }
203 203
 }
204 204
\ No newline at end of file
Please login to merge, or discard this patch.
src/phpFastCache/CacheManager.php 4 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
     }
236 236
 
237 237
     /**
238
-     * @return array
238
+     * @return ExtendedCacheItemPoolInterface[]
239 239
      */
240 240
     public static function getDefaultConfig()
241 241
     {
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
     }
244 244
 
245 245
     /**
246
-     * @return array
246
+     * @return string[]
247 247
      */
248 248
     public static function getStaticSystemDrivers()
249 249
     {
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
     }
269 269
 
270 270
     /**
271
-     * @return array
271
+     * @return string[]
272 272
      */
273 273
     public static function getStaticAllDrivers()
274 274
     {
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -109,14 +109,14 @@  discard block
 block discarded – undo
109 109
             try{
110 110
                 self::$instances[ $instance ] = new $class($config);
111 111
                 self::$instances[ $instance ]->setEventManager(EventManager::getInstance());
112
-            }catch(phpFastCacheDriverCheckException $e){
112
+            } catch(phpFastCacheDriverCheckException $e){
113 113
                 $fallback = self::standardizeDriverName($config['fallback']);
114 114
                 if($fallback && $fallback !== $driver){
115 115
                     $class = self::getNamespacePath() . $fallback . '\Driver';
116 116
                     self::$instances[ $instance ] = new $class($config);
117 117
                     self::$instances[ $instance ]->setEventManager(EventManager::getInstance());
118 118
                     trigger_error(sprintf('The "%s" driver is unavailable at the moment, the fallback driver "%s" has been used instead.', $driver, $fallback), E_USER_WARNING);
119
-                }else{
119
+                } else{
120 120
                     throw new phpFastCacheDriverCheckException($e->getMessage(), $e->getCode(), $e);
121 121
                 }
122 122
             }
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
             self::$config = array_merge(self::$config, $name);
230 230
         } else if (is_string($name)){
231 231
             self::$config[ $name ] = $value;
232
-        }else{
232
+        } else{
233 233
             throw new phpFastCacheInvalidArgumentException('Invalid variable type: $name');
234 234
         }
235 235
     }
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -169,32 +169,32 @@  discard block
 block discarded – undo
169 169
         }
170 170
 
171 171
         $instance = crc32($driver . serialize($config));
172
-        if (!isset(self::$instances[ $instance ])) {
172
+        if (!isset(self::$instances[$instance])) {
173 173
             $badPracticeOmeter[$driver] = 1;
174
-            if(!$config['ignoreSymfonyNotice'] && interface_exists('Symfony\Component\HttpKernel\KernelInterface') && !class_exists('phpFastCache\Bundle\phpFastCacheBundle')){
174
+            if (!$config['ignoreSymfonyNotice'] && interface_exists('Symfony\Component\HttpKernel\KernelInterface') && !class_exists('phpFastCache\Bundle\phpFastCacheBundle')) {
175 175
                 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);
176 176
             }
177 177
             $class = self::getNamespacePath() . $driver . '\Driver';
178
-            try{
179
-                self::$instances[ $instance ] = new $class($config);
180
-                self::$instances[ $instance ]->setEventManager(EventManager::getInstance());
181
-            }catch(phpFastCacheDriverCheckException $e){
178
+            try {
179
+                self::$instances[$instance] = new $class($config);
180
+                self::$instances[$instance]->setEventManager(EventManager::getInstance());
181
+            } catch (phpFastCacheDriverCheckException $e) {
182 182
                 $fallback = self::standardizeDriverName($config['fallback']);
183
-                if($fallback && $fallback !== $driver){
183
+                if ($fallback && $fallback !== $driver) {
184 184
                     $class = self::getNamespacePath() . $fallback . '\Driver';
185
-                    self::$instances[ $instance ] = new $class($config);
186
-                    self::$instances[ $instance ]->setEventManager(EventManager::getInstance());
185
+                    self::$instances[$instance] = new $class($config);
186
+                    self::$instances[$instance]->setEventManager(EventManager::getInstance());
187 187
                     trigger_error(sprintf('The "%s" driver is unavailable at the moment, the fallback driver "%s" has been used instead.', $driver, $fallback), E_USER_WARNING);
188
-                }else{
188
+                } else {
189 189
                     throw new phpFastCacheDriverCheckException($e->getMessage(), $e->getCode(), $e);
190 190
                 }
191 191
             }
192
-        } else if(++$badPracticeOmeter[$driver] >= 5){
192
+        } else if (++$badPracticeOmeter[$driver] >= 5) {
193 193
             trigger_error('[' . $driver . '] Calling many times CacheManager::getInstance() for already instanced drivers is a bad practice and have a significant impact on performances.
194 194
            See https://github.com/PHPSocialNetwork/phpfastcache/wiki/[V5]-Why-calling-getInstance%28%29-each-time-is-a-bad-practice-%3F');
195 195
         }
196 196
 
197
-        return self::$instances[ $instance ];
197
+        return self::$instances[$instance];
198 198
     }
199 199
 
200 200
     /**
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
      */
256 256
     public static function __callStatic($name, $arguments)
257 257
     {
258
-        $options = (array_key_exists(0, $arguments) && is_array($arguments) ? $arguments[ 0 ] : []);
258
+        $options = (array_key_exists(0, $arguments) && is_array($arguments) ? $arguments[0] : []);
259 259
 
260 260
         return self::getInstance($name, $options);
261 261
     }
@@ -296,9 +296,9 @@  discard block
 block discarded – undo
296 296
     {
297 297
         if (is_array($name)) {
298 298
             self::$config = array_merge(self::$config, $name);
299
-        } else if (is_string($name)){
300
-            self::$config[ $name ] = $value;
301
-        }else{
299
+        } else if (is_string($name)) {
300
+            self::$config[$name] = $value;
301
+        } else {
302 302
             throw new phpFastCacheInvalidArgumentException('Invalid variable type: $name');
303 303
         }
304 304
     }
@@ -367,70 +367,70 @@  discard block
 block discarded – undo
367 367
     protected static function validateConfig(array $config)
368 368
     {
369 369
         foreach ($config as $configName => $configValue) {
370
-            switch($configName)
370
+            switch ($configName)
371 371
             {
372 372
                 case 'itemDetailedDate':
373
-                    if(!is_bool($configValue)){
373
+                    if (!is_bool($configValue)) {
374 374
                         throw new phpFastCacheInvalidConfigurationException("{$configName} must be a boolean");
375 375
                     }
376 376
                     break;
377 377
                 case 'autoTmpFallback':
378
-                    if(!is_bool($configValue)){
378
+                    if (!is_bool($configValue)) {
379 379
                         throw new phpFastCacheInvalidConfigurationException("{$configName} must be a boolean");
380 380
                     }
381 381
                     break;
382 382
                 case 'secureFileManipulation':
383
-                    if(!is_bool($configValue)){
383
+                    if (!is_bool($configValue)) {
384 384
                         throw new phpFastCacheInvalidConfigurationException("{$configName} must be a boolean");
385 385
                     }
386 386
                     break;
387 387
                 case 'ignoreSymfonyNotice':
388
-                    if(!is_bool($configValue)){
388
+                    if (!is_bool($configValue)) {
389 389
                         throw new phpFastCacheInvalidConfigurationException("{$configName} must be a boolean");
390 390
                     }
391 391
                     break;
392 392
                 case 'defaultTtl':
393
-                    if(!is_numeric($configValue)){
393
+                    if (!is_numeric($configValue)) {
394 394
                         throw new phpFastCacheInvalidConfigurationException("{$configName} must be numeric");
395 395
                     }
396 396
                     break;
397 397
                 case 'defaultKeyHashFunction':
398
-                    if(!is_string($configValue) && !function_exists($configValue)){
398
+                    if (!is_string($configValue) && !function_exists($configValue)) {
399 399
                         throw new phpFastCacheInvalidConfigurationException("{$configName} must be a valid function name string");
400 400
                     }
401 401
                     break;
402 402
                 case 'securityKey':
403
-                    if(!is_string($configValue)){
403
+                    if (!is_string($configValue)) {
404 404
                         throw new phpFastCacheInvalidConfigurationException("{$configName} must be a string");
405 405
                     }
406 406
                     break;
407 407
                 case 'htaccess':
408
-                    if(!is_bool($configValue)){
408
+                    if (!is_bool($configValue)) {
409 409
                         throw new phpFastCacheInvalidConfigurationException("{$configName} must be a boolean");
410 410
                     }
411 411
                     break;
412 412
                 case 'default_chmod':
413
-                    if(!is_int($configValue)){
413
+                    if (!is_int($configValue)) {
414 414
                         throw new phpFastCacheInvalidConfigurationException("{$configName} must be an integer");
415 415
                     }
416 416
                     break;
417 417
                 case 'path':
418
-                    if(!is_string($configValue)){
418
+                    if (!is_string($configValue)) {
419 419
                         throw new phpFastCacheInvalidConfigurationException("{$configName} must be a string");
420 420
                     }
421 421
                     break;
422 422
                 case 'fallback':
423
-                    if(!is_bool($configValue)){
423
+                    if (!is_bool($configValue)) {
424 424
                         throw new phpFastCacheInvalidConfigurationException("{$configName} must be a boolean");
425 425
                     }
426 426
                     break;
427 427
                 case 'limited_memory_each_object':
428
-                    if(!is_int($configValue)){
428
+                    if (!is_int($configValue)) {
429 429
                         throw new phpFastCacheInvalidConfigurationException("{$configName} must be an integer");
430 430
                     }
431 431
                     break;
432 432
                 case 'compress_data':
433
-                    if(!is_bool($configValue)){
433
+                    if (!is_bool($configValue)) {
434 434
                         throw new phpFastCacheInvalidConfigurationException("{$configName} must be a boolean");
435 435
                     }
436 436
                     break;
Please login to merge, or discard this patch.
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -62,95 +62,95 @@  discard block
 block discarded – undo
62 62
         /**
63 63
          * Specify if the item must provide detailed creation/modification dates
64 64
          */
65
-      'itemDetailedDate' => false,
65
+        'itemDetailedDate' => false,
66 66
 
67 67
         /**
68 68
          * Automatically attempt to fallback to temporary directory
69 69
          * if the cache fails to write on the specified directory
70 70
          */
71
-      'autoTmpFallback' => false,
71
+        'autoTmpFallback' => false,
72 72
 
73 73
         /**
74 74
          * Provide a secure file manipulation mechanism
75 75
          * on intensive usage the performance can be affected.
76 76
          */
77
-      'secureFileManipulation' => false,
77
+        'secureFileManipulation' => false,
78 78
 
79 79
         /**
80 80
          * Ignore Symfony notice for Symfony project which
81 81
          * do not makes use of PhpFastCache's Symfony Bundle
82 82
          */
83
-      'ignoreSymfonyNotice' => false,
83
+        'ignoreSymfonyNotice' => false,
84 84
 
85 85
         /**
86 86
          * Default time-to-live in second
87 87
          */
88
-      'defaultTtl' => 900,
88
+        'defaultTtl' => 900,
89 89
 
90 90
         /**
91 91
          * Default key hash function
92 92
          * (md5 by default)
93 93
          */
94
-      'defaultKeyHashFunction' => '',
94
+        'defaultKeyHashFunction' => '',
95 95
 
96 96
         /**
97 97
          * The securityKey that will be used
98 98
          * to create sub-directory
99 99
          * (Files-based drivers only)
100 100
          */
101
-      'securityKey' => 'auto',
101
+        'securityKey' => 'auto',
102 102
 
103 103
         /**
104 104
          * Auto-generate .htaccess if it's missing
105 105
          * (Files-based drivers only)
106 106
          */
107
-      'htaccess' => true,
107
+        'htaccess' => true,
108 108
 
109 109
         /**
110 110
          * Default files chmod
111 111
          * 0777 recommended
112 112
          * (Files-based drivers only)
113 113
          */
114
-      'default_chmod' => 0777,
114
+        'default_chmod' => 0777,
115 115
 
116 116
         /**
117 117
          * The path where we will writecache files
118 118
          * default value if empty: sys_get_temp_dir()
119 119
          * (Files-based drivers only)
120 120
          */
121
-      'path' => '',
121
+        'path' => '',
122 122
 
123 123
         /**
124 124
          * Driver fallback in case of failure.
125 125
          * Caution, in case of failure an E_WARNING
126 126
          * error will always be raised
127 127
          */
128
-      'fallback' => false,
128
+        'fallback' => false,
129 129
 
130 130
         /**
131 131
          * Maximum size (bytes) of object store in memory
132 132
          * (Memcache(d) drivers only)
133 133
          */
134
-      'limited_memory_each_object' => 4096,
134
+        'limited_memory_each_object' => 4096,
135 135
 
136 136
         /**
137 137
          * Compress stored data, if the backend supports it
138 138
          * (Memcache(d) drivers only)
139 139
          */
140
-      'compress_data' => false,
140
+        'compress_data' => false,
141 141
 
142 142
         /**
143 143
          * Prevent cache slams when
144 144
          * making use of heavy cache
145 145
          * items
146 146
          */
147
-      'preventCacheSlams' => false,
147
+        'preventCacheSlams' => false,
148 148
 
149 149
         /**
150 150
          * Cache slams timeout
151 151
          * in seconds
152 152
          */
153
-      'cacheSlamsTimeout' => 15,
153
+        'cacheSlamsTimeout' => 15,
154 154
 
155 155
     ];
156 156
 
@@ -333,24 +333,24 @@  discard block
 block discarded – undo
333 333
     public static function getStaticSystemDrivers()
334 334
     {
335 335
         return [
336
-          'Apc',
337
-          'Apcu',
338
-          'Cassandra',
339
-          'Couchbase',
340
-          'Couchdb',
341
-          'Devnull',
342
-          'Files',
343
-          'Leveldb',
344
-          'Memcache',
345
-          'Memcached',
346
-          'Memstatic',
347
-          'Mongodb',
348
-          'Predis',
349
-          'Redis',
350
-          'Ssdb',
351
-          'Sqlite',
352
-          'Wincache',
353
-          'Xcache',
336
+            'Apc',
337
+            'Apcu',
338
+            'Cassandra',
339
+            'Couchbase',
340
+            'Couchdb',
341
+            'Devnull',
342
+            'Files',
343
+            'Leveldb',
344
+            'Memcache',
345
+            'Memcached',
346
+            'Memstatic',
347
+            'Mongodb',
348
+            'Predis',
349
+            'Redis',
350
+            'Ssdb',
351
+            'Sqlite',
352
+            'Wincache',
353
+            'Xcache',
354 354
         ];
355 355
     }
356 356
 
@@ -360,9 +360,9 @@  discard block
 block discarded – undo
360 360
     public static function getStaticAllDrivers()
361 361
     {
362 362
         return array_merge(self::getStaticSystemDrivers(), [
363
-          'Devtrue',
364
-          'Devfalse',
365
-          'Cookie',
363
+            'Devtrue',
364
+            'Devfalse',
365
+            'Cookie',
366 366
         ]);
367 367
     }
368 368
 
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Predis/Driver.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
      */
125 125
     protected function driverConnect()
126 126
     {
127
-        $config = isset($this->config[ 'predis' ]) ? $this->config[ 'predis' ] : [];
127
+        $config = isset($this->config['predis']) ? $this->config['predis'] : [];
128 128
 
129 129
         $this->instance = new PredisClient(array_merge([
130 130
           'host' => '127.0.0.1',
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
         $info = $this->instance->info();
151 151
         $size = (isset($info['Memory']['used_memory']) ? $info['Memory']['used_memory'] : 0);
152 152
         $version = (isset($info['Server']['redis_version']) ? $info['Server']['redis_version'] : 0);
153
-        $date = (isset($info['Server'][ 'uptime_in_seconds' ]) ? (new \DateTime())->setTimestamp(time() - $info['Server'][ 'uptime_in_seconds' ]) : 'unknown date');
153
+        $date = (isset($info['Server']['uptime_in_seconds']) ? (new \DateTime())->setTimestamp(time() - $info['Server']['uptime_in_seconds']) : 'unknown date');
154 154
 
155 155
         return (new driverStatistic())
156 156
           ->setData(implode(', ', array_keys($this->itemInstances)))
Please login to merge, or discard this patch.
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -125,10 +125,10 @@  discard block
 block discarded – undo
125 125
         $config = isset($this->config[ 'predis' ]) ? $this->config[ 'predis' ] : [];
126 126
 
127 127
         $this->instance = new PredisClient(array_merge([
128
-          'host' => '127.0.0.1',
129
-          'port' => 6379,
130
-          'password' => null,
131
-          'database' => null,
128
+            'host' => '127.0.0.1',
129
+            'port' => 6379,
130
+            'password' => null,
131
+            'database' => null,
132 132
         ], $config));
133 133
 
134 134
         return true;
@@ -151,9 +151,9 @@  discard block
 block discarded – undo
151 151
         $date = (isset($info['Server'][ 'uptime_in_seconds' ]) ? (new \DateTime())->setTimestamp(time() - $info['Server'][ 'uptime_in_seconds' ]) : 'unknown date');
152 152
 
153 153
         return (new driverStatistic())
154
-          ->setData(implode(', ', array_keys($this->itemInstances)))
155
-          ->setRawData($info)
156
-          ->setSize($size)
157
-          ->setInfo(sprintf("The Redis daemon v%s is up since %s.\n For more information see RawData. \n Driver size includes the memory allocation size.", $version, $date->format(DATE_RFC2822)));
154
+            ->setData(implode(', ', array_keys($this->itemInstances)))
155
+            ->setRawData($info)
156
+            ->setSize($size)
157
+            ->setInfo(sprintf("The Redis daemon v%s is up since %s.\n For more information see RawData. \n Driver size includes the memory allocation size.", $version, $date->format(DATE_RFC2822)));
158 158
     }
159 159
 }
160 160
\ No newline at end of file
Please login to merge, or discard this patch.
src/phpFastCache/Helper/Psr16Adapter.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -63,8 +63,8 @@
 block discarded – undo
63 63
     {
64 64
         try {
65 65
             $cacheItem = $this->internalCacheInstance
66
-              ->getItem($key)
67
-              ->set($value);
66
+                ->getItem($key)
67
+                ->set($value);
68 68
             if (is_int($ttl) || $ttl instanceof \DateInterval) {
69 69
                 $cacheItem->expiresAfter($ttl);
70 70
             }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@
 block discarded – undo
110 110
     public function getMultiple($keys, $default = null)
111 111
     {
112 112
         try {
113
-            return array_map(function (ExtendedCacheItemInterface $item) {
113
+            return array_map(function(ExtendedCacheItemInterface $item) {
114 114
                 return $item->get();
115 115
             }, $this->internalCacheInstance->getItems($keys));
116 116
         } catch (phpFastCacheInvalidArgumentException $e) {
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Cassandra/Driver.php 4 patches
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 
131 131
             if($results instanceof Cassandra\Rows && $results->count() === 1){
132 132
                 return $this->decode($results->first()['cache_data']);
133
-            }else{
133
+            } else{
134 134
                 return null;
135 135
             }
136 136
         } catch (Cassandra\Exception $e) {
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
             if(!empty($this->config['ssl']['enabled'])){
218 218
                 if(!empty($this->config['ssl']['verify'])){
219 219
                     $sslBuilder = Cassandra::ssl()->withVerifyFlags(Cassandra::VERIFY_PEER_CERT);
220
-                }else{
220
+                } else{
221 221
                     $sslBuilder = Cassandra::ssl()->withVerifyFlags(Cassandra::VERIFY_NONE);
222 222
                 }
223 223
 
Please login to merge, or discard this patch.
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -73,16 +73,16 @@  discard block
 block discarded – undo
73 73
         if ($item instanceof Item) {
74 74
             $cacheData = $this->encode($this->driverPreWrap($item));
75 75
             $options = new Cassandra\ExecutionOptions([
76
-              'arguments' => [
77
-                  'cache_uuid' => new Cassandra\Uuid(),
78
-                  'cache_id' => $item->getKey(),
79
-                  'cache_data' => $cacheData,
80
-                  'cache_creation_date' => new Cassandra\Timestamp((new \DateTime())->getTimestamp()),
81
-                  'cache_expiration_date' => new Cassandra\Timestamp($item->getExpirationDate()->getTimestamp()),
82
-                  'cache_length' => strlen($cacheData)
76
+                'arguments' => [
77
+                    'cache_uuid' => new Cassandra\Uuid(),
78
+                    'cache_id' => $item->getKey(),
79
+                    'cache_data' => $cacheData,
80
+                    'cache_creation_date' => new Cassandra\Timestamp((new \DateTime())->getTimestamp()),
81
+                    'cache_expiration_date' => new Cassandra\Timestamp($item->getExpirationDate()->getTimestamp()),
82
+                    'cache_length' => strlen($cacheData)
83 83
                 ],
84
-              'consistency' => Cassandra::CONSISTENCY_ALL,
85
-              'serial_consistency' => Cassandra::CONSISTENCY_SERIAL
84
+                'consistency' => Cassandra::CONSISTENCY_ALL,
85
+                'serial_consistency' => Cassandra::CONSISTENCY_SERIAL
86 86
             ]);
87 87
 
88 88
             $query = sprintf('INSERT INTO %s.%s
@@ -117,13 +117,13 @@  discard block
 block discarded – undo
117 117
     {
118 118
         try {
119 119
             $options = new Cassandra\ExecutionOptions([
120
-              'arguments' => ['cache_id' => $item->getKey()],
121
-              'page_size' => 1
120
+                'arguments' => ['cache_id' => $item->getKey()],
121
+                'page_size' => 1
122 122
             ]);
123 123
             $query = sprintf(
124
-              'SELECT cache_data FROM %s.%s WHERE cache_id = :cache_id;',
125
-              self::CASSANDRA_KEY_SPACE,
126
-              self::CASSANDRA_TABLE
124
+                'SELECT cache_data FROM %s.%s WHERE cache_id = :cache_id;',
125
+                self::CASSANDRA_KEY_SPACE,
126
+                self::CASSANDRA_TABLE
127 127
             );
128 128
             $results = $this->instance->execute(new Cassandra\SimpleStatement($query), $options);
129 129
 
@@ -150,14 +150,14 @@  discard block
 block discarded – undo
150 150
         if ($item instanceof Item) {
151 151
             try {
152 152
                 $options = new Cassandra\ExecutionOptions([
153
-                  'arguments' => [
153
+                    'arguments' => [
154 154
                     'cache_id' => $item->getKey(),
155
-                  ],
155
+                    ],
156 156
                 ]);
157 157
                 $result = $this->instance->execute(new Cassandra\SimpleStatement(sprintf(
158
-                  'DELETE FROM %s.%s WHERE cache_id = :cache_id;',
159
-                  self::CASSANDRA_KEY_SPACE,
160
-                  self::CASSANDRA_TABLE
158
+                    'DELETE FROM %s.%s WHERE cache_id = :cache_id;',
159
+                    self::CASSANDRA_KEY_SPACE,
160
+                    self::CASSANDRA_TABLE
161 161
                 )), $options);
162 162
 
163 163
                 /**
@@ -181,8 +181,8 @@  discard block
 block discarded – undo
181 181
     {
182 182
         try {
183 183
             $result = $this->instance->execute(new Cassandra\SimpleStatement(sprintf(
184
-              'TRUNCATE %s.%s;',
185
-              self::CASSANDRA_KEY_SPACE, self::CASSANDRA_TABLE
184
+                'TRUNCATE %s.%s;',
185
+                self::CASSANDRA_KEY_SPACE, self::CASSANDRA_TABLE
186 186
             )));
187 187
             /**
188 188
              * There's no real way atm
@@ -210,8 +210,8 @@  discard block
 block discarded – undo
210 210
             $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : '';
211 211
 
212 212
             $clusterBuilder = Cassandra::cluster()
213
-              ->withContactPoints($host)
214
-              ->withPort($port);
213
+                ->withContactPoints($host)
214
+                ->withPort($port);
215 215
 
216 216
             if(!empty($this->config['ssl']['enabled'])){
217 217
                 if(!empty($this->config['ssl']['verify'])){
@@ -239,8 +239,8 @@  discard block
 block discarded – undo
239 239
              */
240 240
 
241 241
             $this->instance->execute(new Cassandra\SimpleStatement(sprintf(
242
-              "CREATE KEYSPACE IF NOT EXISTS %s WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };",
243
-              self::CASSANDRA_KEY_SPACE
242
+                "CREATE KEYSPACE IF NOT EXISTS %s WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };",
243
+                self::CASSANDRA_KEY_SPACE
244 244
             )));
245 245
             $this->instance->execute(new Cassandra\SimpleStatement(sprintf('USE %s;', self::CASSANDRA_KEY_SPACE)));
246 246
             $this->instance->execute(new Cassandra\SimpleStatement(sprintf('
@@ -286,15 +286,15 @@  discard block
 block discarded – undo
286 286
     public function getStats()
287 287
     {
288 288
         $result = $this->instance->execute(new Cassandra\SimpleStatement(sprintf(
289
-          'SELECT SUM(cache_length) as cache_size FROM %s.%s',
290
-          self::CASSANDRA_KEY_SPACE,
291
-          self::CASSANDRA_TABLE
289
+            'SELECT SUM(cache_length) as cache_size FROM %s.%s',
290
+            self::CASSANDRA_KEY_SPACE,
291
+            self::CASSANDRA_TABLE
292 292
         )));
293 293
 
294 294
         return (new driverStatistic())
295
-          ->setSize($result->first()[ 'cache_size' ])
296
-          ->setRawData([])
297
-          ->setData(implode(', ', array_keys($this->itemInstances)))
298
-          ->setInfo('The cache size represents only the cache data itself without counting data structures associated to the cache entries.');
295
+            ->setSize($result->first()[ 'cache_size' ])
296
+            ->setRawData([])
297
+            ->setData(implode(', ', array_keys($this->itemInstances)))
298
+            ->setInfo('The cache size represents only the cache data itself without counting data structures associated to the cache entries.');
299 299
     }
300 300
 }
301 301
\ No newline at end of file
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@
 block discarded – undo
62 62
 
63 63
     /**
64 64
      * @param \Psr\Cache\CacheItemInterface $item
65
-     * @return mixed
65
+     * @return boolean
66 66
      * @throws phpFastCacheInvalidArgumentException
67 67
      */
68 68
     protected function driverWrite(CacheItemInterface $item)
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
             );
128 128
             $results = $this->instance->execute(new Cassandra\SimpleStatement($query), $options);
129 129
 
130
-            if($results instanceof Cassandra\Rows && $results->count() === 1){
130
+            if ($results instanceof Cassandra\Rows && $results->count() === 1) {
131 131
                 return $this->decode($results->first()['cache_data']);
132
-            }else{
132
+            } else {
133 133
                 return null;
134 134
             }
135 135
         } catch (Cassandra\Exception $e) {
@@ -203,20 +203,20 @@  discard block
 block discarded – undo
203 203
         if ($this->instance instanceof CassandraSession) {
204 204
             throw new \LogicException('Already connected to Couchbase server');
205 205
         } else {
206
-            $host = isset($this->config[ 'host' ]) ? $this->config[ 'host' ] : '127.0.0.1';
207
-            $port = isset($this->config[ 'port' ]) ? $this->config[ 'port' ] : 9042;
208
-            $timeout = isset($this->config[ 'timeout' ]) ? $this->config[ 'timeout' ] : 2;
209
-            $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : '';
210
-            $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : '';
206
+            $host = isset($this->config['host']) ? $this->config['host'] : '127.0.0.1';
207
+            $port = isset($this->config['port']) ? $this->config['port'] : 9042;
208
+            $timeout = isset($this->config['timeout']) ? $this->config['timeout'] : 2;
209
+            $password = isset($this->config['password']) ? $this->config['password'] : '';
210
+            $username = isset($this->config['username']) ? $this->config['username'] : '';
211 211
 
212 212
             $clusterBuilder = Cassandra::cluster()
213 213
               ->withContactPoints($host)
214 214
               ->withPort($port);
215 215
 
216
-            if(!empty($this->config['ssl']['enabled'])){
217
-                if(!empty($this->config['ssl']['verify'])){
216
+            if (!empty($this->config['ssl']['enabled'])) {
217
+                if (!empty($this->config['ssl']['verify'])) {
218 218
                     $sslBuilder = Cassandra::ssl()->withVerifyFlags(Cassandra::VERIFY_PEER_CERT);
219
-                }else{
219
+                } else {
220 220
                     $sslBuilder = Cassandra::ssl()->withVerifyFlags(Cassandra::VERIFY_NONE);
221 221
                 }
222 222
 
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 
226 226
             $clusterBuilder->withConnectTimeout($timeout);
227 227
 
228
-            if($username){
228
+            if ($username) {
229 229
                 $clusterBuilder->withCredentials($username, $password);
230 230
             }
231 231
 
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
         )));
293 293
 
294 294
         return (new driverStatistic())
295
-          ->setSize($result->first()[ 'cache_size' ])
295
+          ->setSize($result->first()['cache_size'])
296 296
           ->setRawData([])
297 297
           ->setData(implode(', ', array_keys($this->itemInstances)))
298 298
           ->setInfo('The cache size represents only the cache data itself without counting data structures associated to the cache entries.');
Please login to merge, or discard this patch.
src/phpFastCache/Core/Pool/CacheItemPoolTrait.php 4 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 
238 238
     /**
239 239
      * @param \Psr\Cache\CacheItemInterface $item
240
-     * @return mixed
240
+     * @return boolean
241 241
      * @throws phpFastCacheInvalidArgumentException
242 242
      * @throws \RuntimeException
243 243
      */
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
     }
295 295
 
296 296
     /**
297
-     * @return mixed|null
297
+     * @return boolean
298 298
      * @throws phpFastCacheInvalidArgumentException
299 299
      */
300 300
     public function commit()
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -148,9 +148,9 @@
 block discarded – undo
148 148
                              * Reset the Item
149 149
                              */
150 150
                             $item->set(null)
151
-                              ->expiresAfter(abs((int) $this->getConfig()[ 'defaultTtl' ]))
152
-                              ->setHit(false)
153
-                              ->setTags([]);
151
+                                ->expiresAfter(abs((int) $this->getConfig()[ 'defaultTtl' ]))
152
+                                ->setHit(false)
153
+                                ->setTags([]);
154 154
                             if($this->config['itemDetailedDate']){
155 155
 
156 156
                                 /**
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     public function getItem($key)
63 63
     {
64 64
         if (is_string($key)) {
65
-            if (preg_match('~([' . preg_quote(self::$unsupportedKeyChars, '~') . ']+)~', $key, $matches)){
65
+            if (preg_match('~([' . preg_quote(self::$unsupportedKeyChars, '~') . ']+)~', $key, $matches)) {
66 66
                 throw new phpFastCacheInvalidArgumentException('Unsupported key character detected: "' . $matches[1] . '". Please check: https://github.com/PHPSocialNetwork/phpfastcache/wiki/%5BV6%5D-Unsupported-characters-in-key-identifiers');
67 67
             }
68 68
             if (!array_key_exists($key, $this->itemInstances)) {
@@ -81,14 +81,14 @@  discard block
 block discarded – undo
81 81
                     $driverArray = $this->driverRead($item);
82 82
 
83 83
                     if ($driverArray) {
84
-                        if(!is_array($driverArray)){
84
+                        if (!is_array($driverArray)) {
85 85
                             throw new phpFastCacheCoreException(sprintf('The driverRead method returned an unexpected variable type: %s', gettype($driverArray)));
86 86
                         }
87 87
                         $driverData = $this->driverUnwrapData($driverArray);
88 88
 
89
-                        if($this->getConfig()[ 'preventCacheSlams' ]){
90
-                            while($driverData instanceof ItemBatch) {
91
-                                if($driverData->getItemDate()->getTimestamp() + $this->getConfig()[ 'cacheSlamsTimeout' ] < time()){
89
+                        if ($this->getConfig()['preventCacheSlams']) {
90
+                            while ($driverData instanceof ItemBatch) {
91
+                                if ($driverData->getItemDate()->getTimestamp() + $this->getConfig()['cacheSlamsTimeout'] < time()) {
92 92
                                     /**
93 93
                                      * The timeout has been reached
94 94
                                      * Consider that the batch has
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
                         $item->set($driverData);
121 121
                         $item->expiresAt($this->driverUnwrapEdate($driverArray));
122 122
 
123
-                        if($this->config['itemDetailedDate']){
123
+                        if ($this->config['itemDetailedDate']) {
124 124
 
125 125
                             /**
126 126
                              * If the itemDetailedDate has been
@@ -148,10 +148,10 @@  discard block
 block discarded – undo
148 148
                              * Reset the Item
149 149
                              */
150 150
                             $item->set(null)
151
-                              ->expiresAfter(abs((int) $this->getConfig()[ 'defaultTtl' ]))
151
+                              ->expiresAfter(abs((int) $this->getConfig()['defaultTtl']))
152 152
                               ->setHit(false)
153 153
                               ->setTags([]);
154
-                            if($this->config['itemDetailedDate']){
154
+                            if ($this->config['itemDetailedDate']) {
155 155
 
156 156
                                 /**
157 157
                                  * If the itemDetailedDate has been
@@ -164,8 +164,8 @@  discard block
 block discarded – undo
164 164
                         } else {
165 165
                             $item->setHit(true);
166 166
                         }
167
-                    }else{
168
-                        $item->expiresAfter(abs((int) $this->getConfig()[ 'defaultTtl' ]));
167
+                    } else {
168
+                        $item->expiresAfter(abs((int) $this->getConfig()['defaultTtl']));
169 169
                     }
170 170
                 }
171 171
             }
@@ -178,9 +178,9 @@  discard block
 block discarded – undo
178 178
          * @param $this ExtendedCacheItemPoolInterface
179 179
          * @param $this ExtendedCacheItemInterface
180 180
          */
181
-        $this->eventManager->dispatch('CacheGetItem', $this, $this->itemInstances[ $key ]);
181
+        $this->eventManager->dispatch('CacheGetItem', $this, $this->itemInstances[$key]);
182 182
 
183
-        return $this->itemInstances[ $key ];
183
+        return $this->itemInstances[$key];
184 184
     }
185 185
 
186 186
     /**
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
     public function setItem(CacheItemInterface $item)
192 192
     {
193 193
         if ($this->getClassNamespace() . '\\Item' === get_class($item)) {
194
-            $this->itemInstances[ $item->getKey() ] = $item;
194
+            $this->itemInstances[$item->getKey()] = $item;
195 195
 
196 196
             return $this;
197 197
         } else {
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
     {
209 209
         $collection = [];
210 210
         foreach ($keys as $key) {
211
-            $collection[ $key ] = $this->getItem($key);
211
+            $collection[$key] = $this->getItem($key);
212 212
         }
213 213
 
214 214
         return $collection;
@@ -305,8 +305,8 @@  discard block
 block discarded – undo
305 305
          * @var ExtendedCacheItemInterface $item
306 306
          */
307 307
         if (!array_key_exists($item->getKey(), $this->itemInstances)) {
308
-            $this->itemInstances[ $item->getKey() ] = $item;
309
-        } else if(spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])){
308
+            $this->itemInstances[$item->getKey()] = $item;
309
+        } else if (spl_object_hash($item) !== spl_object_hash($this->itemInstances[$item->getKey()])) {
310 310
             throw new \RuntimeException('Spl object hash mismatches ! You probably tried to save a detached item which has been already retrieved from cache.');
311 311
         }
312 312
 
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
         $this->eventManager->dispatch('CacheSaveItem', $this, $item);
319 319
 
320 320
 
321
-        if($this->getConfig()[ 'preventCacheSlams' ]){
321
+        if ($this->getConfig()['preventCacheSlams']) {
322 322
             /**
323 323
              * @var $itemBatch ExtendedCacheItemInterface
324 324
              */
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
             $itemBatch = $class->newInstanceArgs([$this, $item->getKey()]);
327 327
             $itemBatch->setEventManager($this->eventManager)
328 328
                         ->set(new ItemBatch($item->getKey(), new \DateTime()))
329
-                        ->expiresAfter($this->getConfig()[ 'cacheSlamsTimeout' ]);
329
+                        ->expiresAfter($this->getConfig()['cacheSlamsTimeout']);
330 330
 
331 331
             /**
332 332
              * To avoid SPL mismatches
@@ -358,8 +358,8 @@  discard block
 block discarded – undo
358 358
     public function saveDeferred(CacheItemInterface $item)
359 359
     {
360 360
         if (!array_key_exists($item->getKey(), $this->itemInstances)) {
361
-            $this->itemInstances[ $item->getKey() ] = $item;
362
-        }else if(spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])){
361
+            $this->itemInstances[$item->getKey()] = $item;
362
+        } else if (spl_object_hash($item) !== spl_object_hash($this->itemInstances[$item->getKey()])) {
363 363
             throw new \RuntimeException('Spl object hash mismatches ! You probably tried to save a detached item which has been already retrieved from cache.');
364 364
         }
365 365
 
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
          */
371 371
         $this->eventManager->dispatch('CacheSaveDeferredItem', $this, $item);
372 372
 
373
-        return $this->deferredList[ $item->getKey() ] = $item;
373
+        return $this->deferredList[$item->getKey()] = $item;
374 374
     }
375 375
 
376 376
     /**
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
         foreach ($this->deferredList as $key => $item) {
391 391
             $result = $this->save($item);
392 392
             if ($return !== false) {
393
-                unset($this->deferredList[ $key ]);
393
+                unset($this->deferredList[$key]);
394 394
                 $return = $result;
395 395
             }
396 396
         }
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
                         } else {
165 165
                             $item->setHit(true);
166 166
                         }
167
-                    }else{
167
+                    } else{
168 168
                         $item->expiresAfter(abs((int) $this->getConfig()[ 'defaultTtl' ]));
169 169
                     }
170 170
                 }
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
     {
360 360
         if (!array_key_exists($item->getKey(), $this->itemInstances)) {
361 361
             $this->itemInstances[ $item->getKey() ] = $item;
362
-        }else if(spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])){
362
+        } else if(spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])){
363 363
             throw new \RuntimeException('Spl object hash mismatches ! You probably tried to save a detached item which has been already retrieved from cache.');
364 364
         }
365 365
 
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Files/Driver.php 1 patch
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 
61 61
     /**
62 62
      * @param \Psr\Cache\CacheItemInterface $item
63
-     * @return mixed
63
+     * @return boolean
64 64
      * @throws phpFastCacheInvalidArgumentException
65 65
      */
66 66
     protected function driverWrite(CacheItemInterface $item)
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
     /**
147 147
      * @param string $optionName
148 148
      * @param mixed $optionValue
149
-     * @return bool
149
+     * @return boolean|null
150 150
      * @throws phpFastCacheInvalidArgumentException
151 151
      */
152 152
     public static function isValidOption($optionName, $optionValue)
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
     }
180 180
 
181 181
     /**
182
-     * @return array
182
+     * @return string[]
183 183
      */
184 184
     public static function getValidOptions()
185 185
     {
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
     }
188 188
 
189 189
     /**
190
-     * @return array
190
+     * @return string[]
191 191
      */
192 192
     public static function getRequiredOptions()
193 193
     {
Please login to merge, or discard this patch.