@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | protected function whereStringArray(string $where, array $whereBinder) |
198 | 198 | { |
199 | 199 | list($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 | list($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 |
@@ -88,10 +88,10 @@ discard block |
||
88 | 88 | */ |
89 | 89 | protected function sendMultipleFileByRange(Response $response, array $ranges) |
90 | 90 | { |
91 | - $separates = 'multiple_range_' . base64_encode(md5(uniqid(), true)); |
|
92 | - $response->setHeader('content-type', 'multipart/byteranges; boundary=' . $separates); |
|
91 | + $separates = 'multiple_range_'.base64_encode(md5(uniqid(), true)); |
|
92 | + $response->setHeader('content-type', 'multipart/byteranges; boundary='.$separates); |
|
93 | 93 | foreach ($ranges as $range) { |
94 | - $response->write('--' . $separates . "\r\n"); |
|
94 | + $response->write('--'.$separates."\r\n"); |
|
95 | 95 | $this->sendMultipleRangePart($response, $range); |
96 | 96 | $this->sendFileByRange($response, $range); |
97 | 97 | $response->write("\r\n"); |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | */ |
139 | 139 | protected function sendMultipleRangePart(Response $response, array $range) |
140 | 140 | { |
141 | - $response->write('Content-Type: ' . $this->mime . "\r\n"); |
|
142 | - $response->write('Content-Range: ' . $this->getRangeHeader($range) . "\r\n\r\n"); |
|
141 | + $response->write('Content-Type: '.$this->mime."\r\n"); |
|
142 | + $response->write('Content-Range: '.$this->getRangeHeader($range)."\r\n\r\n"); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | /** |
@@ -101,7 +101,7 @@ |
||
101 | 101 | $class = [$class]; |
102 | 102 | } |
103 | 103 | foreach ($class as $index => $className) { |
104 | - $class[$index] = $this->className($className) . '->onRequest'; |
|
104 | + $class[$index] = $this->className($className).'->onRequest'; |
|
105 | 105 | } |
106 | 106 | return $class; |
107 | 107 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | protected function prepare(Request $request, Response $response) |
86 | 86 | { |
87 | - $response->setHeader('x-powered-by', 'suda/' . SUDA_VERSION, true); |
|
87 | + $response->setHeader('x-powered-by', 'suda/'.SUDA_VERSION, true); |
|
88 | 88 | $response->getWrapper()->register(ExceptionContentWrapper::class, [Throwable::class]); |
89 | 89 | $response->getWrapper()->register(TemplateWrapper::class, [RawTemplate::class]); |
90 | 90 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | if (!$appResponse->isSend()) { |
139 | 139 | $appResponse->end(); |
140 | 140 | } |
141 | - $this->debug->info('responded with code ' . $appResponse->getStatus()); |
|
141 | + $this->debug->info('responded with code '.$appResponse->getStatus()); |
|
142 | 142 | $this->debug->timeEnd('sending response'); |
143 | 143 | } catch (Throwable $e) { |
144 | 144 | $this->debug->uncaughtException($e); |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | public function request(array $method, string $name, string $url, array $attributes = []) |
162 | 162 | { |
163 | 163 | $route = $attributes['config'] ?? []; |
164 | - $runnable = RunnableRequestProcessor::class . '->onRequest'; |
|
164 | + $runnable = RunnableRequestProcessor::class.'->onRequest'; |
|
165 | 165 | if (array_key_exists('class', $route)) { |
166 | 166 | $attributes['class'] = $route['class']; |
167 | 167 | } elseif (array_key_exists('source', $route)) { |
@@ -105,8 +105,8 @@ discard block |
||
105 | 105 | $table = $this->fields->getRealTableName($this->connection); |
106 | 106 | $sql = "CREATE TABLE IF NOT EXISTS `{$table}` (\r\n\t"; |
107 | 107 | $sql .= implode(",\r\n\t", array_filter($content, 'strlen')); |
108 | - $auto = null === $this->auto?'':'AUTO_INCREMENT='.$this->auto; |
|
109 | - $collate = null === $this->collate?'':'COLLATE '.$this->collate; |
|
108 | + $auto = null === $this->auto ? '' : 'AUTO_INCREMENT='.$this->auto; |
|
109 | + $collate = null === $this->collate ? '' : 'COLLATE '.$this->collate; |
|
110 | 110 | $sql .= "\r\n) ENGINE={$this->engine} {$collate} {$auto} DEFAULT CHARSET={$this->charset};"; |
111 | 111 | return $sql; |
112 | 112 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | } |
125 | 125 | } |
126 | 126 | if (count($primary)) { |
127 | - return 'PRIMARY KEY ('. implode(',', $primary).')'; |
|
127 | + return 'PRIMARY KEY ('.implode(',', $primary).')'; |
|
128 | 128 | } |
129 | 129 | return ''; |
130 | 130 | } |
@@ -217,10 +217,10 @@ discard block |
||
217 | 217 | protected function createField(Field $field) |
218 | 218 | { |
219 | 219 | $type = strtoupper($field->getValueType()).$this->parseLength($field->getLength()); |
220 | - $auto = $field->getAuto() ?'AUTO_INCREMENT':''; |
|
221 | - $null = $field->isNullable() ?'NULL':'NOT NULL'; |
|
222 | - $attr = $field->getAttribute() ?strtoupper($field->getAttribute()):''; |
|
223 | - $comment = $field->getComment() ?('COMMENT \''.addcslashes($field->getComment(), '\'').'\''):''; |
|
220 | + $auto = $field->getAuto() ? 'AUTO_INCREMENT' : ''; |
|
221 | + $null = $field->isNullable() ? 'NULL' : 'NOT NULL'; |
|
222 | + $attr = $field->getAttribute() ?strtoupper($field->getAttribute()) : ''; |
|
223 | + $comment = $field->getComment() ? ('COMMENT \''.addcslashes($field->getComment(), '\'').'\'') : ''; |
|
224 | 224 | // default设置 |
225 | 225 | if ($field->hasDefault()) { |
226 | 226 | if (null === $field->getDefault()) { |
@@ -26,7 +26,7 @@ |
||
26 | 26 | public function __construct(string $tableName, string $connection = 'default', bool $raw = false) |
27 | 27 | { |
28 | 28 | parent::__construct( |
29 | - $this->initStruct($tableName,$raw), |
|
29 | + $this->initStruct($tableName, $raw), |
|
30 | 30 | Database::getDataSource($connection), |
31 | 31 | $this); |
32 | 32 | } |
@@ -72,8 +72,8 @@ |
||
72 | 72 | 'context' => $this->context, |
73 | 73 | 'backtrace' => $throwable->getTrace(), |
74 | 74 | ]; |
75 | - $exceptionHash = md5($throwable->getFile() . $throwable->getLine() . $throwable->getCode()); |
|
76 | - $path = $dumpPath . '/' . microtime(true) . '.' . substr($exceptionHash, 0, 8) . '.json'; |
|
75 | + $exceptionHash = md5($throwable->getFile().$throwable->getLine().$throwable->getCode()); |
|
76 | + $path = $dumpPath.'/'.microtime(true).'.'.substr($exceptionHash, 0, 8).'.json'; |
|
77 | 77 | FileSystem::make($dumpPath); |
78 | 78 | FileSystem::put($path, json_encode( |
79 | 79 | new DebugObject($dumper), |
@@ -26,7 +26,7 @@ |
||
26 | 26 | */ |
27 | 27 | public function loadVendorIfExist() |
28 | 28 | { |
29 | - $vendorAutoload = $this->application->getPath() . '/vendor/autoload.php'; |
|
29 | + $vendorAutoload = $this->application->getPath().'/vendor/autoload.php'; |
|
30 | 30 | if (FileSystem::exist($vendorAutoload)) { |
31 | 31 | Loader::requireOnce($vendorAutoload); |
32 | 32 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | $group = $group ?? $request->getAttribute('group'); |
58 | 58 | $default = $default ?? $request->getAttribute('module'); |
59 | 59 | $url = $this->route->create($this->getRouteName($name, $default, $group), $parameter, $allowQuery); |
60 | - return $this->getUrlIndex($request) . ltrim($url, '/'); |
|
60 | + return $this->getUrlIndex($request).ltrim($url, '/'); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | public function getUriBase(Request $request, bool $beautify = true): string |
90 | 90 | { |
91 | 91 | $index = $beautify ? $this->getUrlIndex($request) : $request->getIndex(); |
92 | - return $request->getUriBase() . $index; |
|
92 | + return $request->getUriBase().$index; |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | /** |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | */ |
101 | 101 | protected function getRouteGroupPrefix(?string $group): string |
102 | 102 | { |
103 | - return $group === null || $group === 'default' ? '' : '@' . $group; |
|
103 | + return $group === null || $group === 'default' ? '' : '@'.$group; |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | } |
139 | 139 | $prefixGroup = $this->getRouteGroupPrefix($group); |
140 | 140 | if ($module !== null && ($moduleObj = $this->find($module))) { |
141 | - return $moduleObj->getFullName() . $prefixGroup . ':' . $name; |
|
141 | + return $moduleObj->getFullName().$prefixGroup.':'.$name; |
|
142 | 142 | } |
143 | 143 | return $name; |
144 | 144 | } |