@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | // +---------------------------------------------------------------------- |
9 | 9 | // | Author: yunwuxin <[email protected]> |
10 | 10 | // +---------------------------------------------------------------------- |
11 | -declare(strict_types = 1); |
|
11 | +declare(strict_types=1); |
|
12 | 12 | |
13 | 13 | namespace think; |
14 | 14 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | */ |
37 | 37 | protected function loadRoutesFrom($path) |
38 | 38 | { |
39 | - $this->registerRoutes(function () use ($path) { |
|
39 | + $this->registerRoutes(function() use ($path) { |
|
40 | 40 | include $path; |
41 | 41 | }); |
42 | 42 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | { |
60 | 60 | $commands = is_array($commands) ? $commands : func_get_args(); |
61 | 61 | |
62 | - Console::starting(function (Console $console) use ($commands) { |
|
62 | + Console::starting(function(Console $console) use ($commands) { |
|
63 | 63 | $console->addCommands($commands); |
64 | 64 | }); |
65 | 65 | } |
@@ -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 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | */ |
86 | 86 | public function fetch(string $template = '', array $vars = []): string |
87 | 87 | { |
88 | - return $this->getContent(function () use ($vars, $template) { |
|
88 | + return $this->getContent(function() use ($vars, $template) { |
|
89 | 89 | $this->engine()->fetch($template, array_merge($this->data, $vars)); |
90 | 90 | }); |
91 | 91 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function display(string $content, array $vars = []): string |
101 | 101 | { |
102 | - return $this->getContent(function () use ($vars, $content) { |
|
102 | + return $this->getContent(function() use ($vars, $content) { |
|
103 | 103 | $this->engine()->display($content, array_merge($this->data, $vars)); |
104 | 104 | }); |
105 | 105 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | // +---------------------------------------------------------------------- |
9 | 9 | // | Author: yunwuxin <[email protected]> |
10 | 10 | // +---------------------------------------------------------------------- |
11 | -declare(strict_types = 1); |
|
11 | +declare(strict_types=1); |
|
12 | 12 | |
13 | 13 | namespace think\log; |
14 | 14 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | if (is_string($msg) && !empty($context)) { |
87 | 87 | $replace = []; |
88 | 88 | foreach ($context as $key => $val) { |
89 | - $replace['{' . $key . '}'] = $val; |
|
89 | + $replace['{'.$key.'}'] = $val; |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | $msg = strtr($msg, $replace); |
@@ -8,7 +8,7 @@ |
||
8 | 8 | // +---------------------------------------------------------------------- |
9 | 9 | // | Author: yunwuxin <[email protected]> |
10 | 10 | // +---------------------------------------------------------------------- |
11 | -declare(strict_types = 1); |
|
11 | +declare(strict_types=1); |
|
12 | 12 | |
13 | 13 | namespace think\log; |
14 | 14 |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | // +---------------------------------------------------------------------- |
9 | 9 | // | Author: luofei614 <weibo.com/luofei614> |
10 | 10 | // +---------------------------------------------------------------------- |
11 | -declare(strict_types = 1); |
|
11 | +declare(strict_types=1); |
|
12 | 12 | |
13 | 13 | namespace think\log\driver; |
14 | 14 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | if ($this->app->exists('request')) { |
93 | 93 | $currentUri = $this->app->request->url(true); |
94 | 94 | } else { |
95 | - $currentUri = 'cmd:' . implode(' ', $_SERVER['argv'] ?? []); |
|
95 | + $currentUri = 'cmd:'.implode(' ', $_SERVER['argv'] ?? []); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | if (!empty($this->config['format_head'])) { |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | foreach ($log as $type => $val) { |
117 | 117 | $trace[] = [ |
118 | 118 | 'type' => isset($expandLevel[$type]) ? 'group' : 'groupCollapsed', |
119 | - 'msg' => '[ ' . $type . ' ]', |
|
119 | + 'msg' => '[ '.$type.' ]', |
|
120 | 120 | 'css' => $this->css[$type] ?? '', |
121 | 121 | ]; |
122 | 122 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | ]; |
203 | 203 | |
204 | 204 | $msg = json_encode($logs, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PARTIAL_OUTPUT_ON_ERROR); |
205 | - $address = '/' . $clientId; //将client_id作为地址, server端通过地址判断将日志发布给谁 |
|
205 | + $address = '/'.$clientId; //将client_id作为地址, server端通过地址判断将日志发布给谁 |
|
206 | 206 | |
207 | 207 | $this->send($this->config['host'], $this->config['port'], $msg, $address); |
208 | 208 | } |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | */ |
286 | 286 | protected function send($host, $port, $message = '', $address = '/') |
287 | 287 | { |
288 | - $url = 'http://' . $host . ':' . $port . $address; |
|
288 | + $url = 'http://'.$host.':'.$port.$address; |
|
289 | 289 | $ch = curl_init(); |
290 | 290 | |
291 | 291 | curl_setopt($ch, CURLOPT_URL, $url); |
@@ -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 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | } |
49 | 49 | |
50 | 50 | if (empty($this->config['path'])) { |
51 | - $this->config['path'] = $app->getRuntimePath() . 'log'; |
|
51 | + $this->config['path'] = $app->getRuntimePath().'log'; |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | if (substr($this->config['path'], -1) != DIRECTORY_SEPARATOR) { |
@@ -82,8 +82,7 @@ discard block |
||
82 | 82 | } |
83 | 83 | |
84 | 84 | $message[] = $this->config['json'] ? |
85 | - json_encode(['time' => $time, 'type' => $type, 'msg' => $msg], $this->config['json_options']) : |
|
86 | - sprintf($this->config['format'], $time, $type, $msg); |
|
85 | + json_encode(['time' => $time, 'type' => $type, 'msg' => $msg], $this->config['json_options']) : sprintf($this->config['format'], $time, $type, $msg); |
|
87 | 86 | } |
88 | 87 | |
89 | 88 | if (true === $this->config['apart_level'] || in_array($type, $this->config['apart_level'])) { |
@@ -121,7 +120,7 @@ discard block |
||
121 | 120 | $info[$type] = is_array($msg) ? implode(PHP_EOL, $msg) : $msg; |
122 | 121 | } |
123 | 122 | |
124 | - $message = implode(PHP_EOL, $info) . PHP_EOL; |
|
123 | + $message = implode(PHP_EOL, $info).PHP_EOL; |
|
125 | 124 | |
126 | 125 | return error_log($message, 3, $destination); |
127 | 126 | } |
@@ -134,7 +133,7 @@ discard block |
||
134 | 133 | protected function getMasterLogFile(): string |
135 | 134 | { |
136 | 135 | if ($this->config['max_files']) { |
137 | - $files = glob($this->config['path'] . '*.log'); |
|
136 | + $files = glob($this->config['path'].'*.log'); |
|
138 | 137 | |
139 | 138 | try { |
140 | 139 | if (count($files) > $this->config['max_files']) { |
@@ -147,15 +146,15 @@ discard block |
||
147 | 146 | |
148 | 147 | if ($this->config['single']) { |
149 | 148 | $name = is_string($this->config['single']) ? $this->config['single'] : 'single'; |
150 | - $destination = $this->config['path'] . $name . '.log'; |
|
149 | + $destination = $this->config['path'].$name.'.log'; |
|
151 | 150 | } else { |
152 | 151 | if ($this->config['max_files']) { |
153 | - $filename = date('Ymd') . '.log'; |
|
152 | + $filename = date('Ymd').'.log'; |
|
154 | 153 | } else { |
155 | - $filename = date('Ym') . DIRECTORY_SEPARATOR . date('d') . '.log'; |
|
154 | + $filename = date('Ym').DIRECTORY_SEPARATOR.date('d').'.log'; |
|
156 | 155 | } |
157 | 156 | |
158 | - $destination = $this->config['path'] . $filename; |
|
157 | + $destination = $this->config['path'].$filename; |
|
159 | 158 | } |
160 | 159 | |
161 | 160 | return $destination; |
@@ -173,14 +172,14 @@ discard block |
||
173 | 172 | if ($this->config['single']) { |
174 | 173 | $name = is_string($this->config['single']) ? $this->config['single'] : 'single'; |
175 | 174 | |
176 | - $name .= '_' . $type; |
|
175 | + $name .= '_'.$type; |
|
177 | 176 | } elseif ($this->config['max_files']) { |
178 | - $name = date('Ymd') . '_' . $type; |
|
177 | + $name = date('Ymd').'_'.$type; |
|
179 | 178 | } else { |
180 | - $name = date('d') . '_' . $type; |
|
179 | + $name = date('d').'_'.$type; |
|
181 | 180 | } |
182 | 181 | |
183 | - return $path . DIRECTORY_SEPARATOR . $name . '.log'; |
|
182 | + return $path.DIRECTORY_SEPARATOR.$name.'.log'; |
|
184 | 183 | } |
185 | 184 | |
186 | 185 | /** |
@@ -193,7 +192,7 @@ discard block |
||
193 | 192 | { |
194 | 193 | if (is_file($destination) && floor($this->config['file_size']) <= filesize($destination)) { |
195 | 194 | try { |
196 | - rename($destination, dirname($destination) . DIRECTORY_SEPARATOR . time() . '-' . basename($destination)); |
|
195 | + rename($destination, dirname($destination).DIRECTORY_SEPARATOR.time().'-'.basename($destination)); |
|
197 | 196 | } catch (\Exception $e) { |
198 | 197 | // |
199 | 198 | } |
@@ -8,7 +8,7 @@ |
||
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\contract; |
14 | 14 |
@@ -8,7 +8,7 @@ |
||
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\contract; |
14 | 14 |
@@ -8,7 +8,7 @@ |
||
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\contract; |
14 | 14 |