@@ -24,7 +24,7 @@ |
||
| 24 | 24 | |
| 25 | 25 | public function packValue(?string $matched) |
| 26 | 26 | { |
| 27 | - return $matched ? urlencode($matched): ''; |
|
| 27 | + return $matched ? urlencode($matched) : ''; |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | /** |
@@ -230,7 +230,7 @@ |
||
| 230 | 230 | protected function closeOutputBuffer(bool $flush) |
| 231 | 231 | { |
| 232 | 232 | while (ob_get_level() > 0) { |
| 233 | - $flush?ob_end_flush():ob_end_clean(); |
|
| 233 | + $flush ?ob_end_flush() : ob_end_clean(); |
|
| 234 | 234 | } |
| 235 | 235 | } |
| 236 | 236 | |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | protected function whereStringArray(string $where, array $whereBinder) |
| 109 | 109 | { |
| 110 | 110 | list($where, $whereBinder) = $this->parepareWhereString($where, $whereBinder); |
| 111 | - $this->where = 'WHERE '. $where; |
|
| 111 | + $this->where = 'WHERE '.$where; |
|
| 112 | 112 | $this->binder = $this->mergeBinder($this->binder, $whereBinder); |
| 113 | 113 | } |
| 114 | 114 | |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | */ |
| 121 | 121 | public function groupBy(string $what) |
| 122 | 122 | { |
| 123 | - $this->groupBy = 'GROUP BY '. $what; |
|
| 123 | + $this->groupBy = 'GROUP BY '.$what; |
|
| 124 | 124 | return $this; |
| 125 | 125 | } |
| 126 | 126 | |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | { |
| 155 | 155 | |
| 156 | 156 | list($having, $havingBinder) = $this->parepareWhereString($having, $havingBinder); |
| 157 | - $this->having = 'HAVING '. $having; |
|
| 157 | + $this->having = 'HAVING '.$having; |
|
| 158 | 158 | $this->binder = $this->mergeBinder($this->binder, $havingBinder); |
| 159 | 159 | } |
| 160 | 160 | |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | */ |
| 168 | 168 | public function orderBy(string $what, string $order = 'ASC') |
| 169 | 169 | { |
| 170 | - $this->orderBy = 'ORDER BY '. $what.' '. $order; |
|
| 170 | + $this->orderBy = 'ORDER BY '.$what.' '.$order; |
|
| 171 | 171 | return $this; |
| 172 | 172 | } |
| 173 | 173 | |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | */ |
| 181 | 181 | public function limit(int $start, int $length = null) |
| 182 | 182 | { |
| 183 | - $this->limit = 'LIMIT '. $start . ($length !== null ? ',' .$length :''); |
|
| 183 | + $this->limit = 'LIMIT '.$start.($length !== null ? ','.$length : ''); |
|
| 184 | 184 | return $this; |
| 185 | 185 | } |
| 186 | 186 | |
@@ -207,9 +207,9 @@ discard block |
||
| 207 | 207 | */ |
| 208 | 208 | protected function prepareQuery():Query |
| 209 | 209 | { |
| 210 | - $where = [$this->where,$this->groupBy,$this->having,$this->orderBy,$this->limit]; |
|
| 210 | + $where = [$this->where, $this->groupBy, $this->having, $this->orderBy, $this->limit]; |
|
| 211 | 211 | $condition = implode(' ', array_filter(array_map('trim', $where), 'strlen')); |
| 212 | - $select = [$this->distinct,$this->select]; |
|
| 212 | + $select = [$this->distinct, $this->select]; |
|
| 213 | 213 | $selection = implode(' ', array_filter(array_map('trim', $select), 'strlen')); |
| 214 | 214 | $string = "SELECT {$selection} FROM {$this->table} {$condition}"; |
| 215 | 215 | return new Query($string, $this->binder); |
@@ -6,12 +6,12 @@ |
||
| 6 | 6 | use suda\framework\http\HTTPRequest; |
| 7 | 7 | use suda\application\builder\ApplicationBuilder; |
| 8 | 8 | |
| 9 | -require_once __DIR__ .'/loader.php'; |
|
| 9 | +require_once __DIR__.'/loader.php'; |
|
| 10 | 10 | |
| 11 | 11 | // 初始化系统加载器 |
| 12 | 12 | $loader = new Loader; |
| 13 | 13 | $loader->register(); |
| 14 | -$loader->addIncludePath(SUDA_SYSTEM .'/src', 'suda'); |
|
| 14 | +$loader->addIncludePath(SUDA_SYSTEM.'/src', 'suda'); |
|
| 15 | 15 | // 初始化数据目录 |
| 16 | 16 | defined('SUDA_DATA') or define('SUDA_DATA', Path::toAbsolutePath('~/data')); |
| 17 | 17 | $application = ApplicationBuilder::build($loader, SUDA_APP, SUDA_DATA); |
@@ -139,7 +139,7 @@ |
||
| 139 | 139 | if (is_string($doc) && preg_match('/@field\s+(\w+)(?:\((.+?)\))?\s+(.+)?$/im', $doc, $match)) { |
| 140 | 140 | $type = strtoupper($match[1]); |
| 141 | 141 | $length = static::parseLength($match[2] ?? ''); |
| 142 | - return [$type, $length , trim($match[3] ?? '')]; |
|
| 142 | + return [$type, $length, trim($match[3] ?? '')]; |
|
| 143 | 143 | } |
| 144 | 144 | } |
| 145 | 145 | return ['text', null, '']; |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | protected function prepareProcessorSet(string $object) |
| 61 | 61 | { |
| 62 | 62 | $reflectObject = new ReflectionClass($object); |
| 63 | - $classDoc = is_string($reflectObject->getDocComment())?$reflectObject->getDocComment():''; |
|
| 63 | + $classDoc = is_string($reflectObject->getDocComment()) ? $reflectObject->getDocComment() : ''; |
|
| 64 | 64 | $field = TableClassStructBuilder::readClassDocField($classDoc); |
| 65 | 65 | if ($field !== null) { |
| 66 | 66 | $this->createProccorFromStruct(); |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | */ |
| 38 | 38 | public function register() |
| 39 | 39 | { |
| 40 | - set_exception_handler([$this,'uncaughtException']); |
|
| 40 | + set_exception_handler([$this, 'uncaughtException']); |
|
| 41 | 41 | return $this; |
| 42 | 42 | } |
| 43 | 43 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | public function parse(string $modifier) |
| 51 | 51 | { |
| 52 | - $this->tokens = token_get_all('<?php '. $modifier); |
|
| 52 | + $this->tokens = token_get_all('<?php '.$modifier); |
|
| 53 | 53 | $this->length = count($this->tokens); |
| 54 | 54 | $this->pos = 1; |
| 55 | 55 | $this->modifier = []; |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | protected function skipWhiteComment() |
| 111 | 111 | { |
| 112 | - for ($i = $this->pos + 1; $i < $this->length ; $i++) { |
|
| 112 | + for ($i = $this->pos + 1; $i < $this->length; $i++) { |
|
| 113 | 113 | if (is_array($this->tokens[$i])) { |
| 114 | 114 | if (in_array($this->tokens[$i][0], [T_COMMENT, T_DOC_COMMENT, T_WHITESPACE])) { |
| 115 | 115 | $this->pos++; |
@@ -132,7 +132,7 @@ |
||
| 132 | 132 | */ |
| 133 | 133 | public function charset(string $charset) |
| 134 | 134 | { |
| 135 | - $this->charset = 'CHARACTER SET ' . $charset; |
|
| 135 | + $this->charset = 'CHARACTER SET '.$charset; |
|
| 136 | 136 | return $this; |
| 137 | 137 | } |
| 138 | 138 | |