Completed
Push — v5 ( 35207f...a234cb )
by Georges
02:44
created
src/phpFastCache/Core/PathSeekerTrait.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -34,30 +34,30 @@  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 53
         if ($getBasePath === true) {
54 54
             return $path;
55 55
         }
56 56
 
57
-        $securityKey = array_key_exists('securityKey', $this->config) ? $this->config[ 'securityKey' ] : '';
57
+        $securityKey = array_key_exists('securityKey', $this->config) ? $this->config['securityKey'] : '';
58 58
         if (!$securityKey || $securityKey === 'auto') {
59
-            if (isset($_SERVER[ 'HTTP_HOST' ])) {
60
-                $securityKey = preg_replace('/^www./', '', strtolower(str_replace(':', '_', $_SERVER[ 'HTTP_HOST' ])));
59
+            if (isset($_SERVER['HTTP_HOST'])) {
60
+                $securityKey = preg_replace('/^www./', '', strtolower(str_replace(':', '_', $_SERVER['HTTP_HOST'])));
61 61
             } else {
62 62
                 $securityKey = ($this->isPHPModule() ? 'web' : 'cli');
63 63
             }
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
         $full_pathx = md5($full_path);
74 74
 
75 75
 
76
-        if (!isset($this->tmp[ $full_pathx ])) {
76
+        if (!isset($this->tmp[$full_pathx])) {
77 77
 
78 78
             if (!@file_exists($full_path) || !@is_writable($full_path)) {
79 79
                 if (!@file_exists($full_path)) {
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
                 }
98 98
             }
99 99
 
100
-            $this->tmp[ $full_pathx ] = true;
101
-            $this->htaccessGen($full_path, array_key_exists('htaccess', $this->config) ? $this->config[ 'htaccess' ] : false);
100
+            $this->tmp[$full_pathx] = true;
101
+            $this->htaccessGen($full_path, array_key_exists('htaccess', $this->config) ? $this->config['htaccess'] : false);
102 102
         }
103 103
 
104 104
         return realpath($full_path);
@@ -171,10 +171,10 @@  discard block
 block discarded – undo
171 171
      */
172 172
     public function setChmodAuto()
173 173
     {
174
-        if (!isset($this->config[ 'default_chmod' ]) || $this->config[ 'default_chmod' ] == '' || is_null($this->config[ 'default_chmod' ])) {
174
+        if (!isset($this->config['default_chmod']) || $this->config['default_chmod'] == '' || is_null($this->config['default_chmod'])) {
175 175
             return 0777;
176 176
         } else {
177
-            return $this->config[ 'default_chmod' ];
177
+            return $this->config['default_chmod'];
178 178
         }
179 179
     }
180 180
 
Please login to merge, or discard this patch.