Completed
Pull Request — final (#379)
by Georges
04:06 queued 01:56
created
src/phpFastCache/Core/PathSeekerTrait.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
     }
142 142
 
143 143
     /**
144
-     * @param $keyword
144
+     * @param string|false $keyword
145 145
      * @param bool $skip
146 146
      * @return string
147 147
      * @throws phpFastCacheDriverException
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 
188 188
     /**
189 189
      * @param $filename
190
-     * @return mixed
190
+     * @return string
191 191
      */
192 192
     protected static function cleanFileName($filename)
193 193
     {
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
     }
203 203
 
204 204
     /**
205
-     * @param $path
205
+     * @param string $path
206 206
      * @param bool $create
207 207
      * @throws \Exception
208 208
      */
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -40,10 +40,10 @@  discard block
 block discarded – undo
40 40
          * Calculate the security key
41 41
          */
42 42
         {
43
-            $securityKey = array_key_exists('securityKey', $this->config) ? $this->config[ 'securityKey' ] : '';
43
+            $securityKey = array_key_exists('securityKey', $this->config) ? $this->config['securityKey'] : '';
44 44
             if (!$securityKey || $securityKey === 'auto') {
45
-                if (isset($_SERVER[ 'HTTP_HOST' ])) {
46
-                    $securityKey = preg_replace('/^www./', '', strtolower(str_replace(':', '_', $_SERVER[ 'HTTP_HOST' ])));
45
+                if (isset($_SERVER['HTTP_HOST'])) {
46
+                    $securityKey = preg_replace('/^www./', '', strtolower(str_replace(':', '_', $_SERVER['HTTP_HOST'])));
47 47
                 } else {
48 48
                     $securityKey = ($this->isPHPModule() ? 'web' : 'cli');
49 49
                 }
@@ -58,10 +58,10 @@  discard block
 block discarded – undo
58 58
          * with the security key and the driver name
59 59
          */
60 60
         $tmp_dir = rtrim($tmp_dir, '/') . DIRECTORY_SEPARATOR;
61
-        if (empty($this->config[ 'path' ]) || !is_string($this->config[ 'path' ])) {
61
+        if (empty($this->config['path']) || !is_string($this->config['path'])) {
62 62
             $path = $tmp_dir;
63 63
         } else {
64
-            $path = rtrim($this->config[ 'path' ], '/') . DIRECTORY_SEPARATOR;
64
+            $path = rtrim($this->config['path'], '/') . DIRECTORY_SEPARATOR;
65 65
         }
66 66
         $path_suffix = $securityKey . DIRECTORY_SEPARATOR . $this->getDriverName();
67 67
         $full_path = Directory::getAbsolutePath($path . $path_suffix);
@@ -74,15 +74,15 @@  discard block
 block discarded – undo
74 74
          * return the temp dir
75 75
          */
76 76
         if ($readonly === true) {
77
-            if(!@file_exists($full_path) || !@is_writable($full_path)){
77
+            if (!@file_exists($full_path) || !@is_writable($full_path)) {
78 78
                 return $full_path_tmp;
79 79
             }
80 80
             return $full_path;
81
-        }else{
82
-            if (!isset($this->tmp[ $full_path_hash ]) || (!@file_exists($full_path) || !@is_writable($full_path))) {
81
+        } else {
82
+            if (!isset($this->tmp[$full_path_hash]) || (!@file_exists($full_path) || !@is_writable($full_path))) {
83 83
                 if (!@file_exists($full_path)) {
84 84
                     @mkdir($full_path, $this->setChmodAuto(), true);
85
-                }else if (!@is_writable($full_path)) {
85
+                } else if (!@is_writable($full_path)) {
86 86
                     @chmod($full_path, $this->setChmodAuto());
87 87
                 }
88 88
                 if (!@is_writable($full_path)) {
@@ -103,8 +103,8 @@  discard block
 block discarded – undo
103 103
                 if (!@file_exists($full_path) || !@is_writable($full_path)) {
104 104
                     throw new phpFastCacheDriverException('PLEASE CREATE OR CHMOD ' . $full_path . ' - 0777 OR ANY WRITABLE PERMISSION!');
105 105
                 }
106
-                $this->tmp[ $full_path_hash ] = $full_path;
107
-                $this->htaccessGen($full_path, array_key_exists('htaccess', $this->config) ? $this->config[ 'htaccess' ] : false);
106
+                $this->tmp[$full_path_hash] = $full_path;
107
+                $this->htaccessGen($full_path, array_key_exists('htaccess', $this->config) ? $this->config['htaccess'] : false);
108 108
             }
109 109
         }
110 110
         return realpath($full_path);
@@ -178,10 +178,10 @@  discard block
 block discarded – undo
178 178
      */
179 179
     public function setChmodAuto()
180 180
     {
181
-        if (!isset($this->config[ 'default_chmod' ]) || $this->config[ 'default_chmod' ] == '' || is_null($this->config[ 'default_chmod' ])) {
181
+        if (!isset($this->config['default_chmod']) || $this->config['default_chmod'] == '' || is_null($this->config['default_chmod'])) {
182 182
             return 0777;
183 183
         } else {
184
-            return $this->config[ 'default_chmod' ];
184
+            return $this->config['default_chmod'];
185 185
         }
186 186
     }
187 187
 
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
         if ($create === true) {
212 212
             if (!is_writable($path)) {
213 213
                 try {
214
-                    if(!chmod($path, 0777)){
214
+                    if (!chmod($path, 0777)) {
215 215
                         throw new phpFastCacheDriverException('Chmod failed on : ' . $path);
216 216
                     }
217 217
                 } catch (phpFastCacheDriverException $e) {
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -78,11 +78,11 @@
 block discarded – undo
78 78
                 return $full_path_tmp;
79 79
             }
80 80
             return $full_path;
81
-        }else{
81
+        } else{
82 82
             if (!isset($this->tmp[ $full_path_hash ]) || (!@file_exists($full_path) || !@is_writable($full_path))) {
83 83
                 if (!@file_exists($full_path)) {
84 84
                     @mkdir($full_path, $this->setChmodAuto(), true);
85
-                }else if (!@is_writable($full_path)) {
85
+                } else if (!@is_writable($full_path)) {
86 86
                     @chmod($full_path, $this->setChmodAuto());
87 87
                 }
88 88
                 if (!@is_writable($full_path)) {
Please login to merge, or discard this patch.