@@ -83,8 +83,8 @@ |
||
83 | 83 | |
84 | 84 | $files = new RecursiveIteratorIterator |
85 | 85 | ( |
86 | - new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS), |
|
87 | - RecursiveIteratorIterator::CHILD_FIRST |
|
86 | + new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS), |
|
87 | + RecursiveIteratorIterator::CHILD_FIRST |
|
88 | 88 | ); |
89 | 89 | |
90 | 90 | foreach ($files as $fileinfo) { |
@@ -81,8 +81,7 @@ |
||
81 | 81 | return unlink($source); |
82 | 82 | } |
83 | 83 | |
84 | - $files = new RecursiveIteratorIterator |
|
85 | - ( |
|
84 | + $files = new RecursiveIteratorIterator( |
|
86 | 85 | new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS), |
87 | 86 | RecursiveIteratorIterator::CHILD_FIRST |
88 | 87 | ); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | throw new \InvalidArgumentException(sprintf('$key must be a string, got type "%s" instead.', gettype($key))); |
75 | 75 | } |
76 | 76 | |
77 | - return $this->itemInstances[ $key ]; |
|
77 | + return $this->itemInstances[$key]; |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | public function setItem(CacheItemInterface $item) |
86 | 86 | { |
87 | 87 | if ($this->getClassNamespace() . '\\Item' === get_class($item)) { |
88 | - $this->itemInstances[ $item->getKey() ] = $item; |
|
88 | + $this->itemInstances[$item->getKey()] = $item; |
|
89 | 89 | |
90 | 90 | return $this; |
91 | 91 | } else { |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | { |
103 | 103 | $collection = []; |
104 | 104 | foreach ($keys as $key) { |
105 | - $collection[ $key ] = $this->getItem($key); |
|
105 | + $collection[$key] = $this->getItem($key); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | return $collection; |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | { |
144 | 144 | if ($this->hasItem($key) && $this->driverDelete($this->getItem($key))) { |
145 | 145 | CacheManager::$WriteHits++; |
146 | - unset($this->itemInstances[ $key ]); |
|
146 | + unset($this->itemInstances[$key]); |
|
147 | 147 | |
148 | 148 | return true; |
149 | 149 | } |
@@ -177,9 +177,9 @@ discard block |
||
177 | 177 | public function save(CacheItemInterface $item) |
178 | 178 | { |
179 | 179 | if (!array_key_exists($item->getKey(), $this->itemInstances)) { |
180 | - $this->itemInstances[ $item->getKey() ] = $item; |
|
180 | + $this->itemInstances[$item->getKey()] = $item; |
|
181 | 181 | } |
182 | - if($this->driverWrite($item) && $this->driverWriteTags($item)) |
|
182 | + if ($this->driverWrite($item) && $this->driverWriteTags($item)) |
|
183 | 183 | { |
184 | 184 | CacheManager::$WriteHits++; |
185 | 185 | return true; |
@@ -195,10 +195,10 @@ discard block |
||
195 | 195 | public function saveDeferred(CacheItemInterface $item) |
196 | 196 | { |
197 | 197 | if (!array_key_exists($item->getKey(), $this->itemInstances)) { |
198 | - $this->itemInstances[ $item->getKey() ] = $item; |
|
198 | + $this->itemInstances[$item->getKey()] = $item; |
|
199 | 199 | } |
200 | 200 | |
201 | - return $this->deferredList[ $item->getKey() ] = $item; |
|
201 | + return $this->deferredList[$item->getKey()] = $item; |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | /** |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | foreach ($this->deferredList as $key => $item) { |
212 | 212 | $result = $this->save($item); |
213 | 213 | if ($return !== false) { |
214 | - unset($this->deferredList[ $key ]); |
|
214 | + unset($this->deferredList[$key]); |
|
215 | 215 | $return = $result; |
216 | 216 | } |
217 | 217 | } |
@@ -34,32 +34,32 @@ discard block |
||
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 | - if($getBasePath === true) |
|
53 | + if ($getBasePath === true) |
|
54 | 54 | { |
55 | 55 | return $path; |
56 | 56 | } |
57 | 57 | |
58 | - $securityKey = array_key_exists('securityKey', $this->config) ? $this->config[ 'securityKey' ] : ''; |
|
58 | + $securityKey = array_key_exists('securityKey', $this->config) ? $this->config['securityKey'] : ''; |
|
59 | 59 | if ($securityKey == "" || $securityKey == 'auto') { |
60 | - $securityKey = $this->config[ 'securityKey' ]; |
|
60 | + $securityKey = $this->config['securityKey']; |
|
61 | 61 | if ($securityKey == 'auto' || $securityKey == '') { |
62 | - $securityKey = isset($_SERVER[ 'HTTP_HOST' ]) ? preg_replace('/^www./', '', strtolower($_SERVER[ 'HTTP_HOST' ])) : "default"; |
|
62 | + $securityKey = isset($_SERVER['HTTP_HOST']) ? preg_replace('/^www./', '', strtolower($_SERVER['HTTP_HOST'])) : "default"; |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 | if ($securityKey != '') { |
@@ -68,11 +68,11 @@ discard block |
||
68 | 68 | |
69 | 69 | $securityKey = $this->cleanFileName($securityKey); |
70 | 70 | |
71 | - $full_path = rtrim($path, '/') .'/' . $securityKey; |
|
71 | + $full_path = rtrim($path, '/') . '/' . $securityKey; |
|
72 | 72 | $full_pathx = md5($full_path); |
73 | 73 | |
74 | 74 | |
75 | - if (!isset($this->tmp[ $full_pathx ])) { |
|
75 | + if (!isset($this->tmp[$full_pathx])) { |
|
76 | 76 | |
77 | 77 | if (!@file_exists($full_path) || !@is_writable($full_path)) { |
78 | 78 | if (!@file_exists($full_path)) { |
@@ -96,8 +96,8 @@ discard block |
||
96 | 96 | } |
97 | 97 | } |
98 | 98 | |
99 | - $this->tmp[ $full_pathx ] = true; |
|
100 | - $this->htaccessGen($full_path, array_key_exists('htaccess', $this->config) ? $this->config[ 'htaccess' ] : false); |
|
99 | + $this->tmp[$full_pathx] = true; |
|
100 | + $this->htaccessGen($full_path, array_key_exists('htaccess', $this->config) ? $this->config['htaccess'] : false); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | return realpath($full_path); |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | { |
143 | 143 | $path = $this->getFileDir(); |
144 | 144 | |
145 | - if($keyword === false) |
|
145 | + if ($keyword === false) |
|
146 | 146 | { |
147 | 147 | return $path; |
148 | 148 | } |
@@ -171,10 +171,10 @@ discard block |
||
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 |