@@ -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 Having |
53 | 53 | * @package Platine\Database\Query |
54 | 54 | */ |
55 | -class Having |
|
56 | -{ |
|
55 | +class Having { |
|
57 | 56 | /** |
58 | 57 | * @var string|Expression |
59 | 58 | */ |
@@ -74,8 +73,7 @@ discard block |
||
74 | 73 | * Having constructor. |
75 | 74 | * @param QueryStatement $queryStatement |
76 | 75 | */ |
77 | - public function __construct(QueryStatement $queryStatement) |
|
78 | - { |
|
76 | + public function __construct(QueryStatement $queryStatement) { |
|
79 | 77 | $this->queryStatement = $queryStatement; |
80 | 78 | } |
81 | 79 | |
@@ -238,8 +236,7 @@ discard block |
||
238 | 236 | /** |
239 | 237 | * @inheritDoc |
240 | 238 | */ |
241 | - public function __clone() |
|
242 | - { |
|
239 | + public function __clone() { |
|
243 | 240 | if ($this->aggregate instanceof Expression) { |
244 | 241 | $this->aggregate = clone $this->aggregate; |
245 | 242 | } |
@@ -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 Join |
53 | 53 | * @package Platine\Database\Query |
54 | 54 | */ |
55 | -class Join |
|
56 | -{ |
|
55 | +class Join { |
|
57 | 56 | /** |
58 | 57 | * The Join conditions |
59 | 58 | * @var array<int, mixed> |
@@ -54,8 +54,7 @@ discard block |
||
54 | 54 | * @class Select |
55 | 55 | * @package Platine\Database\Query |
56 | 56 | */ |
57 | -class Select extends SelectStatement |
|
58 | -{ |
|
57 | +class Select extends SelectStatement { |
|
59 | 58 | /** |
60 | 59 | * @var Connection |
61 | 60 | */ |
@@ -81,8 +80,7 @@ discard block |
||
81 | 80 | * |
82 | 81 | * @return ResultSet |
83 | 82 | */ |
84 | - public function select($columns = []) |
|
85 | - { |
|
83 | + public function select($columns = []) { |
|
86 | 84 | parent::select($columns); |
87 | 85 | $driver = $this->connection->getDriver(); |
88 | 86 | |
@@ -97,8 +95,7 @@ discard block |
||
97 | 95 | * |
98 | 96 | * @return mixed|false |
99 | 97 | */ |
100 | - public function column($name) |
|
101 | - { |
|
98 | + public function column($name) { |
|
102 | 99 | parent::column($name); |
103 | 100 | return $this->getColumnResult(); |
104 | 101 | } |
@@ -121,8 +118,7 @@ discard block |
||
121 | 118 | * |
122 | 119 | * @return int|float |
123 | 120 | */ |
124 | - public function avg($column, bool $distinct = false) |
|
125 | - { |
|
121 | + public function avg($column, bool $distinct = false) { |
|
126 | 122 | parent::avg($column, $distinct); |
127 | 123 | return $this->getColumnResult(); |
128 | 124 | } |
@@ -133,8 +129,7 @@ discard block |
||
133 | 129 | * |
134 | 130 | * @return int|float |
135 | 131 | */ |
136 | - public function sum($column, bool $distinct = false) |
|
137 | - { |
|
132 | + public function sum($column, bool $distinct = false) { |
|
138 | 133 | parent::sum($column, $distinct); |
139 | 134 | return $this->getColumnResult(); |
140 | 135 | } |
@@ -145,8 +140,7 @@ discard block |
||
145 | 140 | * |
146 | 141 | * @return int|float |
147 | 142 | */ |
148 | - public function min($column, bool $distinct = false) |
|
149 | - { |
|
143 | + public function min($column, bool $distinct = false) { |
|
150 | 144 | parent::min($column, $distinct); |
151 | 145 | return $this->getColumnResult(); |
152 | 146 | } |
@@ -157,8 +151,7 @@ discard block |
||
157 | 151 | * |
158 | 152 | * @return int|float |
159 | 153 | */ |
160 | - public function max($column, bool $distinct = false) |
|
161 | - { |
|
154 | + public function max($column, bool $distinct = false) { |
|
162 | 155 | parent::max($column, $distinct); |
163 | 156 | return $this->getColumnResult(); |
164 | 157 | } |
@@ -167,8 +160,7 @@ discard block |
||
167 | 160 | * Return the result set for column |
168 | 161 | * @return mixed |
169 | 162 | */ |
170 | - protected function getColumnResult() |
|
171 | - { |
|
163 | + protected function getColumnResult() { |
|
172 | 164 | $driver = $this->connection->getDriver(); |
173 | 165 | |
174 | 166 | return $this->connection->column( |
@@ -55,8 +55,7 @@ discard block |
||
55 | 55 | * @class HavingExpression |
56 | 56 | * @package Platine\Database\Query |
57 | 57 | */ |
58 | -class HavingExpression |
|
59 | -{ |
|
58 | +class HavingExpression { |
|
60 | 59 | /** |
61 | 60 | * The Query statement instance |
62 | 61 | * @var QueryStatement |
@@ -83,8 +82,7 @@ discard block |
||
83 | 82 | * HavingExpression constructor. |
84 | 83 | * @param QueryStatement $queryStatement |
85 | 84 | */ |
86 | - public function __construct(QueryStatement $queryStatement) |
|
87 | - { |
|
85 | + public function __construct(QueryStatement $queryStatement) { |
|
88 | 86 | $this->queryStatement = $queryStatement; |
89 | 87 | |
90 | 88 | $this->having = new Having($queryStatement); |
@@ -164,8 +162,7 @@ discard block |
||
164 | 162 | /** |
165 | 163 | * @inheritDoc |
166 | 164 | */ |
167 | - public function __clone() |
|
168 | - { |
|
165 | + public function __clone() { |
|
169 | 166 | if ($this->column instanceof Expression) { |
170 | 167 | $this->column = clone $this->column; |
171 | 168 | } |
@@ -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 |
@@ -52,16 +52,14 @@ discard block |
||
52 | 52 | * @class BaseStatement |
53 | 53 | * @package Platine\Database\Query |
54 | 54 | */ |
55 | -class BaseStatement extends WhereStatement |
|
56 | -{ |
|
55 | +class BaseStatement extends WhereStatement { |
|
57 | 56 | /** |
58 | 57 | * @param string|string[] $table |
59 | 58 | * @param Closure $closure |
60 | 59 | * |
61 | 60 | * @return Delete|Select|BaseStatement |
62 | 61 | */ |
63 | - public function join($table, Closure $closure) |
|
64 | - { |
|
62 | + public function join($table, Closure $closure) { |
|
65 | 63 | $this->queryStatement->addJoinClause('INNER', $table, $closure); |
66 | 64 | |
67 | 65 | return $this; |
@@ -73,8 +71,7 @@ discard block |
||
73 | 71 | * |
74 | 72 | * @return Delete|Select|BaseStatement |
75 | 73 | */ |
76 | - public function leftJoin($table, Closure $closure) |
|
77 | - { |
|
74 | + public function leftJoin($table, Closure $closure) { |
|
78 | 75 | $this->queryStatement->addJoinClause('LEFT', $table, $closure); |
79 | 76 | |
80 | 77 | return $this; |
@@ -86,8 +83,7 @@ discard block |
||
86 | 83 | * |
87 | 84 | * @return Delete|Select|BaseStatement |
88 | 85 | */ |
89 | - public function rightJoin($table, Closure $closure) |
|
90 | - { |
|
86 | + public function rightJoin($table, Closure $closure) { |
|
91 | 87 | $this->queryStatement->addJoinClause('RIGHT', $table, $closure); |
92 | 88 | |
93 | 89 | return $this; |
@@ -99,8 +95,7 @@ discard block |
||
99 | 95 | * |
100 | 96 | * @return Delete|Select|BaseStatement |
101 | 97 | */ |
102 | - public function fullJoin($table, Closure $closure) |
|
103 | - { |
|
98 | + public function fullJoin($table, Closure $closure) { |
|
104 | 99 | $this->queryStatement->addJoinClause('FULL', $table, $closure); |
105 | 100 | |
106 | 101 | return $this; |
@@ -112,8 +107,7 @@ discard block |
||
112 | 107 | * |
113 | 108 | * @return Delete|Select|BaseStatement |
114 | 109 | */ |
115 | - public function crossJoin($table, Closure $closure) |
|
116 | - { |
|
110 | + public function crossJoin($table, Closure $closure) { |
|
117 | 111 | $this->queryStatement->addJoinClause('CROSS', $table, $closure); |
118 | 112 | |
119 | 113 | return $this; |
@@ -50,15 +50,13 @@ discard block |
||
50 | 50 | * @class DeleteStatement |
51 | 51 | * @package Platine\Database\Query |
52 | 52 | */ |
53 | -class DeleteStatement extends BaseStatement |
|
54 | -{ |
|
53 | +class DeleteStatement extends BaseStatement { |
|
55 | 54 | /** |
56 | 55 | * DeleteStatement constructor. |
57 | 56 | * @param string|array<string> $from |
58 | 57 | * @param QueryStatement|null $queryStatement |
59 | 58 | */ |
60 | - public function __construct($from, QueryStatement $queryStatement = null) |
|
61 | - { |
|
59 | + public function __construct($from, QueryStatement $queryStatement = null) { |
|
62 | 60 | parent::__construct($queryStatement); |
63 | 61 | |
64 | 62 | if (!is_array($from)) { |
@@ -72,8 +70,7 @@ discard block |
||
72 | 70 | * @param string|array<string> $tables |
73 | 71 | * @return mixed |
74 | 72 | */ |
75 | - public function delete($tables = []) |
|
76 | - { |
|
73 | + public function delete($tables = []) { |
|
77 | 74 | if (!is_array($tables)) { |
78 | 75 | /** @var array<string> $tables */ |
79 | 76 | $tables = [$tables]; |