@@ -52,8 +52,7 @@ discard block |
||
52 | 52 | * Class SelectStatement |
53 | 53 | * @package Platine\Database\Query |
54 | 54 | */ |
55 | -class SelectStatement extends BaseStatement |
|
56 | -{ |
|
55 | +class SelectStatement extends BaseStatement { |
|
57 | 56 | /** |
58 | 57 | * @var HavingStatement |
59 | 58 | */ |
@@ -64,8 +63,7 @@ discard block |
||
64 | 63 | * @param string|array<int, string> $tables |
65 | 64 | * @param QueryStatement|null $queryStatement |
66 | 65 | */ |
67 | - public function __construct($tables, QueryStatement $queryStatement = null) |
|
68 | - { |
|
66 | + public function __construct($tables, QueryStatement $queryStatement = null) { |
|
69 | 67 | parent::__construct($queryStatement); |
70 | 68 | |
71 | 69 | if (!is_array($tables)) { |
@@ -178,8 +176,7 @@ discard block |
||
178 | 176 | * @param string|Expression|Closure|string[]|Expression[]|Closure[] $columns |
179 | 177 | * @return mixed |
180 | 178 | */ |
181 | - public function select($columns = []) |
|
182 | - { |
|
179 | + public function select($columns = []) { |
|
183 | 180 | $expr = new ColumnExpression($this->queryStatement); |
184 | 181 | |
185 | 182 | if ($columns instanceof Closure) { |
@@ -196,8 +193,7 @@ discard block |
||
196 | 193 | * @param string|Expression|Closure $name |
197 | 194 | * @return mixed |
198 | 195 | */ |
199 | - public function column($name) |
|
200 | - { |
|
196 | + public function column($name) { |
|
201 | 197 | (new ColumnExpression($this->queryStatement))->column($name); |
202 | 198 | } |
203 | 199 | |
@@ -206,8 +202,7 @@ discard block |
||
206 | 202 | * @param bool $distinct |
207 | 203 | * @return mixed |
208 | 204 | */ |
209 | - public function count($column = '*', bool $distinct = false) |
|
210 | - { |
|
205 | + public function count($column = '*', bool $distinct = false) { |
|
211 | 206 | (new ColumnExpression($this->queryStatement))->count($column, null, $distinct); |
212 | 207 | } |
213 | 208 | |
@@ -216,8 +211,7 @@ discard block |
||
216 | 211 | * @param bool $distinct |
217 | 212 | * @return mixed |
218 | 213 | */ |
219 | - public function avg($column, bool $distinct = false) |
|
220 | - { |
|
214 | + public function avg($column, bool $distinct = false) { |
|
221 | 215 | (new ColumnExpression($this->queryStatement))->avg($column, null, $distinct); |
222 | 216 | } |
223 | 217 | |
@@ -226,8 +220,7 @@ discard block |
||
226 | 220 | * @param bool $distinct |
227 | 221 | * @return mixed |
228 | 222 | */ |
229 | - public function sum($column, bool $distinct = false) |
|
230 | - { |
|
223 | + public function sum($column, bool $distinct = false) { |
|
231 | 224 | (new ColumnExpression($this->queryStatement))->sum($column, null, $distinct); |
232 | 225 | } |
233 | 226 | |
@@ -236,8 +229,7 @@ discard block |
||
236 | 229 | * @param bool $distinct |
237 | 230 | * @return mixed |
238 | 231 | */ |
239 | - public function min($column, bool $distinct = false) |
|
240 | - { |
|
232 | + public function min($column, bool $distinct = false) { |
|
241 | 233 | (new ColumnExpression($this->queryStatement))->min($column, null, $distinct); |
242 | 234 | } |
243 | 235 | |
@@ -246,16 +238,14 @@ discard block |
||
246 | 238 | * @param bool $distinct |
247 | 239 | * @return mixed |
248 | 240 | */ |
249 | - public function max($column, bool $distinct = false) |
|
250 | - { |
|
241 | + public function max($column, bool $distinct = false) { |
|
251 | 242 | (new ColumnExpression($this->queryStatement))->max($column, null, $distinct); |
252 | 243 | } |
253 | 244 | |
254 | 245 | /** |
255 | 246 | * @inheritDoc |
256 | 247 | */ |
257 | - public function __clone() |
|
258 | - { |
|
248 | + public function __clone() { |
|
259 | 249 | parent::__clone(); |
260 | 250 | $this->havingStatement = new HavingStatement($this->queryStatement); |
261 | 251 | } |
@@ -50,8 +50,7 @@ discard block |
||
50 | 50 | * Class UpdateStatement |
51 | 51 | * @package Platine\Database\Query |
52 | 52 | */ |
53 | -class UpdateStatement extends BaseStatement |
|
54 | -{ |
|
53 | +class UpdateStatement extends BaseStatement { |
|
55 | 54 | /** |
56 | 55 | * The Query statement instance |
57 | 56 | * @var QueryStatement |
@@ -63,8 +62,7 @@ discard block |
||
63 | 62 | * @param string|array<int, string> $table |
64 | 63 | * @param QueryStatement|null $queryStatement |
65 | 64 | */ |
66 | - public function __construct($table, QueryStatement $queryStatement = null) |
|
67 | - { |
|
65 | + public function __construct($table, QueryStatement $queryStatement = null) { |
|
68 | 66 | parent::__construct($queryStatement); |
69 | 67 | |
70 | 68 | if (!is_array($table)) { |
@@ -79,8 +77,7 @@ discard block |
||
79 | 77 | * |
80 | 78 | * @return void |
81 | 79 | */ |
82 | - public function set(array $columns) |
|
83 | - { |
|
80 | + public function set(array $columns) { |
|
84 | 81 | $this->queryStatement->addUpdateColumns($columns); |
85 | 82 | } |
86 | 83 | } |
@@ -52,8 +52,7 @@ |
||
52 | 52 | * Class Expression |
53 | 53 | * @package Platine\Database\Query |
54 | 54 | */ |
55 | -class Expression |
|
56 | -{ |
|
55 | +class Expression { |
|
57 | 56 | /** |
58 | 57 | * The list of expression |
59 | 58 | * @var array<int, array<string, mixed>> |
@@ -52,8 +52,7 @@ discard block |
||
52 | 52 | * Class Insert |
53 | 53 | * @package Platine\Database\Query |
54 | 54 | */ |
55 | -class Insert extends InsertStatement |
|
56 | -{ |
|
55 | +class Insert extends InsertStatement { |
|
57 | 56 | /** |
58 | 57 | * @var Connection |
59 | 58 | */ |
@@ -64,8 +63,7 @@ discard block |
||
64 | 63 | * @param Connection $connection |
65 | 64 | * @param QueryStatement|null $queryStatement |
66 | 65 | */ |
67 | - public function __construct(Connection $connection, QueryStatement $queryStatement = null) |
|
68 | - { |
|
66 | + public function __construct(Connection $connection, QueryStatement $queryStatement = null) { |
|
69 | 67 | parent::__construct($queryStatement); |
70 | 68 | |
71 | 69 | $this->connection = $connection; |
@@ -50,8 +50,7 @@ discard block |
||
50 | 50 | * Class InsertStatement |
51 | 51 | * @package Platine\Database\Query |
52 | 52 | */ |
53 | -class InsertStatement |
|
54 | -{ |
|
53 | +class InsertStatement { |
|
55 | 54 | /** |
56 | 55 | * The Query statement instance |
57 | 56 | * @var QueryStatement |
@@ -62,8 +61,7 @@ discard block |
||
62 | 61 | * InsertStatement constructor. |
63 | 62 | * @param QueryStatement|null $queryStatement |
64 | 63 | */ |
65 | - public function __construct(QueryStatement $queryStatement = null) |
|
66 | - { |
|
64 | + public function __construct(QueryStatement $queryStatement = null) { |
|
67 | 65 | if ($queryStatement === null) { |
68 | 66 | $queryStatement = new QueryStatement(); |
69 | 67 | } |
@@ -98,16 +96,14 @@ discard block |
||
98 | 96 | * @param string $table |
99 | 97 | * @return mixed |
100 | 98 | */ |
101 | - public function into(string $table) |
|
102 | - { |
|
99 | + public function into(string $table) { |
|
103 | 100 | $this->queryStatement->addTables([$table]); |
104 | 101 | } |
105 | 102 | |
106 | 103 | /** |
107 | 104 | * @inheritDoc |
108 | 105 | */ |
109 | - public function __clone() |
|
110 | - { |
|
106 | + public function __clone() { |
|
111 | 107 | $this->queryStatement = clone $this->queryStatement; |
112 | 108 | } |
113 | 109 | } |
@@ -52,8 +52,7 @@ discard block |
||
52 | 52 | * Class Where |
53 | 53 | * @package Platine\Database\Query |
54 | 54 | */ |
55 | -class Where |
|
56 | -{ |
|
55 | +class Where { |
|
57 | 56 | /** |
58 | 57 | * @var string|Expression |
59 | 58 | */ |
@@ -270,8 +269,7 @@ discard block |
||
270 | 269 | /** |
271 | 270 | * @inheritDoc |
272 | 271 | */ |
273 | - public function __clone() |
|
274 | - { |
|
272 | + public function __clone() { |
|
275 | 273 | if ($this->column instanceof Expression) { |
276 | 274 | $this->column = clone $this->column; |
277 | 275 | } |
@@ -52,8 +52,7 @@ discard block |
||
52 | 52 | * Class ColumnExpression |
53 | 53 | * @package Platine\Database\Query |
54 | 54 | */ |
55 | -class ColumnExpression |
|
56 | -{ |
|
55 | +class ColumnExpression { |
|
57 | 56 | /** |
58 | 57 | * The Query statement instance |
59 | 58 | * @var QueryStatement |
@@ -64,8 +63,7 @@ discard block |
||
64 | 63 | * ColumnExpression constructor. |
65 | 64 | * @param QueryStatement $queryStatement |
66 | 65 | */ |
67 | - public function __construct(QueryStatement $queryStatement) |
|
68 | - { |
|
66 | + public function __construct(QueryStatement $queryStatement) { |
|
69 | 67 | $this->queryStatement = $queryStatement; |
70 | 68 | } |
71 | 69 | |
@@ -159,8 +157,7 @@ discard block |
||
159 | 157 | return $this->column((new Expression())->max($column, $distinct), $alias); |
160 | 158 | } |
161 | 159 | |
162 | - public function __clone() |
|
163 | - { |
|
160 | + public function __clone() { |
|
164 | 161 | $this->queryStatement = clone $this->queryStatement; |
165 | 162 | } |
166 | 163 | } |
@@ -53,8 +53,7 @@ discard block |
||
53 | 53 | * Class Delete |
54 | 54 | * @package Platine\Database\Query |
55 | 55 | */ |
56 | -class Delete extends DeleteStatement |
|
57 | -{ |
|
56 | +class Delete extends DeleteStatement { |
|
58 | 57 | /** |
59 | 58 | * @var Connection |
60 | 59 | */ |
@@ -66,8 +65,7 @@ discard block |
||
66 | 65 | * @param string|array<string> $from |
67 | 66 | * @param QueryStatement|null $queryStatement |
68 | 67 | */ |
69 | - public function __construct(Connection $connection, $from, QueryStatement $queryStatement = null) |
|
70 | - { |
|
68 | + public function __construct(Connection $connection, $from, QueryStatement $queryStatement = null) { |
|
71 | 69 | parent::__construct($from, $queryStatement); |
72 | 70 | |
73 | 71 | $this->connection = $connection; |
@@ -54,8 +54,7 @@ discard block |
||
54 | 54 | * Class Query |
55 | 55 | * @package Platine\Database\Query |
56 | 56 | */ |
57 | -class Query extends BaseStatement |
|
58 | -{ |
|
57 | +class Query extends BaseStatement { |
|
59 | 58 | /** |
60 | 59 | * @var Connection |
61 | 60 | */ |
@@ -88,8 +87,7 @@ discard block |
||
88 | 87 | * |
89 | 88 | * @return Select|SelectStatement |
90 | 89 | */ |
91 | - public function distinct(bool $value = true) |
|
92 | - { |
|
90 | + public function distinct(bool $value = true) { |
|
93 | 91 | return $this->buildSelect()->distinct($value); |
94 | 92 | } |
95 | 93 | |
@@ -98,8 +96,7 @@ discard block |
||
98 | 96 | * |
99 | 97 | * @return Select|SelectStatement |
100 | 98 | */ |
101 | - public function groupBy($columns) |
|
102 | - { |
|
99 | + public function groupBy($columns) { |
|
103 | 100 | return $this->buildSelect()->groupBy($columns); |
104 | 101 | } |
105 | 102 | |
@@ -109,8 +106,7 @@ discard block |
||
109 | 106 | * |
110 | 107 | * @return Select|SelectStatement |
111 | 108 | */ |
112 | - public function having($column, Closure $value = null) |
|
113 | - { |
|
109 | + public function having($column, Closure $value = null) { |
|
114 | 110 | return $this->buildSelect()->having($column, $value); |
115 | 111 | } |
116 | 112 | |
@@ -120,8 +116,7 @@ discard block |
||
120 | 116 | * |
121 | 117 | * @return Select|SelectStatement |
122 | 118 | */ |
123 | - public function orHaving($column, Closure $value = null) |
|
124 | - { |
|
119 | + public function orHaving($column, Closure $value = null) { |
|
125 | 120 | return $this->buildSelect()->orHaving($column, $value); |
126 | 121 | } |
127 | 122 | |
@@ -131,8 +126,7 @@ discard block |
||
131 | 126 | * |
132 | 127 | * @return Select|SelectStatement |
133 | 128 | */ |
134 | - public function orderBy($columns, string $order = 'ASC') |
|
135 | - { |
|
129 | + public function orderBy($columns, string $order = 'ASC') { |
|
136 | 130 | return $this->buildSelect()->orderBy($columns, $order); |
137 | 131 | } |
138 | 132 | |
@@ -141,8 +135,7 @@ discard block |
||
141 | 135 | * |
142 | 136 | * @return Select|SelectStatement |
143 | 137 | */ |
144 | - public function limit(int $value) |
|
145 | - { |
|
138 | + public function limit(int $value) { |
|
146 | 139 | return $this->buildSelect()->limit($value); |
147 | 140 | } |
148 | 141 | |
@@ -151,8 +144,7 @@ discard block |
||
151 | 144 | * |
152 | 145 | * @return Select|SelectStatement |
153 | 146 | */ |
154 | - public function offset(int $value) |
|
155 | - { |
|
147 | + public function offset(int $value) { |
|
156 | 148 | return $this->buildSelect()->offset($value); |
157 | 149 | } |
158 | 150 | |
@@ -160,8 +152,7 @@ discard block |
||
160 | 152 | * @param string $table |
161 | 153 | * @return Select|SelectStatement |
162 | 154 | */ |
163 | - public function into(string $table) |
|
164 | - { |
|
155 | + public function into(string $table) { |
|
165 | 156 | return $this->buildSelect()->into($table); |
166 | 157 | } |
167 | 158 | |
@@ -170,8 +161,7 @@ discard block |
||
170 | 161 | * |
171 | 162 | * @return ResultSet |
172 | 163 | */ |
173 | - public function select($columns = []) |
|
174 | - { |
|
164 | + public function select($columns = []) { |
|
175 | 165 | return $this->buildSelect()->select($columns); |
176 | 166 | } |
177 | 167 | |
@@ -189,8 +179,7 @@ discard block |
||
189 | 179 | * |
190 | 180 | * @return mixed |
191 | 181 | */ |
192 | - public function column($name) |
|
193 | - { |
|
182 | + public function column($name) { |
|
194 | 183 | return $this->buildSelect()->column($name); |
195 | 184 | } |
196 | 185 | |
@@ -211,8 +200,7 @@ discard block |
||
211 | 200 | * |
212 | 201 | * @return int|float |
213 | 202 | */ |
214 | - public function avg($column, bool $distinct = false) |
|
215 | - { |
|
203 | + public function avg($column, bool $distinct = false) { |
|
216 | 204 | return $this->buildSelect()->avg($column, $distinct); |
217 | 205 | } |
218 | 206 | |
@@ -222,8 +210,7 @@ discard block |
||
222 | 210 | * |
223 | 211 | * @return int|float |
224 | 212 | */ |
225 | - public function sum($column, bool $distinct = false) |
|
226 | - { |
|
213 | + public function sum($column, bool $distinct = false) { |
|
227 | 214 | return $this->buildSelect()->sum($column, $distinct); |
228 | 215 | } |
229 | 216 | |
@@ -233,8 +220,7 @@ discard block |
||
233 | 220 | * |
234 | 221 | * @return mixed |
235 | 222 | */ |
236 | - public function min($column, bool $distinct = false) |
|
237 | - { |
|
223 | + public function min($column, bool $distinct = false) { |
|
238 | 224 | return $this->buildSelect()->min($column, $distinct); |
239 | 225 | } |
240 | 226 | |
@@ -244,8 +230,7 @@ discard block |
||
244 | 230 | * |
245 | 231 | * @return mixed |
246 | 232 | */ |
247 | - public function max($column, bool $distinct = false) |
|
248 | - { |
|
233 | + public function max($column, bool $distinct = false) { |
|
249 | 234 | return $this->buildSelect()->max($column, $distinct); |
250 | 235 | } |
251 | 236 |