Completed
Push — v5 ( 9120d0...3fd0ee )
by Georges
02:35
created
src/phpFastCache/Core/PathSeekerTrait.php 2 patches
Doc Comments   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,7 +25,6 @@  discard block
 block discarded – undo
25 25
     public $tmp = [];
26 26
 
27 27
     /**
28
-     * @param bool $skip_create_path
29 28
      * @param $config
30 29
      * @return string
31 30
      * @throws \Exception
@@ -118,7 +117,7 @@  discard block
 block discarded – undo
118 117
     }
119 118
 
120 119
     /**
121
-     * @param $keyword
120
+     * @param string|false $keyword
122 121
      * @param bool $skip
123 122
      * @return string
124 123
      * @throws phpFastCacheDriverException
@@ -165,7 +164,7 @@  discard block
 block discarded – undo
165 164
 
166 165
     /**
167 166
      * @param $filename
168
-     * @return mixed
167
+     * @return string
169 168
      */
170 169
     protected static function cleanFileName($filename)
171 170
     {
@@ -180,7 +179,7 @@  discard block
 block discarded – undo
180 179
     }
181 180
 
182 181
     /**
183
-     * @param $path
182
+     * @param string $path
184 183
      * @param bool $create
185 184
      * @throws \Exception
186 185
      */
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -34,27 +34,27 @@  discard block
 block discarded – undo
34 34
     {
35 35
         $tmp_dir = ini_get('upload_tmp_dir') ? ini_get('upload_tmp_dir') : sys_get_temp_dir();
36 36
 
37
-        if (!isset($this->config[ 'path' ]) || $this->config[ 'path' ] == '') {
37
+        if (!isset($this->config['path']) || $this->config['path'] == '') {
38 38
             if (self::isPHPModule()) {
39 39
                 $path = $tmp_dir;
40 40
             } else {
41
-                $document_root_path = rtrim($_SERVER[ 'DOCUMENT_ROOT' ], '/') . '/../';
42
-                $path = isset($_SERVER[ 'DOCUMENT_ROOT' ]) && is_writable($document_root_path) ? $document_root_path : rtrim(__DIR__, '/') . '/';
41
+                $document_root_path = rtrim($_SERVER['DOCUMENT_ROOT'], '/') . '/../';
42
+                $path = isset($_SERVER['DOCUMENT_ROOT']) && is_writable($document_root_path) ? $document_root_path : rtrim(__DIR__, '/') . '/';
43 43
             }
44 44
 
45
-            if ($this->config[ 'path' ] != '') {
46
-                $path = $this->config[ 'path' ];
45
+            if ($this->config['path'] != '') {
46
+                $path = $this->config['path'];
47 47
             }
48 48
 
49 49
         } else {
50
-            $path = $this->config[ 'path' ];
50
+            $path = $this->config['path'];
51 51
         }
52 52
 
53
-        $securityKey = array_key_exists('securityKey', $this->config) ? $this->config[ 'securityKey' ] : '';
53
+        $securityKey = array_key_exists('securityKey', $this->config) ? $this->config['securityKey'] : '';
54 54
         if ($securityKey == "" || $securityKey == 'auto') {
55
-            $securityKey = $this->config[ 'securityKey' ];
55
+            $securityKey = $this->config['securityKey'];
56 56
             if ($securityKey == 'auto' || $securityKey == '') {
57
-                $securityKey = isset($_SERVER[ 'HTTP_HOST' ]) ? preg_replace('/^www./', '', strtolower($_SERVER[ 'HTTP_HOST' ])) : "default";
57
+                $securityKey = isset($_SERVER['HTTP_HOST']) ? preg_replace('/^www./', '', strtolower($_SERVER['HTTP_HOST'])) : "default";
58 58
             }
59 59
         }
60 60
         if ($securityKey != '') {
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         $full_pathx = md5($full_path);
68 68
 
69 69
 
70
-        if (!isset($this->tmp[ $full_pathx ])) {
70
+        if (!isset($this->tmp[$full_pathx])) {
71 71
 
72 72
             if (!@file_exists($full_path) || !@is_writable($full_path)) {
73 73
                 if (!@file_exists($full_path)) {
@@ -91,8 +91,8 @@  discard block
 block discarded – undo
91 91
                 }
92 92
             }
93 93
 
94
-            $this->tmp[ $full_pathx ] = true;
95
-            $this->htaccessGen($full_path, array_key_exists('htaccess', $this->config) ? $this->config[ 'htaccess' ] : false);
94
+            $this->tmp[$full_pathx] = true;
95
+            $this->htaccessGen($full_path, array_key_exists('htaccess', $this->config) ? $this->config['htaccess'] : false);
96 96
         }
97 97
 
98 98
         return realpath($full_path);
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
     {
128 128
         $path = $this->getPath() . '/files';
129 129
 
130
-        if($keyword === false)
130
+        if ($keyword === false)
131 131
         {
132 132
             return $path;
133 133
         }
@@ -156,10 +156,10 @@  discard block
 block discarded – undo
156 156
      */
157 157
     public function setChmodAuto()
158 158
     {
159
-        if (!isset($this->config[ 'default_chmod' ]) || $this->config[ 'default_chmod' ] == '' || is_null($this->config[ 'default_chmod' ])) {
159
+        if (!isset($this->config['default_chmod']) || $this->config['default_chmod'] == '' || is_null($this->config['default_chmod'])) {
160 160
             return 0777;
161 161
         } else {
162
-            return $this->config[ 'default_chmod' ];
162
+            return $this->config['default_chmod'];
163 163
         }
164 164
     }
165 165
 
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Files/Driver.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -278,8 +278,8 @@
 block discarded – undo
278 278
         }
279 279
 
280 280
         $stat->setData('')
281
-          ->setSize($size)
282
-          ->setInfo('Number of files used to build the cache: ' . Directory::getFileCount($path));
281
+            ->setSize($size)
282
+            ->setInfo('Number of files used to build the cache: ' . Directory::getFileCount($path));
283 283
 
284 284
         return $stat;
285 285
     }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
             /*
73 73
              * Skip if Existing Caching in Options
74 74
              */
75
-            if (isset($option[ 'skipExisting' ]) && $option[ 'skipExisting' ] == true && file_exists($file_path)) {
75
+            if (isset($option['skipExisting']) && $option['skipExisting'] == true && file_exists($file_path)) {
76 76
                 $content = $this->readfile($file_path);
77 77
                 $old = $this->decode($content);
78 78
                 $toWrite = false;
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
     public static function isValidOption($optionName, $optionValue)
219 219
     {
220 220
         parent::isValidOption($optionName, $optionValue);
221
-        switch($optionName)
221
+        switch ($optionName)
222 222
         {
223 223
             case 'path':
224 224
                 return is_string($optionValue);
@@ -273,7 +273,7 @@  discard block
 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.
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.
src/phpFastCache/Util/Directory.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,11 +39,11 @@
 block discarded – undo
39 39
     {
40 40
         $count = 0;
41 41
         $objects = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path), \RecursiveIteratorIterator::SELF_FIRST);
42
-        foreach($objects as $name => $object){
42
+        foreach ($objects as $name => $object) {
43 43
             /**
44 44
              * @var \SplFileInfo $object
45 45
              */
46
-            if($object->isFile())
46
+            if ($object->isFile())
47 47
             {
48 48
                 $count++;
49 49
             }
Please login to merge, or discard this patch.