Completed
Push — v5 ( 3fd0ee...307e18 )
by Georges
02:33
created
src/phpFastCache/Core/PathSeekerTrait.php 1 patch
Spacing   +16 added lines, -16 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 != '') {
@@ -63,11 +63,11 @@  discard block
 block discarded – undo
63 63
 
64 64
         $securityKey = $this->cleanFileName($securityKey);
65 65
 
66
-        $full_path = rtrim($path, '/') .'/' . $securityKey;
66
+        $full_path = rtrim($path, '/') . '/' . $securityKey;
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->getFilesDir();
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.