Completed
Pull Request — final (#584)
by Georges
02:36
created
src/phpFastCache/Core/Pool/IO/IOHelperTrait.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -51,10 +51,10 @@  discard block
 block discarded – undo
51 51
          * Calculate the security key
52 52
          */
53 53
         {
54
-            $securityKey = array_key_exists('securityKey', $this->config) ? $this->config[ 'securityKey' ] : '';
54
+            $securityKey = array_key_exists('securityKey', $this->config) ? $this->config['securityKey'] : '';
55 55
             if (!$securityKey || mb_strtolower($securityKey) === 'auto') {
56
-                if (isset($_SERVER[ 'HTTP_HOST' ])) {
57
-                    $securityKey = preg_replace('/^www./', '', strtolower(str_replace(':', '_', $_SERVER[ 'HTTP_HOST' ])));
56
+                if (isset($_SERVER['HTTP_HOST'])) {
57
+                    $securityKey = preg_replace('/^www./', '', strtolower(str_replace(':', '_', $_SERVER['HTTP_HOST'])));
58 58
                 } else {
59 59
                     $securityKey = ($this->isPHPModule() ? 'web' : 'cli');
60 60
                 }
@@ -73,10 +73,10 @@  discard block
 block discarded – undo
73 73
          */
74 74
         $tmp_dir = rtrim($tmp_dir, '/') . DIRECTORY_SEPARATOR;
75 75
 
76
-        if (empty($this->config[ 'path' ]) || !is_string($this->config[ 'path' ])) {
76
+        if (empty($this->config['path']) || !is_string($this->config['path'])) {
77 77
             $path = $tmp_dir;
78 78
         } else {
79
-            $path = rtrim($this->config[ 'path' ], '/') . DIRECTORY_SEPARATOR;
79
+            $path = rtrim($this->config['path'], '/') . DIRECTORY_SEPARATOR;
80 80
         }
81 81
 
82 82
         $path_suffix = $securityKey . DIRECTORY_SEPARATOR . $this->getDriverName();
@@ -91,16 +91,16 @@  discard block
 block discarded – undo
91 91
          * return the temp dir
92 92
          */
93 93
         if ($readonly === true) {
94
-            if ($this->config[ 'autoTmpFallback' ] && (!@file_exists($full_path) || !@is_writable($full_path))) {
94
+            if ($this->config['autoTmpFallback'] && (!@file_exists($full_path) || !@is_writable($full_path))) {
95 95
                 return $full_path_tmp;
96 96
             }
97 97
             return $full_path;
98 98
         } else {
99
-            if (!isset($this->tmp[ $full_path_hash ]) || (!@file_exists($full_path) || !@is_writable($full_path))) {
99
+            if (!isset($this->tmp[$full_path_hash]) || (!@file_exists($full_path) || !@is_writable($full_path))) {
100 100
                 if (!@file_exists($full_path)) {
101 101
                     @mkdir($full_path, $this->getDefaultChmod(), true);
102 102
                 } else if (!@is_writable($full_path)) {
103
-                    if (!@chmod($full_path, $this->getDefaultChmod()) && $this->config[ 'autoTmpFallback' ]) {
103
+                    if (!@chmod($full_path, $this->getDefaultChmod()) && $this->config['autoTmpFallback']) {
104 104
                         /**
105 105
                          * Switch back to tmp dir
106 106
                          * again if the path is not writable
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
                     throw new phpFastCacheIOException('Path "' . $full_path . '" is not writable, please set a chmod 0777 or any writable permission and make sure to make use of an absolute path !');
122 122
                 }
123 123
 
124
-                $this->tmp[ $full_path_hash ] = $full_path;
125
-                $this->htaccessGen($full_path, array_key_exists('htaccess', $this->config) ? $this->config[ 'htaccess' ] : false);
124
+                $this->tmp[$full_path_hash] = $full_path;
125
+                $this->htaccessGen($full_path, array_key_exists('htaccess', $this->config) ? $this->config['htaccess'] : false);
126 126
             }
127 127
         }
128 128
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
             }
160 160
         }
161 161
 
162
-        return $path . '/' . $filename . '.' . $this->config[ 'cacheFileExtension' ];
162
+        return $path . '/' . $filename . '.' . $this->config['cacheFileExtension'];
163 163
     }
164 164
 
165 165
 
@@ -177,10 +177,10 @@  discard block
 block discarded – undo
177 177
      */
178 178
     protected function getDefaultChmod()
179 179
     {
180
-        if (!isset($this->config[ 'default_chmod' ]) || $this->config[ 'default_chmod' ] == '' || is_null($this->config[ 'default_chmod' ])) {
180
+        if (!isset($this->config['default_chmod']) || $this->config['default_chmod'] == '' || is_null($this->config['default_chmod'])) {
181 181
             return 0777;
182 182
         } else {
183
-            return $this->config[ 'default_chmod' ];
183
+            return $this->config['default_chmod'];
184 184
         }
185 185
     }
186 186
 
Please login to merge, or discard this patch.