Completed
Push — V6 ( 864daf...97df10 )
by Georges
02:24
created
src/phpFastCache/Drivers/Files/Driver.php 2 patches
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 \InvalidArgumentException
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 \InvalidArgumentException
151 151
      */
152 152
     public static function isValidOption($optionName, $optionValue)
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
     }
175 175
 
176 176
     /**
177
-     * @return array
177
+     * @return string[]
178 178
      */
179 179
     public static function getValidOptions()
180 180
     {
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
     }
183 183
 
184 184
     /**
185
-     * @return array
185
+     * @return string[]
186 186
      */
187 187
     public static function getRequiredOptions()
188 188
     {
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -215,11 +215,11 @@
 block discarded – undo
215 215
         }
216 216
 
217 217
         $stat->setData(implode(', ', array_keys($this->itemInstances)))
218
-          ->setRawData([
218
+            ->setRawData([
219 219
             'tmp' => $this->tmp
220
-          ])
221
-          ->setSize(Directory::dirSize($path))
222
-          ->setInfo('Number of files used to build the cache: ' . Directory::getFileCount($path));
220
+            ])
221
+            ->setSize(Directory::dirSize($path))
222
+            ->setInfo('Number of files used to build the cache: ' . Directory::getFileCount($path));
223 223
 
224 224
         return $stat;
225 225
     }
Please login to merge, or discard this patch.
src/phpFastCache/Core/Pool/IO/IOHelperTrait.php 4 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -186,9 +186,9 @@  discard block
 block discarded – undo
186 186
     protected static function cleanFileName($filename)
187 187
     {
188 188
         $regex = [
189
-          '/[\?\[\]\/\\\=\<\>\:\;\,\'\"\&\$\#\*\(\)\|\~\`\!\{\}]/',
190
-          '/\.$/',
191
-          '/^\./',
189
+            '/[\?\[\]\/\\\=\<\>\:\;\,\'\"\&\$\#\*\(\)\|\~\`\!\{\}]/',
190
+            '/\.$/',
191
+            '/^\./',
192 192
         ];
193 193
         $replace = ['-', '', ''];
194 194
 
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
             $tmpFilename = Directory::getAbsolutePath(dirname($file) . '/tmp_' . md5(
278 278
                 str_shuffle(uniqid($this->getDriverName(), false))
279 279
                 . str_shuffle(uniqid($this->getDriverName(), false))
280
-              ));
280
+                ));
281 281
 
282 282
             $f = fopen($tmpFilename, 'w+');
283 283
             flock($f, LOCK_EX);
Please login to merge, or discard this patch.
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 string|false $keyword
134 134
      * @param bool $skip
135 135
      * @return string
136 136
      * @throws phpFastCacheIOException
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 
177 177
     /**
178 178
      * @param $filename
179
-     * @return mixed
179
+     * @return string
180 180
      */
181 181
     protected static function cleanFileName($filename)
182 182
     {
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
     }
192 192
 
193 193
     /**
194
-     * @param $path
194
+     * @param string $path
195 195
      * @param bool $create
196 196
      * @throws phpFastCacheIOException
197 197
      */
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 
226 226
 
227 227
     /**
228
-     * @param $file
228
+     * @param string $file
229 229
      * @return string
230 230
      * @throws phpFastCacheIOException
231 231
      */
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -97,11 +97,11 @@  discard block
 block discarded – undo
97 97
                 return $tmp_dir;
98 98
             }
99 99
             return $full_path;
100
-        }else{
100
+        } else{
101 101
             if (!isset($this->tmp[ $full_path_hash ]) || (!@file_exists($full_path) || !@is_writable($full_path))) {
102 102
                 if (!@file_exists($full_path)) {
103 103
                     @mkdir($full_path, $this->setChmodAuto(), true);
104
-                }else if (!@is_writable($full_path)) {
104
+                } else if (!@is_writable($full_path)) {
105 105
                     @chmod($full_path, $this->setChmodAuto());
106 106
                 }
107 107
 
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
             if(!rename($tmpFilename, $file)){
313 313
                 throw new phpFastCacheIOException(sprintf('Failed to rename %s to %s', $tmpFilename, $file));
314 314
             }
315
-        }else{
315
+        } else{
316 316
             $f = fopen($file, 'w+');
317 317
             $octetWritten = fwrite($f, $data);
318 318
             fclose($f);
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -41,10 +41,10 @@  discard block
 block discarded – undo
41 41
          * Calculate the security key
42 42
          */
43 43
         {
44
-            $securityKey = array_key_exists('securityKey', $this->config) ? $this->config[ 'securityKey' ] : '';
44
+            $securityKey = array_key_exists('securityKey', $this->config) ? $this->config['securityKey'] : '';
45 45
             if (!$securityKey || $securityKey === 'auto') {
46
-                if (isset($_SERVER[ 'HTTP_HOST' ])) {
47
-                    $securityKey = preg_replace('/^www./', '', strtolower(str_replace(':', '_', $_SERVER[ 'HTTP_HOST' ])));
46
+                if (isset($_SERVER['HTTP_HOST'])) {
47
+                    $securityKey = preg_replace('/^www./', '', strtolower(str_replace(':', '_', $_SERVER['HTTP_HOST'])));
48 48
                 } else {
49 49
                     $securityKey = ($this->isPHPModule() ? 'web' : 'cli');
50 50
                 }
@@ -63,10 +63,10 @@  discard block
 block discarded – undo
63 63
          */
64 64
         $tmp_dir = rtrim($tmp_dir, '/') . DIRECTORY_SEPARATOR;
65 65
 
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
 
72 72
         $path_suffix = $securityKey . DIRECTORY_SEPARATOR . $this->getDriverName();
@@ -81,19 +81,19 @@  discard block
 block discarded – undo
81 81
          * return the temp dir
82 82
          */
83 83
         if ($readonly === true) {
84
-            if($this->config[ 'autoTmpFallback' ] && (!@file_exists($full_path) || !@is_writable($full_path))){
84
+            if ($this->config['autoTmpFallback'] && (!@file_exists($full_path) || !@is_writable($full_path))) {
85 85
                 return $full_path_tmp;
86 86
             }
87 87
             return $full_path;
88
-        }else{
89
-            if (!isset($this->tmp[ $full_path_hash ]) || (!@file_exists($full_path) || !@is_writable($full_path))) {
88
+        } else {
89
+            if (!isset($this->tmp[$full_path_hash]) || (!@file_exists($full_path) || !@is_writable($full_path))) {
90 90
                 if (!@file_exists($full_path)) {
91 91
                     @mkdir($full_path, $this->setChmodAuto(), true);
92
-                }else if (!@is_writable($full_path)) {
92
+                } else if (!@is_writable($full_path)) {
93 93
                     @chmod($full_path, $this->setChmodAuto());
94 94
                 }
95 95
 
96
-                if ($this->config[ 'autoTmpFallback' ] && !@is_writable($full_path)) {
96
+                if ($this->config['autoTmpFallback'] && !@is_writable($full_path)) {
97 97
                     /**
98 98
                      * Switch back to tmp dir
99 99
                      * again if the path is not writable
@@ -113,8 +113,8 @@  discard block
 block discarded – undo
113 113
                     throw new phpFastCacheIOException('PLEASE CREATE OR CHMOD ' . $full_path . ' - 0777 OR ANY WRITABLE PERMISSION!');
114 114
                 }
115 115
 
116
-                $this->tmp[ $full_path_hash ] = $full_path;
117
-                $this->htaccessGen($full_path, array_key_exists('htaccess', $this->config) ? $this->config[ 'htaccess' ] : false);
116
+                $this->tmp[$full_path_hash] = $full_path;
117
+                $this->htaccessGen($full_path, array_key_exists('htaccess', $this->config) ? $this->config['htaccess'] : false);
118 118
             }
119 119
         }
120 120
 
@@ -181,10 +181,10 @@  discard block
 block discarded – undo
181 181
      */
182 182
     public function setChmodAuto()
183 183
     {
184
-        if (!isset($this->config[ 'default_chmod' ]) || $this->config[ 'default_chmod' ] == '' || is_null($this->config[ 'default_chmod' ])) {
184
+        if (!isset($this->config['default_chmod']) || $this->config['default_chmod'] == '' || is_null($this->config['default_chmod'])) {
185 185
             return 0777;
186 186
         } else {
187
-            return $this->config[ 'default_chmod' ];
187
+            return $this->config['default_chmod'];
188 188
         }
189 189
     }
190 190
 
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
         if ($create === true) {
215 215
             if (!is_writable($path)) {
216 216
                 try {
217
-                    if(!chmod($path, 0777)){
217
+                    if (!chmod($path, 0777)) {
218 218
                         throw new phpFastCacheIOException('Chmod failed on : ' . $path);
219 219
                     }
220 220
                 } catch (phpFastCacheIOException $e) {
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
          */
286 286
         $this->eventManager->dispatch('CacheWriteFileOnDisk', $this, $file, $secureFileManipulation);
287 287
 
288
-        if($secureFileManipulation){
288
+        if ($secureFileManipulation) {
289 289
             $tmpFilename = Directory::getAbsolutePath(dirname($file) . '/tmp_' . md5(
290 290
                 str_shuffle(uniqid($this->getDriverName(), false))
291 291
                 . str_shuffle(uniqid($this->getDriverName(), false))
@@ -297,10 +297,10 @@  discard block
 block discarded – undo
297 297
             flock($f, LOCK_UN);
298 298
             fclose($f);
299 299
 
300
-            if(!rename($tmpFilename, $file)){
300
+            if (!rename($tmpFilename, $file)) {
301 301
                 throw new phpFastCacheIOException(sprintf('Failed to rename %s to %s', $tmpFilename, $file));
302 302
             }
303
-        }else{
303
+        } else {
304 304
             $f = fopen($file, 'w+');
305 305
             $octetWritten = fwrite($f, $data);
306 306
             fclose($f);
Please login to merge, or discard this patch.