@@ -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 | } |
@@ -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; |
@@ -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 SubQuery |
| 51 | 51 | * @package Platine\Database\Query |
| 52 | 52 | */ |
| 53 | -class SubQuery |
|
| 54 | -{ |
|
| 53 | +class SubQuery { |
|
| 55 | 54 | /** |
| 56 | 55 | * The SelectStatement instance |
| 57 | 56 | * @var SelectStatement |
@@ -78,8 +77,7 @@ discard block |
||
| 78 | 77 | /** |
| 79 | 78 | * @inheritDoc |
| 80 | 79 | */ |
| 81 | - public function __clone() |
|
| 82 | - { |
|
| 80 | + public function __clone() { |
|
| 83 | 81 | $this->select = clone $this->select; |
| 84 | 82 | } |
| 85 | 83 | } |
@@ -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( |
@@ -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; |