@@ -42,4 +42,4 @@ |
||
42 | 42 | } |
43 | 43 | } |
44 | 44 | // 加载器 |
45 | -require_once SUDA_SYSTEM .'/src/framework/loader/Loader.php'; |
|
45 | +require_once SUDA_SYSTEM.'/src/framework/loader/Loader.php'; |
@@ -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); |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | * |
176 | 176 | * @return string|null |
177 | 177 | */ |
178 | - public function getFetchClass():?string |
|
178 | + public function getFetchClass(): ?string |
|
179 | 179 | { |
180 | 180 | return $this->fetchClass ?? null; |
181 | 181 | } |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | * |
186 | 186 | * @return boolean|null |
187 | 187 | */ |
188 | - public function isScroll(bool $set = null):?bool |
|
188 | + public function isScroll(bool $set = null): ?bool |
|
189 | 189 | { |
190 | 190 | if ($set !== null) { |
191 | 191 | $this->scroll = true; |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | * |
258 | 258 | * @return PDOStatement |
259 | 259 | */ |
260 | - public function getStatement():?PDOStatement |
|
260 | + public function getStatement(): ?PDOStatement |
|
261 | 261 | { |
262 | 262 | return $this->statement; |
263 | 263 | } |
@@ -20,13 +20,13 @@ |
||
20 | 20 | } |
21 | 21 | |
22 | 22 | |
23 | - /** |
|
24 | - * 取1 |
|
25 | - * |
|
26 | - * @param string|null $class |
|
27 | - * @param array $args |
|
28 | - * @return mixed |
|
29 | - */ |
|
23 | + /** |
|
24 | + * 取1 |
|
25 | + * |
|
26 | + * @param string|null $class |
|
27 | + * @param array $args |
|
28 | + * @return mixed |
|
29 | + */ |
|
30 | 30 | public function one(?string $class = null, array $args = []) |
31 | 31 | { |
32 | 32 | $value = $this->access->run($this->wantOne($class, $args)); |
@@ -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 |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $fields = $reads; |
26 | 26 | } else { |
27 | 27 | $field = []; |
28 | - $prefix = strlen($table) ?"`{$table}`." :''; |
|
28 | + $prefix = strlen($table) ? "`{$table}`." : ''; |
|
29 | 29 | foreach ($reads as $want) { |
30 | 30 | $field[] = $prefix."`$want`"; |
31 | 31 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | { |
90 | 90 | list($inSQL, $binders) = $this->prepareInParameter($values, $name); |
91 | 91 | $sql = $name.' IN ('.$inSQL.')'; |
92 | - return [$sql,$binders]; |
|
92 | + return [$sql, $binders]; |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | protected function prepareInParameter($values, string $name) |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | protected function prepareQueryMark(string $sql, array $parameter) |
136 | 136 | { |
137 | 137 | $binders = []; |
138 | - $query = preg_replace_callback('/\?/', function ($match) use (&$binders, $parameter) { |
|
138 | + $query = preg_replace_callback('/\?/', function($match) use (&$binders, $parameter) { |
|
139 | 139 | $index = count($binders); |
140 | 140 | if (array_key_exists($index, $parameter)) { |
141 | 141 | $name = Binder::index($index); |