@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | } |
142 | 142 | |
143 | 143 | /** |
144 | - * @param $keyword |
|
144 | + * @param string|false $keyword |
|
145 | 145 | * @param bool $skip |
146 | 146 | * @return string |
147 | 147 | * @throws phpFastCacheDriverException |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | |
188 | 188 | /** |
189 | 189 | * @param $filename |
190 | - * @return mixed |
|
190 | + * @return string |
|
191 | 191 | */ |
192 | 192 | protected static function cleanFileName($filename) |
193 | 193 | { |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | } |
203 | 203 | |
204 | 204 | /** |
205 | - * @param $path |
|
205 | + * @param string $path |
|
206 | 206 | * @param bool $create |
207 | 207 | * @throws \Exception |
208 | 208 | */ |
@@ -40,10 +40,10 @@ discard block |
||
40 | 40 | * Calculate the security key |
41 | 41 | */ |
42 | 42 | { |
43 | - $securityKey = array_key_exists('securityKey', $this->config) ? $this->config[ 'securityKey' ] : ''; |
|
43 | + $securityKey = array_key_exists('securityKey', $this->config) ? $this->config['securityKey'] : ''; |
|
44 | 44 | if (!$securityKey || $securityKey === 'auto') { |
45 | - if (isset($_SERVER[ 'HTTP_HOST' ])) { |
|
46 | - $securityKey = preg_replace('/^www./', '', strtolower(str_replace(':', '_', $_SERVER[ 'HTTP_HOST' ]))); |
|
45 | + if (isset($_SERVER['HTTP_HOST'])) { |
|
46 | + $securityKey = preg_replace('/^www./', '', strtolower(str_replace(':', '_', $_SERVER['HTTP_HOST']))); |
|
47 | 47 | } else { |
48 | 48 | $securityKey = ($this->isPHPModule() ? 'web' : 'cli'); |
49 | 49 | } |
@@ -58,10 +58,10 @@ discard block |
||
58 | 58 | * with the security key and the driver name |
59 | 59 | */ |
60 | 60 | $tmp_dir = rtrim($tmp_dir, '/') . DIRECTORY_SEPARATOR; |
61 | - if (empty($this->config[ 'path' ]) || !is_string($this->config[ 'path' ])) { |
|
61 | + if (empty($this->config['path']) || !is_string($this->config['path'])) { |
|
62 | 62 | $path = $tmp_dir; |
63 | 63 | } else { |
64 | - $path = rtrim($this->config[ 'path' ], '/') . DIRECTORY_SEPARATOR; |
|
64 | + $path = rtrim($this->config['path'], '/') . DIRECTORY_SEPARATOR; |
|
65 | 65 | } |
66 | 66 | $path_suffix = $securityKey . DIRECTORY_SEPARATOR . $this->getDriverName(); |
67 | 67 | $full_path = Directory::getAbsolutePath($path . $path_suffix); |
@@ -74,15 +74,15 @@ discard block |
||
74 | 74 | * return the temp dir |
75 | 75 | */ |
76 | 76 | if ($readonly === true) { |
77 | - if(!@file_exists($full_path) || !@is_writable($full_path)){ |
|
77 | + if (!@file_exists($full_path) || !@is_writable($full_path)) { |
|
78 | 78 | return $full_path_tmp; |
79 | 79 | } |
80 | 80 | return $full_path; |
81 | - }else{ |
|
82 | - if (!isset($this->tmp[ $full_path_hash ]) || (!@file_exists($full_path) || !@is_writable($full_path))) { |
|
81 | + } else { |
|
82 | + if (!isset($this->tmp[$full_path_hash]) || (!@file_exists($full_path) || !@is_writable($full_path))) { |
|
83 | 83 | if (!@file_exists($full_path)) { |
84 | 84 | @mkdir($full_path, $this->setChmodAuto(), true); |
85 | - }else if (!@is_writable($full_path)) { |
|
85 | + } else if (!@is_writable($full_path)) { |
|
86 | 86 | @chmod($full_path, $this->setChmodAuto()); |
87 | 87 | } |
88 | 88 | if (!@is_writable($full_path)) { |
@@ -103,8 +103,8 @@ discard block |
||
103 | 103 | if (!@file_exists($full_path) || !@is_writable($full_path)) { |
104 | 104 | throw new phpFastCacheDriverException('PLEASE CREATE OR CHMOD ' . $full_path . ' - 0777 OR ANY WRITABLE PERMISSION!'); |
105 | 105 | } |
106 | - $this->tmp[ $full_path_hash ] = $full_path; |
|
107 | - $this->htaccessGen($full_path, array_key_exists('htaccess', $this->config) ? $this->config[ 'htaccess' ] : false); |
|
106 | + $this->tmp[$full_path_hash] = $full_path; |
|
107 | + $this->htaccessGen($full_path, array_key_exists('htaccess', $this->config) ? $this->config['htaccess'] : false); |
|
108 | 108 | } |
109 | 109 | } |
110 | 110 | return realpath($full_path); |
@@ -178,10 +178,10 @@ discard block |
||
178 | 178 | */ |
179 | 179 | public function setChmodAuto() |
180 | 180 | { |
181 | - if (!isset($this->config[ 'default_chmod' ]) || $this->config[ 'default_chmod' ] == '' || is_null($this->config[ 'default_chmod' ])) { |
|
181 | + if (!isset($this->config['default_chmod']) || $this->config['default_chmod'] == '' || is_null($this->config['default_chmod'])) { |
|
182 | 182 | return 0777; |
183 | 183 | } else { |
184 | - return $this->config[ 'default_chmod' ]; |
|
184 | + return $this->config['default_chmod']; |
|
185 | 185 | } |
186 | 186 | } |
187 | 187 | |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | if ($create === true) { |
212 | 212 | if (!is_writable($path)) { |
213 | 213 | try { |
214 | - if(!chmod($path, 0777)){ |
|
214 | + if (!chmod($path, 0777)) { |
|
215 | 215 | throw new phpFastCacheDriverException('Chmod failed on : ' . $path); |
216 | 216 | } |
217 | 217 | } catch (phpFastCacheDriverException $e) { |
@@ -78,11 +78,11 @@ |
||
78 | 78 | return $full_path_tmp; |
79 | 79 | } |
80 | 80 | return $full_path; |
81 | - }else{ |
|
81 | + } else{ |
|
82 | 82 | if (!isset($this->tmp[ $full_path_hash ]) || (!@file_exists($full_path) || !@is_writable($full_path))) { |
83 | 83 | if (!@file_exists($full_path)) { |
84 | 84 | @mkdir($full_path, $this->setChmodAuto(), true); |
85 | - }else if (!@is_writable($full_path)) { |
|
85 | + } else if (!@is_writable($full_path)) { |
|
86 | 86 | @chmod($full_path, $this->setChmodAuto()); |
87 | 87 | } |
88 | 88 | if (!@is_writable($full_path)) { |