@@ -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); |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | $fields = $reads; |
| 20 | 20 | } else { |
| 21 | 21 | $field = []; |
| 22 | - $prefix = strlen($table) ?"`{$table}`." :''; |
|
| 22 | + $prefix = strlen($table) ? "`{$table}`." : ''; |
|
| 23 | 23 | foreach ($reads as $want) { |
| 24 | 24 | $field[] = $prefix."`$want`"; |
| 25 | 25 | } |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | { |
| 84 | 84 | list($inSQL, $binders) = $this->prepareInParameter($values, $name); |
| 85 | 85 | $sql = $name.' IN ('.$inSQL.')'; |
| 86 | - return [$sql,$binders]; |
|
| 86 | + return [$sql, $binders]; |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | protected function prepareInParameter($values, string $name) |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | protected function prepareQueryMark(string $sql, array $parameter) |
| 130 | 130 | { |
| 131 | 131 | $binders = []; |
| 132 | - $query = \preg_replace_callback('/\?/', function ($match) use (&$binders, $parameter) { |
|
| 132 | + $query = \preg_replace_callback('/\?/', function($match) use (&$binders, $parameter) { |
|
| 133 | 133 | $index = count($binders); |
| 134 | 134 | if (\array_key_exists($index, $parameter)) { |
| 135 | 135 | $name = Binder::index($index); |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | * @return mixed |
| 14 | 14 | */ |
| 15 | 15 | public function input(string $name, $data) { |
| 16 | - $methodName='_input'.ucfirst($name).'Field'; |
|
| 16 | + $methodName = '_input'.ucfirst($name).'Field'; |
|
| 17 | 17 | if (\method_exists($this, $methodName)) { |
| 18 | 18 | return $this->$methodName($data); |
| 19 | 19 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | * @return mixed |
| 29 | 29 | */ |
| 30 | 30 | public function output(string $name, $data) { |
| 31 | - $methodName='_output'.ucfirst($name).'Field'; |
|
| 31 | + $methodName = '_output'.ucfirst($name).'Field'; |
|
| 32 | 32 | if (\method_exists($this, $methodName)) { |
| 33 | 33 | return $this->$methodName($data); |
| 34 | 34 | } |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | * @return mixed |
| 43 | 43 | */ |
| 44 | 44 | public function outputRow($row) { |
| 45 | - $methodName='_outputDataFilter'; |
|
| 45 | + $methodName = '_outputDataFilter'; |
|
| 46 | 46 | if (\method_exists($this, $methodName)) { |
| 47 | 47 | return $this->$methodName($row); |
| 48 | 48 | } |
@@ -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)); |
@@ -42,12 +42,12 @@ |
||
| 42 | 42 | */ |
| 43 | 43 | public function field(string $name, string $type, $length = null) |
| 44 | 44 | { |
| 45 | - return $this->fields[$name] ?? $this->fields[$name] = ($length?new Field($this->name, $name, $type, $length):new Field($this->name, $name, $type)); |
|
| 45 | + return $this->fields[$name] ?? $this->fields[$name] = ($length ? new Field($this->name, $name, $type, $length) : new Field($this->name, $name, $type)); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | public function newField(string $name, string $type, $length = null) |
| 49 | 49 | { |
| 50 | - return $this->fields[$name] ?? $this->fields[$name] = ($length?new Field($this->name, $name, $type, $length):new Field($this->name, $name, $type)); |
|
| 50 | + return $this->fields[$name] ?? $this->fields[$name] = ($length ? new Field($this->name, $name, $type, $length) : new Field($this->name, $name, $type)); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | public function getField(string $name) |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | { |
| 73 | 73 | $name = $this->getFieldName($property); |
| 74 | 74 | list($type, $length, $modifier) = $this->getFieldType($property); |
| 75 | - $field = new Field($tableName, $name, $type, $length); |
|
| 75 | + $field = new Field($tableName, $name, $type, $length); |
|
| 76 | 76 | $parser = new FieldModifierParser; |
| 77 | 77 | $parser->parse($modifier)->modify($field); |
| 78 | 78 | return $field; |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | } else { |
| 129 | 129 | $length = null; |
| 130 | 130 | } |
| 131 | - return [$type, $length , trim($match[3] ?? '')]; |
|
| 131 | + return [$type, $length, trim($match[3] ?? '')]; |
|
| 132 | 132 | } |
| 133 | 133 | } |
| 134 | 134 | return ['text', null, '']; |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | public function parse(string $modifier) |
| 47 | 47 | { |
| 48 | - $this->tokens = \token_get_all('<?php '. $modifier); |
|
| 48 | + $this->tokens = \token_get_all('<?php '.$modifier); |
|
| 49 | 49 | $this->length = count($this->tokens); |
| 50 | 50 | $this->pos = 1; |
| 51 | 51 | $this->modifier = []; |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | protected function skipWhiteComment() |
| 110 | 110 | { |
| 111 | - for ($i = $this->pos + 1; $i < $this->length ; $i++) { |
|
| 111 | + for ($i = $this->pos + 1; $i < $this->length; $i++) { |
|
| 112 | 112 | if (is_array($this->tokens[$i])) { |
| 113 | 113 | if (in_array($this->tokens[$i][0], [T_COMMENT, T_DOC_COMMENT, T_WHITESPACE])) { |
| 114 | 114 | $this->pos++; |