@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | // +---------------------------------------------------------------------- |
9 | 9 | // | Author: liu21st <[email protected]> |
10 | 10 | // +---------------------------------------------------------------------- |
11 | -declare (strict_types = 1); |
|
11 | +declare(strict_types=1); |
|
12 | 12 | |
13 | 13 | namespace think\route; |
14 | 14 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | } |
110 | 110 | |
111 | 111 | if ($this->parent && $this->parent->getFullName()) { |
112 | - $this->fullName = $this->parent->getFullName() . ($this->name ? '/' . $this->name : ''); |
|
112 | + $this->fullName = $this->parent->getFullName().($this->name ? '/'.$this->name : ''); |
|
113 | 113 | } else { |
114 | 114 | $this->fullName = $this->name; |
115 | 115 | } |
@@ -304,13 +304,13 @@ discard block |
||
304 | 304 | protected function checkMergeRuleRegex(Request $request, array &$rules, string $url, bool $completeMatch) |
305 | 305 | { |
306 | 306 | $depr = $this->router->config('pathinfo_depr'); |
307 | - $url = $depr . str_replace('|', $depr, $url); |
|
307 | + $url = $depr.str_replace('|', $depr, $url); |
|
308 | 308 | $regex = []; |
309 | 309 | $items = []; |
310 | 310 | |
311 | 311 | foreach ($rules as $key => $item) { |
312 | 312 | if ($item instanceof RuleItem) { |
313 | - $rule = $depr . str_replace('/', $depr, $item->getRule()); |
|
313 | + $rule = $depr.str_replace('/', $depr, $item->getRule()); |
|
314 | 314 | if ($depr == $rule && $depr != $url) { |
315 | 315 | unset($rules[$key]); |
316 | 316 | continue; |
@@ -327,21 +327,21 @@ discard block |
||
327 | 327 | continue; |
328 | 328 | } |
329 | 329 | |
330 | - $slash = preg_quote('/-' . $depr, '/'); |
|
330 | + $slash = preg_quote('/-'.$depr, '/'); |
|
331 | 331 | |
332 | - if ($matchRule = preg_split('/[' . $slash . ']<\w+\??>/', $rule, 2)) { |
|
332 | + if ($matchRule = preg_split('/['.$slash.']<\w+\??>/', $rule, 2)) { |
|
333 | 333 | if ($matchRule[0] && 0 !== strncasecmp($rule, $url, strlen($matchRule[0]))) { |
334 | 334 | unset($rules[$key]); |
335 | 335 | continue; |
336 | 336 | } |
337 | 337 | } |
338 | 338 | |
339 | - if (preg_match_all('/[' . $slash . ']?<?\w+\??>?/', $rule, $matches)) { |
|
339 | + if (preg_match_all('/['.$slash.']?<?\w+\??>?/', $rule, $matches)) { |
|
340 | 340 | unset($rules[$key]); |
341 | 341 | $pattern = array_merge($this->getPattern(), $item->getPattern()); |
342 | 342 | $option = array_merge($this->getOption(), $item->getOption()); |
343 | 343 | |
344 | - $regex[$key] = $this->buildRuleRegex($rule, $matches[0], $pattern, $option, $complete, '_THINK_' . $key); |
|
344 | + $regex[$key] = $this->buildRuleRegex($rule, $matches[0], $pattern, $option, $complete, '_THINK_'.$key); |
|
345 | 345 | $items[$key] = $item; |
346 | 346 | } |
347 | 347 | } |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | } |
353 | 353 | |
354 | 354 | try { |
355 | - $result = preg_match('/^(?:' . implode('|', $regex) . ')/u', $url, $match); |
|
355 | + $result = preg_match('/^(?:'.implode('|', $regex).')/u', $url, $match); |
|
356 | 356 | } catch (\Exception $e) { |
357 | 357 | throw new Exception('route pattern error'); |
358 | 358 | } |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | |
370 | 370 | if (!isset($pos)) { |
371 | 371 | foreach ($regex as $key => $item) { |
372 | - if (0 === strpos(str_replace(['\/', '\-', '\\' . $depr], ['/', '-', $depr], $item), $match[0])) { |
|
372 | + if (0 === strpos(str_replace(['\/', '\-', '\\'.$depr], ['/', '-', $depr], $item), $match[0])) { |
|
373 | 373 | $pos = $key; |
374 | 374 | break; |
375 | 375 | } |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | * @access public |
399 | 399 | * @return RuleItem|null |
400 | 400 | */ |
401 | - public function getMissRule(): ? RuleItem |
|
401 | + public function getMissRule(): ? RuleItem |
|
402 | 402 | { |
403 | 403 | return $this->miss; |
404 | 404 | } |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | public function prefix(string $prefix) |
485 | 485 | { |
486 | 486 | if ($this->parent && $this->parent->getOption('prefix')) { |
487 | - $prefix = $this->parent->getOption('prefix') . $prefix; |
|
487 | + $prefix = $this->parent->getOption('prefix').$prefix; |
|
488 | 488 | } |
489 | 489 | |
490 | 490 | return $this->setOption('prefix', $prefix); |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | // +---------------------------------------------------------------------- |
9 | 9 | // | Author: liu21st <[email protected]> |
10 | 10 | // +---------------------------------------------------------------------- |
11 | -declare (strict_types = 1); |
|
11 | +declare(strict_types=1); |
|
12 | 12 | |
13 | 13 | namespace think\route; |
14 | 14 | |
@@ -109,10 +109,10 @@ discard block |
||
109 | 109 | $item = []; |
110 | 110 | |
111 | 111 | foreach ($array as $val) { |
112 | - $item[] = $val . '/<' . ($option['var'][$val] ?? $val . '_id') . '>'; |
|
112 | + $item[] = $val.'/<'.($option['var'][$val] ?? $val.'_id').'>'; |
|
113 | 113 | } |
114 | 114 | |
115 | - $rule = implode('/', $item) . '/' . $last; |
|
115 | + $rule = implode('/', $item).'/'.$last; |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | $prefix = substr($rule, strlen($this->name) + 1); |
@@ -125,12 +125,12 @@ discard block |
||
125 | 125 | } |
126 | 126 | |
127 | 127 | if (isset($last) && strpos($val[1], '<id>') && isset($option['var'][$last])) { |
128 | - $val[1] = str_replace('<id>', '<' . $option['var'][$last] . '>', $val[1]); |
|
128 | + $val[1] = str_replace('<id>', '<'.$option['var'][$last].'>', $val[1]); |
|
129 | 129 | } elseif (strpos($val[1], '<id>') && isset($option['var'][$rule])) { |
130 | - $val[1] = str_replace('<id>', '<' . $option['var'][$rule] . '>', $val[1]); |
|
130 | + $val[1] = str_replace('<id>', '<'.$option['var'][$rule].'>', $val[1]); |
|
131 | 131 | } |
132 | 132 | |
133 | - $ruleItem = $this->addRule(trim($prefix . $val[1], '/'), $this->route . '/' . $val[2], $val[0]); |
|
133 | + $ruleItem = $this->addRule(trim($prefix.$val[1], '/'), $this->route.'/'.$val[2], $val[0]); |
|
134 | 134 | |
135 | 135 | foreach (['model', 'validate', 'middleware'] as $name) { |
136 | 136 | if (isset($this->$name[$key])) { |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | // +---------------------------------------------------------------------- |
9 | 9 | // | Author: liu21st <[email protected]> |
10 | 10 | // +---------------------------------------------------------------------- |
11 | -declare (strict_types = 1); |
|
11 | +declare(strict_types=1); |
|
12 | 12 | |
13 | 13 | namespace think; |
14 | 14 | |
@@ -310,12 +310,12 @@ discard block |
||
310 | 310 | $query = $this->queryInstance; |
311 | 311 | } else { |
312 | 312 | $query = $this->db->connect($this->connection) |
313 | - ->name($this->name . $this->suffix) |
|
313 | + ->name($this->name.$this->suffix) |
|
314 | 314 | ->pk($this->pk); |
315 | 315 | } |
316 | 316 | |
317 | 317 | if (!empty($this->table)) { |
318 | - $query->table($this->table . $this->suffix); |
|
318 | + $query->table($this->table.$this->suffix); |
|
319 | 319 | } |
320 | 320 | |
321 | 321 | $query->model($this) |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | $this->field = array_keys(array_merge($this->schema, $this->jsonType)); |
516 | 516 | } else { |
517 | 517 | $query = $this->db(); |
518 | - $table = $this->table ? $this->table . $this->suffix : $query->getTable(); |
|
518 | + $table = $this->table ? $this->table.$this->suffix : $query->getTable(); |
|
519 | 519 | |
520 | 520 | $this->field = $query->getConnection()->getTableFields($table); |
521 | 521 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | // +---------------------------------------------------------------------- |
9 | 9 | // | Author: liu21st <[email protected]> |
10 | 10 | // +---------------------------------------------------------------------- |
11 | -declare (strict_types = 1); |
|
11 | +declare(strict_types=1); |
|
12 | 12 | |
13 | 13 | namespace think\db\concern; |
14 | 14 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $op = is_array($range) ? 'between' : '>='; |
65 | 65 | } |
66 | 66 | |
67 | - return $this->parseWhereExp($logic, $field, strtolower($op) . ' time', $range, [], true); |
|
67 | + return $this->parseWhereExp($logic, $field, strtolower($op).' time', $range, [], true); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | public function whereTimeInterval(string $field, string $start, string $interval = 'day', int $step = 1, string $logic = 'AND') |
81 | 81 | { |
82 | 82 | $startTime = strtotime($start); |
83 | - $endTime = strtotime(($step > 0 ? '+' : '-') . abs($step) . ' ' . $interval . (abs($step) > 1 ? 's' : ''), $startTime); |
|
83 | + $endTime = strtotime(($step > 0 ? '+' : '-').abs($step).' '.$interval.(abs($step) > 1 ? 's' : ''), $startTime); |
|
84 | 84 | |
85 | 85 | return $this->whereTime($field, 'between', $step > 0 ? [$startTime, $endTime] : [$endTime, $startTime], $logic); |
86 | 86 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | $year = date('Y', strtotime($year)); |
137 | 137 | } |
138 | 138 | |
139 | - return $this->whereTimeInterval($field, $year . '-1-1', 'year', $step, $logic); |
|
139 | + return $this->whereTimeInterval($field, $year.'-1-1', 'year', $step, $logic); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | // +---------------------------------------------------------------------- |
9 | 9 | // | Author: liu21st <[email protected]> |
10 | 10 | // +---------------------------------------------------------------------- |
11 | -declare (strict_types = 1); |
|
11 | +declare(strict_types=1); |
|
12 | 12 | |
13 | 13 | namespace think\model\concern; |
14 | 14 | |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | return $this->relation[$name]; |
283 | 283 | } |
284 | 284 | |
285 | - throw new InvalidArgumentException('property not exists:' . static::class . '->' . $name); |
|
285 | + throw new InvalidArgumentException('property not exists:'.static::class.'->'.$name); |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | /** |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | */ |
293 | 293 | public function getChangedData(): array |
294 | 294 | { |
295 | - $data = $this->force ? $this->data : array_udiff_assoc($this->data, $this->origin, function ($a, $b) { |
|
295 | + $data = $this->force ? $this->data : array_udiff_assoc($this->data, $this->origin, function($a, $b) { |
|
296 | 296 | if ((empty($a) || empty($b)) && $a !== $b) { |
297 | 297 | return 1; |
298 | 298 | } |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | $value = $this->autoWriteTimestamp(); |
360 | 360 | } else { |
361 | 361 | // 检测修改器 |
362 | - $method = 'set' . App::parseName($name, 1) . 'Attr'; |
|
362 | + $method = 'set'.App::parseName($name, 1).'Attr'; |
|
363 | 363 | |
364 | 364 | if (method_exists($this, $method)) { |
365 | 365 | $array = $this->data; |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | { |
483 | 483 | // 检测属性获取器 |
484 | 484 | $fieldName = $this->getRealFieldName($name); |
485 | - $method = 'get' . App::parseName($name, 1) . 'Attr'; |
|
485 | + $method = 'get'.App::parseName($name, 1).'Attr'; |
|
486 | 486 | |
487 | 487 | if (isset($this->withAttr[$fieldName])) { |
488 | 488 | if ($relation) { |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | // +---------------------------------------------------------------------- |
9 | 9 | // | Author: liu21st <[email protected]> |
10 | 10 | // +---------------------------------------------------------------------- |
11 | -declare (strict_types = 1); |
|
11 | +declare(strict_types=1); |
|
12 | 12 | |
13 | 13 | namespace think; |
14 | 14 | |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | } |
131 | 131 | |
132 | 132 | if (!isset($this->config['channels'][$name])) { |
133 | - throw new InvalidArgumentException('Undefined log config:' . $name); |
|
133 | + throw new InvalidArgumentException('Undefined log config:'.$name); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | $config = $this->config['channels'][$name]; |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | if (is_string($msg) && !empty($context)) { |
197 | 197 | $replace = []; |
198 | 198 | foreach ($context as $key => $val) { |
199 | - $replace['{' . $key . '}'] = $val; |
|
199 | + $replace['{'.$key.'}'] = $val; |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | $msg = strtr($msg, $replace); |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | // +---------------------------------------------------------------------- |
9 | 9 | // | Author: liu21st <[email protected]> |
10 | 10 | // +---------------------------------------------------------------------- |
11 | -declare (strict_types = 1); |
|
11 | +declare(strict_types=1); |
|
12 | 12 | |
13 | 13 | namespace think; |
14 | 14 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | public function __construct(App $app) |
57 | 57 | { |
58 | 58 | $this->app = $app; |
59 | - $this->multi = is_dir($this->app->getBasePath() . 'controller') ? false : true; |
|
59 | + $this->multi = is_dir($this->app->getBasePath().'controller') ? false : true; |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -172,8 +172,8 @@ discard block |
||
172 | 172 | $this->initialize(); |
173 | 173 | |
174 | 174 | // 加载全局中间件 |
175 | - if (is_file($this->app->getBasePath() . 'middleware.php')) { |
|
176 | - $this->app->middleware->import(include $this->app->getBasePath() . 'middleware.php'); |
|
175 | + if (is_file($this->app->getBasePath().'middleware.php')) { |
|
176 | + $this->app->middleware->import(include $this->app->getBasePath().'middleware.php'); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | if ($this->multi) { |
@@ -186,9 +186,9 @@ discard block |
||
186 | 186 | // 监听HttpRun |
187 | 187 | $this->app->event->trigger('HttpRun'); |
188 | 188 | |
189 | - $this->app->log->info($request->ip() . ' ' . $request->method() . ' ' . $request->host() . $request->url()); |
|
189 | + $this->app->log->info($request->ip().' '.$request->method().' '.$request->host().$request->url()); |
|
190 | 190 | |
191 | - $withRoute = $this->app->config->get('app.with_route', true) ? function () { |
|
191 | + $withRoute = $this->app->config->get('app.with_route', true) ? function() { |
|
192 | 192 | $this->loadRoutes(); |
193 | 193 | } : null; |
194 | 194 | |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | { |
205 | 205 | // 加载路由定义 |
206 | 206 | if (is_dir($this->getRoutePath())) { |
207 | - $files = glob($this->getRoutePath() . '*.php'); |
|
207 | + $files = glob($this->getRoutePath().'*.php'); |
|
208 | 208 | foreach ($files as $file) { |
209 | 209 | include $file; |
210 | 210 | } |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | */ |
221 | 221 | protected function getRoutePath(): string |
222 | 222 | { |
223 | - return $this->app->getRootPath() . 'route' . DIRECTORY_SEPARATOR . ($this->isMulti() ? $this->getName() . DIRECTORY_SEPARATOR : ''); |
|
223 | + return $this->app->getRootPath().'route'.DIRECTORY_SEPARATOR.($this->isMulti() ? $this->getName().DIRECTORY_SEPARATOR : ''); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | /** |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | $appName = $map[$name]; |
306 | 306 | } |
307 | 307 | } elseif ($name && (false !== array_search($name, $map) || in_array($name, $deny))) { |
308 | - throw new HttpException(404, 'app not exists:' . $name); |
|
308 | + throw new HttpException(404, 'app not exists:'.$name); |
|
309 | 309 | } elseif ($name && isset($map['*'])) { |
310 | 310 | $appName = $map['*']; |
311 | 311 | } else { |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | } |
314 | 314 | |
315 | 315 | if ($name) { |
316 | - $this->app->request->setRoot('/' . $name); |
|
316 | + $this->app->request->setRoot('/'.$name); |
|
317 | 317 | $this->app->request->setPathinfo(strpos($path, '/') ? ltrim(strstr($path, '/'), '/') : ''); |
318 | 318 | } |
319 | 319 | } |
@@ -333,41 +333,41 @@ discard block |
||
333 | 333 | { |
334 | 334 | $this->name = $appName; |
335 | 335 | $this->app->request->setApp($appName); |
336 | - $this->app->setAppPath($this->path ?: $this->app->getBasePath() . $appName . DIRECTORY_SEPARATOR); |
|
337 | - $this->app->setRuntimePath($this->app->getRootPath() . 'runtime' . DIRECTORY_SEPARATOR . $appName . DIRECTORY_SEPARATOR); |
|
336 | + $this->app->setAppPath($this->path ?: $this->app->getBasePath().$appName.DIRECTORY_SEPARATOR); |
|
337 | + $this->app->setRuntimePath($this->app->getRootPath().'runtime'.DIRECTORY_SEPARATOR.$appName.DIRECTORY_SEPARATOR); |
|
338 | 338 | |
339 | 339 | //加载app文件 |
340 | 340 | if (is_dir($this->app->getAppPath())) { |
341 | 341 | $appPath = $this->app->getAppPath(); |
342 | 342 | |
343 | - if (is_file($appPath . 'common.php')) { |
|
344 | - include_once $appPath . 'common.php'; |
|
343 | + if (is_file($appPath.'common.php')) { |
|
344 | + include_once $appPath.'common.php'; |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | $configPath = $this->app->getConfigPath(); |
348 | 348 | |
349 | 349 | $files = []; |
350 | 350 | |
351 | - if (is_dir($configPath . $appName)) { |
|
352 | - $files = array_merge($files, glob($configPath . $appName . DIRECTORY_SEPARATOR . '*' . $this->app->getConfigExt())); |
|
353 | - } elseif (is_dir($appPath . 'config')) { |
|
354 | - $files = array_merge($files, glob($appPath . 'config' . DIRECTORY_SEPARATOR . '*' . $this->app->getConfigExt())); |
|
351 | + if (is_dir($configPath.$appName)) { |
|
352 | + $files = array_merge($files, glob($configPath.$appName.DIRECTORY_SEPARATOR.'*'.$this->app->getConfigExt())); |
|
353 | + } elseif (is_dir($appPath.'config')) { |
|
354 | + $files = array_merge($files, glob($appPath.'config'.DIRECTORY_SEPARATOR.'*'.$this->app->getConfigExt())); |
|
355 | 355 | } |
356 | 356 | |
357 | 357 | foreach ($files as $file) { |
358 | 358 | $this->app->config->load($file, pathinfo($file, PATHINFO_FILENAME)); |
359 | 359 | } |
360 | 360 | |
361 | - if (is_file($appPath . 'event.php')) { |
|
362 | - $this->app->loadEvent(include $appPath . 'event.php'); |
|
361 | + if (is_file($appPath.'event.php')) { |
|
362 | + $this->app->loadEvent(include $appPath.'event.php'); |
|
363 | 363 | } |
364 | 364 | |
365 | - if (is_file($appPath . 'middleware.php')) { |
|
366 | - $this->app->middleware->import(include $appPath . 'middleware.php'); |
|
365 | + if (is_file($appPath.'middleware.php')) { |
|
366 | + $this->app->middleware->import(include $appPath.'middleware.php'); |
|
367 | 367 | } |
368 | 368 | |
369 | - if (is_file($appPath . 'provider.php')) { |
|
370 | - $this->app->bind(include $appPath . 'provider.php'); |
|
369 | + if (is_file($appPath.'provider.php')) { |
|
370 | + $this->app->bind(include $appPath.'provider.php'); |
|
371 | 371 | } |
372 | 372 | } |
373 | 373 | |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | $this->app->loadLangPack($this->app->lang->defaultLangSet()); |
376 | 376 | |
377 | 377 | // 设置应用命名空间 |
378 | - $this->app->setNamespace($this->app->config->get('app.app_namespace') ?: 'app\\' . $appName); |
|
378 | + $this->app->setNamespace($this->app->config->get('app.app_namespace') ?: 'app\\'.$appName); |
|
379 | 379 | } |
380 | 380 | |
381 | 381 | /** |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | // +---------------------------------------------------------------------- |
9 | 9 | // | Author: liu21st <[email protected]> |
10 | 10 | // +---------------------------------------------------------------------- |
11 | -declare (strict_types = 1); |
|
11 | +declare(strict_types=1); |
|
12 | 12 | |
13 | 13 | namespace think\log\driver; |
14 | 14 | |
@@ -86,8 +86,7 @@ discard block |
||
86 | 86 | } |
87 | 87 | |
88 | 88 | $message[] = $this->config['json'] ? |
89 | - json_encode(['time' => $time, 'type' => $type, 'msg' => $msg], $this->config['json_options']) : |
|
90 | - sprintf($this->config['format'], $time, $type, $msg); |
|
89 | + json_encode(['time' => $time, 'type' => $type, 'msg' => $msg], $this->config['json_options']) : sprintf($this->config['format'], $time, $type, $msg); |
|
91 | 90 | } |
92 | 91 | |
93 | 92 | if (true === $this->config['apart_level'] || in_array($type, $this->config['apart_level'])) { |
@@ -125,7 +124,7 @@ discard block |
||
125 | 124 | $info[$type] = is_array($msg) ? implode(PHP_EOL, $msg) : $msg; |
126 | 125 | } |
127 | 126 | |
128 | - $message = implode(PHP_EOL, $info) . PHP_EOL; |
|
127 | + $message = implode(PHP_EOL, $info).PHP_EOL; |
|
129 | 128 | |
130 | 129 | return error_log($message, 3, $destination); |
131 | 130 | } |
@@ -138,13 +137,13 @@ discard block |
||
138 | 137 | protected function getMasterLogFile(): string |
139 | 138 | { |
140 | 139 | if (empty($this->config['path'])) { |
141 | - $this->config['path'] = $this->app->getRuntimePath() . 'log' . DIRECTORY_SEPARATOR; |
|
140 | + $this->config['path'] = $this->app->getRuntimePath().'log'.DIRECTORY_SEPARATOR; |
|
142 | 141 | } elseif (substr($this->config['path'], -1) != DIRECTORY_SEPARATOR) { |
143 | 142 | $this->config['path'] .= DIRECTORY_SEPARATOR; |
144 | 143 | } |
145 | 144 | |
146 | 145 | if ($this->config['max_files']) { |
147 | - $files = glob($this->config['path'] . '*.log'); |
|
146 | + $files = glob($this->config['path'].'*.log'); |
|
148 | 147 | |
149 | 148 | try { |
150 | 149 | if (count($files) > $this->config['max_files']) { |
@@ -158,17 +157,17 @@ discard block |
||
158 | 157 | if ($this->config['single']) { |
159 | 158 | $name = is_string($this->config['single']) ? $this->config['single'] : 'single'; |
160 | 159 | $cli = $this->isCli ? '_cli' : ''; |
161 | - $destination = $this->config['path'] . $name . $cli . '.log'; |
|
160 | + $destination = $this->config['path'].$name.$cli.'.log'; |
|
162 | 161 | } else { |
163 | 162 | $cli = $this->isCli ? '_cli' : ''; |
164 | 163 | |
165 | 164 | if ($this->config['max_files']) { |
166 | - $filename = date('Ymd') . $cli . '.log'; |
|
165 | + $filename = date('Ymd').$cli.'.log'; |
|
167 | 166 | } else { |
168 | - $filename = date('Ym') . DIRECTORY_SEPARATOR . date('d') . $cli . '.log'; |
|
167 | + $filename = date('Ym').DIRECTORY_SEPARATOR.date('d').$cli.'.log'; |
|
169 | 168 | } |
170 | 169 | |
171 | - $destination = $this->config['path'] . $filename; |
|
170 | + $destination = $this->config['path'].$filename; |
|
172 | 171 | } |
173 | 172 | |
174 | 173 | return $destination; |
@@ -188,14 +187,14 @@ discard block |
||
188 | 187 | if ($this->config['single']) { |
189 | 188 | $name = is_string($this->config['single']) ? $this->config['single'] : 'single'; |
190 | 189 | |
191 | - $name .= '_' . $type; |
|
190 | + $name .= '_'.$type; |
|
192 | 191 | } elseif ($this->config['max_files']) { |
193 | - $name = date('Ymd') . '_' . $type . $cli; |
|
192 | + $name = date('Ymd').'_'.$type.$cli; |
|
194 | 193 | } else { |
195 | - $name = date('d') . '_' . $type . $cli; |
|
194 | + $name = date('d').'_'.$type.$cli; |
|
196 | 195 | } |
197 | 196 | |
198 | - return $path . DIRECTORY_SEPARATOR . $name . '.log'; |
|
197 | + return $path.DIRECTORY_SEPARATOR.$name.'.log'; |
|
199 | 198 | } |
200 | 199 | |
201 | 200 | /** |
@@ -208,7 +207,7 @@ discard block |
||
208 | 207 | { |
209 | 208 | if (is_file($destination) && floor($this->config['file_size']) <= filesize($destination)) { |
210 | 209 | try { |
211 | - rename($destination, dirname($destination) . DIRECTORY_SEPARATOR . time() . '-' . basename($destination)); |
|
210 | + rename($destination, dirname($destination).DIRECTORY_SEPARATOR.time().'-'.basename($destination)); |
|
212 | 211 | } catch (\Exception $e) { |
213 | 212 | // |
214 | 213 | } |