Completed
Push — final ( 80545f...284938 )
by Georges
04:16
created
src/phpFastCache/Core/phpFastCache.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
         if (empty($config)) {
106 106
             $config = phpFastCache::$config;
107 107
         }
108
-        $config[ 'storage' ] = $storage;
108
+        $config['storage'] = $storage;
109 109
 
110 110
         $storage = strtolower($storage);
111 111
         if ($storage == '' || $storage == 'auto') {
@@ -158,31 +158,31 @@  discard block
 block discarded – undo
158 158
     {
159 159
         $tmp_dir = rtrim(ini_get('upload_tmp_dir') ? ini_get('upload_tmp_dir') : sys_get_temp_dir(), '\\/') . DIRECTORY_SEPARATOR . 'phpfastcache';
160 160
 
161
-        if (!isset($config[ 'path' ]) || $config[ 'path' ] == '') {
161
+        if (!isset($config['path']) || $config['path'] == '') {
162 162
             if (self::isPHPModule()) {
163 163
                 $path = $tmp_dir;
164 164
             } else {
165
-                $document_root_path = rtrim($_SERVER[ 'DOCUMENT_ROOT' ], '/') . '/../';
166
-                $path = isset($_SERVER[ 'DOCUMENT_ROOT' ]) && is_writable($document_root_path)
165
+                $document_root_path = rtrim($_SERVER['DOCUMENT_ROOT'], '/') . '/../';
166
+                $path = isset($_SERVER['DOCUMENT_ROOT']) && is_writable($document_root_path)
167 167
                     ? $document_root_path
168 168
                     : rtrim(__DIR__, '/') . '/';
169 169
             }
170 170
 
171
-            if (self::$config[ 'path' ] != '') {
172
-                $path = $config[ 'path' ];
171
+            if (self::$config['path'] != '') {
172
+                $path = $config['path'];
173 173
             }
174 174
 
175 175
         } else {
176
-            $path = $config[ 'path' ];
176
+            $path = $config['path'];
177 177
         }
178 178
 
179 179
         $securityKey = array_key_exists('securityKey',
180
-          $config) ? $config[ 'securityKey' ] : '';
180
+          $config) ? $config['securityKey'] : '';
181 181
         if ($securityKey == "" || $securityKey == 'auto') {
182
-            $securityKey = self::$config[ 'securityKey' ];
182
+            $securityKey = self::$config['securityKey'];
183 183
             if ($securityKey == 'auto' || $securityKey == '') {
184
-                $securityKey = isset($_SERVER[ 'HTTP_HOST' ]) ? preg_replace('/^www./',
185
-                  '', strtolower(str_replace(':', '_', $_SERVER[ 'HTTP_HOST' ]))) : "default";
184
+                $securityKey = isset($_SERVER['HTTP_HOST']) ? preg_replace('/^www./',
185
+                  '', strtolower(str_replace(':', '_', $_SERVER['HTTP_HOST']))) : "default";
186 186
             }
187 187
         }
188 188
         if ($securityKey != '') {
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
         $full_pathx = md5($full_path);
196 196
 
197 197
 
198
-        if ($skip_create_path == false && !isset(self::$tmp[ $full_pathx ])) {
198
+        if ($skip_create_path == false && !isset(self::$tmp[$full_pathx])) {
199 199
 
200 200
             if (!@file_exists($full_path) || !@is_writable($full_path)) {
201 201
                 if (!@file_exists($full_path)) {
@@ -204,9 +204,9 @@  discard block
 block discarded – undo
204 204
                 if (!@is_writable($full_path)) {
205 205
                     @chmod($full_path, self::__setChmodAuto($config));
206 206
                 }
207
-                if(!@is_writable($full_path)) {
207
+                if (!@is_writable($full_path)) {
208 208
                     // switch back to tmp dir again if the path is not writeable
209
-                    $full_path = rtrim($tmp_dir,'/') . '/' . $securityKey;
209
+                    $full_path = rtrim($tmp_dir, '/') . '/' . $securityKey;
210 210
                     if (!@file_exists($full_path)) {
211 211
                         @mkdir($full_path, self::__setChmodAuto($config), true);
212 212
                     }
@@ -219,8 +219,8 @@  discard block
 block discarded – undo
219 219
                 }
220 220
             }
221 221
 
222
-            self::$tmp[ $full_pathx ] = true;
223
-            self::htaccessGen($full_path, array_key_exists('htaccess', $config) ? $config[ 'htaccess' ] : false);
222
+            self::$tmp[$full_pathx] = true;
223
+            self::htaccessGen($full_path, array_key_exists('htaccess', $config) ? $config['htaccess'] : false);
224 224
         }
225 225
 
226 226
         return realpath($full_path);
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
           '/^\./',
240 240
         );
241 241
         $replace = array('-', '', '');
242
-        return trim(preg_replace($regex, $replace, trim($filename)),'-');
242
+        return trim(preg_replace($regex, $replace, trim($filename)), '-');
243 243
     }
244 244
 
245 245
     /**
@@ -248,10 +248,10 @@  discard block
 block discarded – undo
248 248
      */
249 249
     public static function __setChmodAuto($config)
250 250
     {
251
-        if (!isset($config[ 'default_chmod' ]) || $config[ 'default_chmod' ] == '' || is_null($config[ 'default_chmod' ])) {
251
+        if (!isset($config['default_chmod']) || $config['default_chmod'] == '' || is_null($config['default_chmod'])) {
252 252
             return 0777;
253 253
         } else {
254
-            return $config[ 'default_chmod' ];
254
+            return $config['default_chmod'];
255 255
         }
256 256
     }
257 257
 
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
                 }
303 303
             }
304 304
 
305
-            if(!file_exists($path."/.htaccess")) {
305
+            if (!file_exists($path . "/.htaccess")) {
306 306
                 //   echo "write me";
307 307
                 $html = "order deny, allow \r\n
308 308
 deny from all \r\n
@@ -328,9 +328,9 @@  discard block
 block discarded – undo
328 328
     public static function setup($name, $value = '')
329 329
     {
330 330
         if (is_array($name)) {
331
-            self::$config = array_merge(self::$config,$name);
331
+            self::$config = array_merge(self::$config, $name);
332 332
         } else {
333
-            self::$config[ $name ] = $value;
333
+            self::$config[$name] = $value;
334 334
         }
335 335
     }
336 336
 
Please login to merge, or discard this patch.