@@ -25,7 +25,6 @@ discard block |
||
25 | 25 | public $tmp = []; |
26 | 26 | |
27 | 27 | /** |
28 | - * @param bool $skip_create_path |
|
29 | 28 | * @param $config |
30 | 29 | * @return string |
31 | 30 | * @throws \Exception |
@@ -118,7 +117,7 @@ discard block |
||
118 | 117 | } |
119 | 118 | |
120 | 119 | /** |
121 | - * @param $keyword |
|
120 | + * @param string|false $keyword |
|
122 | 121 | * @param bool $skip |
123 | 122 | * @return string |
124 | 123 | * @throws phpFastCacheDriverException |
@@ -165,7 +164,7 @@ discard block |
||
165 | 164 | |
166 | 165 | /** |
167 | 166 | * @param $filename |
168 | - * @return mixed |
|
167 | + * @return string |
|
169 | 168 | */ |
170 | 169 | protected static function cleanFileName($filename) |
171 | 170 | { |
@@ -180,7 +179,7 @@ discard block |
||
180 | 179 | } |
181 | 180 | |
182 | 181 | /** |
183 | - * @param $path |
|
182 | + * @param string $path |
|
184 | 183 | * @param bool $create |
185 | 184 | * @throws \Exception |
186 | 185 | */ |
@@ -34,27 +34,27 @@ 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 | - $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 != '') { |
@@ -67,7 +67,7 @@ discard block |
||
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 |
||
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 |
||
127 | 127 | { |
128 | 128 | $path = $this->getPath() . '/files'; |
129 | 129 | |
130 | - if($keyword === false) |
|
130 | + if ($keyword === false) |
|
131 | 131 | { |
132 | 132 | return $path; |
133 | 133 | } |
@@ -156,10 +156,10 @@ discard block |
||
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 |
@@ -278,8 +278,8 @@ |
||
278 | 278 | } |
279 | 279 | |
280 | 280 | $stat->setData('') |
281 | - ->setSize($size) |
|
282 | - ->setInfo('Number of files used to build the cache: ' . Directory::getFileCount($path)); |
|
281 | + ->setSize($size) |
|
282 | + ->setInfo('Number of files used to build the cache: ' . Directory::getFileCount($path)); |
|
283 | 283 | |
284 | 284 | return $stat; |
285 | 285 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | /* |
73 | 73 | * Skip if Existing Caching in Options |
74 | 74 | */ |
75 | - if (isset($option[ 'skipExisting' ]) && $option[ 'skipExisting' ] == true && file_exists($file_path)) { |
|
75 | + if (isset($option['skipExisting']) && $option['skipExisting'] == true && file_exists($file_path)) { |
|
76 | 76 | $content = $this->readfile($file_path); |
77 | 77 | $old = $this->decode($content); |
78 | 78 | $toWrite = false; |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | public static function isValidOption($optionName, $optionValue) |
219 | 219 | { |
220 | 220 | parent::isValidOption($optionName, $optionValue); |
221 | - switch($optionName) |
|
221 | + switch ($optionName) |
|
222 | 222 | { |
223 | 223 | case 'path': |
224 | 224 | return is_string($optionValue); |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | |
274 | 274 | if (!is_dir($path)) { |
275 | 275 | throw new phpFastCacheDriverException("Can't read PATH:" . $path, 94); |
276 | - }else{ |
|
276 | + } else { |
|
277 | 277 | $size = Directory::dirSize($path); |
278 | 278 | } |
279 | 279 |
@@ -273,7 +273,7 @@ |
||
273 | 273 | |
274 | 274 | if (!is_dir($path)) { |
275 | 275 | throw new phpFastCacheDriverException("Can't read PATH:" . $path, 94); |
276 | - }else{ |
|
276 | + } else{ |
|
277 | 277 | $size = Directory::dirSize($path); |
278 | 278 | } |
279 | 279 |
@@ -39,11 +39,11 @@ |
||
39 | 39 | { |
40 | 40 | $count = 0; |
41 | 41 | $objects = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path), \RecursiveIteratorIterator::SELF_FIRST); |
42 | - foreach($objects as $name => $object){ |
|
42 | + foreach ($objects as $name => $object) { |
|
43 | 43 | /** |
44 | 44 | * @var \SplFileInfo $object |
45 | 45 | */ |
46 | - if($object->isFile()) |
|
46 | + if ($object->isFile()) |
|
47 | 47 | { |
48 | 48 | $count++; |
49 | 49 | } |