Completed
Push — V6 ( 440008...cefaa0 )
by Georges
03:54
created
tests/EventManager.test.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
 $status = 0;
17 17
 echo "Testing EventManager\n";
18 18
 
19
-EventManager::getInstance()->onCacheSaveItem(function(ExtendedCacheItemPoolInterface $itemPool, ExtendedCacheItemInterface $item){
20
-    if($item->get() === 1000){
19
+EventManager::getInstance()->onCacheSaveItem(function(ExtendedCacheItemPoolInterface $itemPool, ExtendedCacheItemInterface $item) {
20
+    if ($item->get() === 1000) {
21 21
         $item->increment(337);
22 22
     }
23 23
 });
@@ -30,9 +30,9 @@  discard block
 block discarded – undo
30 30
 $cacheInstance->save($item);
31 31
 
32 32
 
33
-if($cacheInstance->getItem($cacheKey)->get() === 1337){
33
+if ($cacheInstance->getItem($cacheKey)->get() === 1337) {
34 34
     echo "[PASS] The dispatched event executed the custom callback to alter to item.\n";
35
-}else{
35
+} else {
36 36
     echo "[FAIL] The dispatched event did not worked well, the expected value '1337', got '" . (int) $cacheInstance->getItem($cacheKey)->get() . "'\n";
37 37
     $status = 1;
38 38
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
 if (!class_exists('phpFastCache\CacheManager')) {
16 16
     echo "[FAIL] Autoload failed to find the CacheManager\n";
17 17
     $status = 255;
18
-}else{
18
+} else{
19 19
     echo "[PASS] Autoload successfully found the CacheManager\n";
20 20
 }
21 21
 
Please login to merge, or discard this patch.
src/phpFastCache/Core/Pool/IO/IOHelperTrait.php 4 patches
Doc Comments   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -26,7 +26,6 @@  discard block
 block discarded – undo
26 26
     public $tmp = [];
27 27
 
28 28
     /**
29
-     * @param bool $skip_create_path
30 29
      * @param $config
31 30
      * @return string
32 31
      * @throws phpFastCacheIOException
@@ -135,7 +134,7 @@  discard block
 block discarded – undo
135 134
     }
136 135
 
137 136
     /**
138
-     * @param $keyword
137
+     * @param string|false $keyword
139 138
      * @param bool $skip
140 139
      * @return string
141 140
      * @throws phpFastCacheIOException
@@ -181,7 +180,7 @@  discard block
 block discarded – undo
181 180
 
182 181
     /**
183 182
      * @param $filename
184
-     * @return mixed
183
+     * @return string
185 184
      */
186 185
     protected static function cleanFileName($filename)
187 186
     {
@@ -196,7 +195,7 @@  discard block
 block discarded – undo
196 195
     }
197 196
 
198 197
     /**
199
-     * @param $path
198
+     * @param string $path
200 199
      * @param bool $create
201 200
      * @throws phpFastCacheIOException
202 201
      */
@@ -230,7 +229,7 @@  discard block
 block discarded – undo
230 229
 
231 230
 
232 231
     /**
233
-     * @param $file
232
+     * @param string $file
234 233
      * @return string
235 234
      * @throws phpFastCacheIOException
236 235
      */
Please login to merge, or discard this patch.
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.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -35,30 +35,30 @@  discard block
 block discarded – undo
35 35
     {
36 36
         $tmp_dir = rtrim(ini_get('upload_tmp_dir') ? ini_get('upload_tmp_dir') : sys_get_temp_dir(), '\\/') . DIRECTORY_SEPARATOR . 'phpfastcache';
37 37
 
38
-        if (!isset($this->config[ 'path' ]) || $this->config[ 'path' ] == '') {
38
+        if (!isset($this->config['path']) || $this->config['path'] == '') {
39 39
             if (self::isPHPModule()) {
40 40
                 $path = $tmp_dir;
41 41
             } else {
42
-                $document_root_path = rtrim($_SERVER[ 'DOCUMENT_ROOT' ], '/') . '/../';
43
-                $path = isset($_SERVER[ 'DOCUMENT_ROOT' ]) && is_writable($document_root_path) ? $document_root_path : rtrim(__DIR__, '/') . 'PathSeekerTrait.php/';
42
+                $document_root_path = rtrim($_SERVER['DOCUMENT_ROOT'], '/') . '/../';
43
+                $path = isset($_SERVER['DOCUMENT_ROOT']) && is_writable($document_root_path) ? $document_root_path : rtrim(__DIR__, '/') . 'PathSeekerTrait.php/';
44 44
             }
45 45
 
46
-            if ($this->config[ 'path' ] != '') {
47
-                $path = $this->config[ 'path' ];
46
+            if ($this->config['path'] != '') {
47
+                $path = $this->config['path'];
48 48
             }
49 49
 
50 50
         } else {
51
-            $path = $this->config[ 'path' ];
51
+            $path = $this->config['path'];
52 52
         }
53 53
 
54 54
         if ($getBasePath === true) {
55 55
             return $path;
56 56
         }
57 57
 
58
-        $securityKey = array_key_exists('securityKey', $this->config) ? $this->config[ 'securityKey' ] : '';
58
+        $securityKey = array_key_exists('securityKey', $this->config) ? $this->config['securityKey'] : '';
59 59
         if (!$securityKey || $securityKey === 'auto') {
60
-            if (isset($_SERVER[ 'HTTP_HOST' ])) {
61
-                $securityKey = preg_replace('/^www./', '', strtolower(str_replace(':', '_', $_SERVER[ 'HTTP_HOST' ])));
60
+            if (isset($_SERVER['HTTP_HOST'])) {
61
+                $securityKey = preg_replace('/^www./', '', strtolower(str_replace(':', '_', $_SERVER['HTTP_HOST'])));
62 62
             } else {
63 63
                 $securityKey = ($this->isPHPModule() ? 'web' : 'cli');
64 64
             }
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
         $full_pathx = md5($full_path);
75 75
 
76 76
 
77
-        if (!isset($this->tmp[ $full_pathx ])) {
77
+        if (!isset($this->tmp[$full_pathx])) {
78 78
 
79 79
             if (!@file_exists($full_path) || !@is_writable($full_path)) {
80 80
                 if (!@file_exists($full_path)) {
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
                 }
99 99
             }
100 100
 
101
-            $this->tmp[ $full_pathx ] = true;
102
-            $this->htaccessGen($full_path, array_key_exists('htaccess', $this->config) ? $this->config[ 'htaccess' ] : false);
101
+            $this->tmp[$full_pathx] = true;
102
+            $this->htaccessGen($full_path, array_key_exists('htaccess', $this->config) ? $this->config['htaccess'] : false);
103 103
         }
104 104
 
105 105
         return realpath($full_path);
@@ -172,10 +172,10 @@  discard block
 block discarded – undo
172 172
      */
173 173
     public function setChmodAuto()
174 174
     {
175
-        if (!isset($this->config[ 'default_chmod' ]) || $this->config[ 'default_chmod' ] == '' || is_null($this->config[ 'default_chmod' ])) {
175
+        if (!isset($this->config['default_chmod']) || $this->config['default_chmod'] == '' || is_null($this->config['default_chmod'])) {
176 176
             return 0777;
177 177
         } else {
178
-            return $this->config[ 'default_chmod' ];
178
+            return $this->config['default_chmod'];
179 179
         }
180 180
     }
181 181
 
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
         if ($create === true) {
206 206
             if (!is_writable($path)) {
207 207
                 try {
208
-                    if(!chmod($path, 0777)){
208
+                    if (!chmod($path, 0777)) {
209 209
                         throw new phpFastCacheIOException('Chmod failed on : ' . $path);
210 210
                     }
211 211
                 } catch (phpFastCacheIOException $e) {
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
          */
274 274
         $this->eventManager->dispatch('CacheWriteFileOnDisk', $this, $file, $secureFileManipulation);
275 275
 
276
-        if($secureFileManipulation){
276
+        if ($secureFileManipulation) {
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))
@@ -285,10 +285,10 @@  discard block
 block discarded – undo
285 285
             flock($f, LOCK_UN);
286 286
             fclose($f);
287 287
 
288
-            if(!rename($tmpFilename, $file)){
288
+            if (!rename($tmpFilename, $file)) {
289 289
                 throw new phpFastCacheIOException(sprintf('Failed to rename %s to %s', $tmpFilename, $file));
290 290
             }
291
-        }else{
291
+        } else {
292 292
             $f = fopen($file, 'w+');
293 293
             $octetWritten = fwrite($f, $data);
294 294
             fclose($f);
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -273,7 +273,7 @@
 block discarded – undo
273 273
         
274 274
         if (!is_dir($path)) {
275 275
             throw new phpFastCacheDriverException("Can't read PATH:" . $path, 94);
276
-        }else{
276
+        } else{
277 277
             $size = Directory::dirSize($path);
278 278
         }
279 279
 
Please login to merge, or discard this patch.