@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | protected function whereStringArray(string $where, array $whereBinder) |
198 | 198 | { |
199 | 199 | [$where, $whereBinder] = $this->prepareWhereString($where, $whereBinder); |
200 | - $this->where = 'WHERE ' . $where; |
|
200 | + $this->where = 'WHERE '.$where; |
|
201 | 201 | $this->binder = $this->mergeBinder($this->binder, $whereBinder); |
202 | 202 | } |
203 | 203 | |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | public function groupBy(string $what) |
211 | 211 | { |
212 | 212 | $what = $this->middleware->inputName($what); |
213 | - $this->groupBy = 'GROUP BY `' . $what . '`'; |
|
213 | + $this->groupBy = 'GROUP BY `'.$what.'`'; |
|
214 | 214 | return $this; |
215 | 215 | } |
216 | 216 | |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | protected function havingStringArray(string $having, array $havingBinder) |
254 | 254 | { |
255 | 255 | [$having, $havingBinder] = $this->prepareWhereString($having, $havingBinder); |
256 | - $this->having = 'HAVING ' . $having; |
|
256 | + $this->having = 'HAVING '.$having; |
|
257 | 257 | $this->binder = $this->mergeBinder($this->binder, $havingBinder); |
258 | 258 | } |
259 | 259 | |
@@ -269,9 +269,9 @@ discard block |
||
269 | 269 | $what = $this->middleware->inputName($what); |
270 | 270 | $order = strtoupper($order); |
271 | 271 | if (strlen($this->orderBy) > 0) { |
272 | - $this->orderBy .= ',`' . $what . '` ' . $order; |
|
272 | + $this->orderBy .= ',`'.$what.'` '.$order; |
|
273 | 273 | } else { |
274 | - $this->orderBy = 'ORDER BY `' . $what . '` ' . $order; |
|
274 | + $this->orderBy = 'ORDER BY `'.$what.'` '.$order; |
|
275 | 275 | } |
276 | 276 | return $this; |
277 | 277 | } |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | */ |
294 | 294 | public function limit(int $start, int $length = null) |
295 | 295 | { |
296 | - $this->limit = 'LIMIT ' . $start . ($length !== null ? ',' . $length : ''); |
|
296 | + $this->limit = 'LIMIT '.$start.($length !== null ? ','.$length : ''); |
|
297 | 297 | return $this; |
298 | 298 | } |
299 | 299 |
@@ -81,7 +81,7 @@ |
||
81 | 81 | if (array_key_exists($groupName, static::$dataSource)) { |
82 | 82 | return static::$dataSource[$groupName]; |
83 | 83 | } |
84 | - $group = $groupName === 'default' ? '': '-'. $groupName; |
|
84 | + $group = $groupName === 'default' ? '' : '-'.$groupName; |
|
85 | 85 | $dataSourceConfigPath = $resource->getConfigResourcePath('config/data-source'.$group); |
86 | 86 | $dataSource = new DataSource; |
87 | 87 | if ($dataSourceConfigPath !== null) { |
@@ -16,12 +16,12 @@ discard block |
||
16 | 16 | * @param string $path 目标路径 |
17 | 17 | * @return string|null 返回格式化结果,如果路径不存在则返回NULL |
18 | 18 | */ |
19 | - public static function format(string $path):?string |
|
19 | + public static function format(string $path): ?string |
|
20 | 20 | { |
21 | 21 | if (strlen(trim($path)) === 0) { |
22 | 22 | return null; |
23 | 23 | } |
24 | - return static::existCharset($path, ['GBK','GB2312','BIG5']); |
|
24 | + return static::existCharset($path, ['GBK', 'GB2312', 'BIG5']); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @param array $charset |
30 | 30 | * @return string|null |
31 | 31 | */ |
32 | - public static function existCharset(string $path, array $charset):?string |
|
32 | + public static function existCharset(string $path, array $charset): ?string |
|
33 | 33 | { |
34 | 34 | $abspath = static::toAbsolutePath($path); |
35 | 35 | if (static::existCase($abspath)) { |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | } |
167 | 167 | } |
168 | 168 | } catch (Exception $e) { |
169 | - echo '<div style="color:red">' . $e->getMessage() . '</div>'; |
|
169 | + echo '<div style="color:red">'.$e->getMessage().'</div>'; |
|
170 | 170 | return; |
171 | 171 | } |
172 | 172 | } |
@@ -188,9 +188,9 @@ discard block |
||
188 | 188 | return ob_get_clean() ?: ''; |
189 | 189 | } |
190 | 190 | throw new NoTemplateFoundException( |
191 | - 'missing dest at ' . $path , |
|
191 | + 'missing dest at '.$path, |
|
192 | 192 | E_USER_ERROR, |
193 | - $path , |
|
193 | + $path, |
|
194 | 194 | 1 |
195 | 195 | ); |
196 | 196 | } |
@@ -2,14 +2,14 @@ |
||
2 | 2 | /** |
3 | 3 | * 控制台用 |
4 | 4 | */ |
5 | -defined('SUDA_APP') or define('SUDA_APP', __DIR__ . '/app'); |
|
6 | -defined('SUDA_DATA') or define('SUDA_DATA', __DIR__ . '/data'); |
|
7 | -defined('SUDA_PUBLIC') or define('SUDA_PUBLIC', __DIR__ . '/public'); |
|
5 | +defined('SUDA_APP') or define('SUDA_APP', __DIR__.'/app'); |
|
6 | +defined('SUDA_DATA') or define('SUDA_DATA', __DIR__.'/data'); |
|
7 | +defined('SUDA_PUBLIC') or define('SUDA_PUBLIC', __DIR__.'/public'); |
|
8 | 8 | |
9 | 9 | defined('SUDA_DEBUG') or define('SUDA_DEBUG', true); |
10 | 10 | defined('SUDA_DEBUG_LEVEL') or define('SUDA_DEBUG_LEVEL', 'debug'); |
11 | -defined('SUDA_APP_MANIFEST') or define('SUDA_APP_MANIFEST', SUDA_APP . '/manifest'); |
|
12 | -defined('SUDA_DEBUG_LOG_PATH') or define('SUDA_DEBUG_LOG_PATH', SUDA_DATA . '/logs'); |
|
11 | +defined('SUDA_APP_MANIFEST') or define('SUDA_APP_MANIFEST', SUDA_APP.'/manifest'); |
|
12 | +defined('SUDA_DEBUG_LOG_PATH') or define('SUDA_DEBUG_LOG_PATH', SUDA_DATA.'/logs'); |
|
13 | 13 | |
14 | -require_once __DIR__ . '/vendor/autoload.php'; |
|
15 | -require_once __DIR__ . '/suda/loader/console.php'; |
|
16 | 14 | \ No newline at end of file |
15 | +require_once __DIR__.'/vendor/autoload.php'; |
|
16 | +require_once __DIR__.'/suda/loader/console.php'; |
|
17 | 17 | \ No newline at end of file |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | public function log($level, $message, array $context = []) |
31 | 31 | { |
32 | 32 | if (Debug::compare($level, $this->level) >= 0) { |
33 | - print date('Y-m-d H:i:s') . ' ' . $this->interpolate($message, $context) . PHP_EOL; |
|
33 | + print date('Y-m-d H:i:s').' '.$this->interpolate($message, $context).PHP_EOL; |
|
34 | 34 | } |
35 | 35 | } |
36 | 36 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | { |
44 | 44 | $replace = []; |
45 | 45 | foreach ($context as $key => $val) { |
46 | - $replace['{' . $key . '}'] = $val; |
|
46 | + $replace['{'.$key.'}'] = $val; |
|
47 | 47 | } |
48 | 48 | return strtr($message, $replace); |
49 | 49 | } |
@@ -15,20 +15,20 @@ discard block |
||
15 | 15 | use suda\framework\debug\log\logger\MultiLogger; |
16 | 16 | use suda\framework\debug\log\logger\ConsoleLogger; |
17 | 17 | |
18 | -defined('SUDA_APP') or define('SUDA_APP', __DIR__ . '/app'); |
|
19 | -defined('SUDA_DATA') or define('SUDA_DATA', __DIR__ . '/data'); |
|
20 | -defined('SUDA_PUBLIC') or define('SUDA_PUBLIC', __DIR__ . '/public'); |
|
18 | +defined('SUDA_APP') or define('SUDA_APP', __DIR__.'/app'); |
|
19 | +defined('SUDA_DATA') or define('SUDA_DATA', __DIR__.'/data'); |
|
20 | +defined('SUDA_PUBLIC') or define('SUDA_PUBLIC', __DIR__.'/public'); |
|
21 | 21 | defined('SUDA_DEBUG') or define('SUDA_DEBUG', true); |
22 | 22 | defined('SUDA_DEBUG_LEVEL') or define('SUDA_DEBUG_LEVEL', 'debug'); |
23 | -defined('SUDA_APP_MANIFEST') or define('SUDA_APP_MANIFEST', SUDA_APP . '/manifest'); |
|
24 | -defined('SUDA_DEBUG_LOG_PATH') or define('SUDA_DEBUG_LOG_PATH', SUDA_DATA . '/logs'); |
|
23 | +defined('SUDA_APP_MANIFEST') or define('SUDA_APP_MANIFEST', SUDA_APP.'/manifest'); |
|
24 | +defined('SUDA_DEBUG_LOG_PATH') or define('SUDA_DEBUG_LOG_PATH', SUDA_DATA.'/logs'); |
|
25 | 25 | |
26 | -require_once __DIR__ . '/loader.php'; |
|
26 | +require_once __DIR__.'/loader.php'; |
|
27 | 27 | |
28 | 28 | // 初始化系统加载器 |
29 | 29 | $loader = new Loader; |
30 | 30 | $loader->register(); |
31 | -$loader->addIncludePath(SUDA_SYSTEM . '/src', 'suda'); |
|
31 | +$loader->addIncludePath(SUDA_SYSTEM.'/src', 'suda'); |
|
32 | 32 | // 初始化数据目录 |
33 | 33 | $application = ApplicationBuilder::build($loader, SUDA_APP, SUDA_APP_MANIFEST, SUDA_DATA); |
34 | 34 | |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | [ |
38 | 38 | 'log-level' => SUDA_DEBUG_LEVEL, |
39 | 39 | 'save-path' => SUDA_DEBUG_LOG_PATH, |
40 | - 'save-dump-path' => SUDA_DEBUG_LOG_PATH . '/dump', |
|
41 | - 'save-zip-path' => SUDA_DEBUG_LOG_PATH . '/zip', |
|
40 | + 'save-dump-path' => SUDA_DEBUG_LOG_PATH.'/dump', |
|
41 | + 'save-zip-path' => SUDA_DEBUG_LOG_PATH.'/zip', |
|
42 | 42 | 'log-format' => '%message%', |
43 | 43 | ] |
44 | 44 | ), new ConsoleLogger('warning')); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | /** @var Command $cmd */ |
69 | 69 | $className = Loader::realName($item['class']); |
70 | 70 | $cmd = new $className; |
71 | - $cmd->setName($module->getName() . ':' . $cmd->getName()); |
|
71 | + $cmd->setName($module->getName().':'.$cmd->getName()); |
|
72 | 72 | if (method_exists($cmd, 'putApplication')) { |
73 | 73 | call_user_func_array([$cmd, 'putApplication'], [$application]); |
74 | 74 | } |
@@ -83,9 +83,9 @@ discard block |
||
83 | 83 | $replace = []; |
84 | 84 | $attach = []; |
85 | 85 | foreach ($context as $key => $val) { |
86 | - $replaceKey = '{' . $key . '}'; |
|
86 | + $replaceKey = '{'.$key.'}'; |
|
87 | 87 | if ($this->canBeStringValue($val) && strpos($message, $replaceKey) !== false) { |
88 | - $replace['{' . $key . '}'] = $val; |
|
88 | + $replace['{'.$key.'}'] = $val; |
|
89 | 89 | } else { |
90 | 90 | $attach[$key] = $val; |
91 | 91 | } |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | $pow = floor(($bytes ? log($bytes) : 0) / log(1024)); |
152 | 152 | $pos = min($pow, count($human) - 1); |
153 | 153 | $bytes /= (1 << (10 * $pos)); |
154 | - return round($bytes, $precision) . ' ' . $human[$pos]; |
|
154 | + return round($bytes, $precision).' '.$human[$pos]; |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | protected $ignorePath = [__FILE__]; |
13 | 13 | protected $backtrace; |
14 | 14 | |
15 | - public function __construct(array $backtrace, array $ignorePath =[]) |
|
15 | + public function __construct(array $backtrace, array $ignorePath = []) |
|
16 | 16 | { |
17 | 17 | $this->ignorePath = array_merge($this->ignorePath, $ignorePath); |
18 | 18 | $rc = new \ReflectionClass(LoggerTrait::class); |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | $this->backtrace = $backtrace; |
24 | 24 | } |
25 | 25 | |
26 | - public function getCallerTrace():?array |
|
26 | + public function getCallerTrace(): ?array |
|
27 | 27 | { |
28 | 28 | foreach ($this->backtrace as $trace) { |
29 | 29 | if (array_key_exists('file', $trace)) { |