@@ -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 | /** |
| 60 | 59 | * @var Connection |
@@ -67,8 +66,7 @@ discard block |
||
| 67 | 66 | * @param string|array<string> $from |
| 68 | 67 | * @param QueryStatement|null $queryStatement |
| 69 | 68 | */ |
| 70 | - public function __construct(Connection $connection, $from, QueryStatement $queryStatement = null) |
|
| 71 | - { |
|
| 69 | + public function __construct(Connection $connection, $from, QueryStatement $queryStatement = null) { |
|
| 72 | 70 | parent::__construct($from, $queryStatement); |
| 73 | 71 | |
| 74 | 72 | $this->connection = $connection; |
@@ -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 | /** |
| 61 | 60 | * @var Connection |
@@ -82,8 +81,7 @@ discard block |
||
| 82 | 81 | * |
| 83 | 82 | * @return ResultSet |
| 84 | 83 | */ |
| 85 | - public function select($columns = []) |
|
| 86 | - { |
|
| 84 | + public function select($columns = []) { |
|
| 87 | 85 | parent::select($columns); |
| 88 | 86 | $driver = $this->connection->getDriver(); |
| 89 | 87 | |
@@ -98,8 +96,7 @@ discard block |
||
| 98 | 96 | * |
| 99 | 97 | * @return mixed|false |
| 100 | 98 | */ |
| 101 | - public function column($name) |
|
| 102 | - { |
|
| 99 | + public function column($name) { |
|
| 103 | 100 | parent::column($name); |
| 104 | 101 | return $this->getColumnResultSet(); |
| 105 | 102 | } |
@@ -122,8 +119,7 @@ discard block |
||
| 122 | 119 | * |
| 123 | 120 | * @return int|float |
| 124 | 121 | */ |
| 125 | - public function avg($column, bool $distinct = false) |
|
| 126 | - { |
|
| 122 | + public function avg($column, bool $distinct = false) { |
|
| 127 | 123 | parent::avg($column, $distinct); |
| 128 | 124 | return $this->getColumnResultSet(); |
| 129 | 125 | } |
@@ -134,8 +130,7 @@ discard block |
||
| 134 | 130 | * |
| 135 | 131 | * @return int|float |
| 136 | 132 | */ |
| 137 | - public function sum($column, bool $distinct = false) |
|
| 138 | - { |
|
| 133 | + public function sum($column, bool $distinct = false) { |
|
| 139 | 134 | parent::sum($column, $distinct); |
| 140 | 135 | return $this->getColumnResultSet(); |
| 141 | 136 | } |
@@ -146,8 +141,7 @@ discard block |
||
| 146 | 141 | * |
| 147 | 142 | * @return int|float |
| 148 | 143 | */ |
| 149 | - public function min($column, bool $distinct = false) |
|
| 150 | - { |
|
| 144 | + public function min($column, bool $distinct = false) { |
|
| 151 | 145 | parent::min($column, $distinct); |
| 152 | 146 | return $this->getColumnResultSet(); |
| 153 | 147 | } |
@@ -158,8 +152,7 @@ discard block |
||
| 158 | 152 | * |
| 159 | 153 | * @return int|float |
| 160 | 154 | */ |
| 161 | - public function max($column, bool $distinct = false) |
|
| 162 | - { |
|
| 155 | + public function max($column, bool $distinct = false) { |
|
| 163 | 156 | parent::max($column, $distinct); |
| 164 | 157 | return $this->getColumnResultSet(); |
| 165 | 158 | } |
@@ -168,8 +161,7 @@ discard block |
||
| 168 | 161 | * Return the result set for column |
| 169 | 162 | * @return mixed |
| 170 | 163 | */ |
| 171 | - protected function getColumnResultSet() |
|
| 172 | - { |
|
| 164 | + protected function getColumnResultSet() { |
|
| 173 | 165 | $driver = $this->connection->getDriver(); |
| 174 | 166 | |
| 175 | 167 | return $this->connection->column( |
@@ -52,8 +52,7 @@ discard block |
||
| 52 | 52 | * Class Update |
| 53 | 53 | * @package Platine\Database\Query |
| 54 | 54 | */ |
| 55 | -class Update extends UpdateStatement |
|
| 56 | -{ |
|
| 55 | +class Update extends UpdateStatement { |
|
| 57 | 56 | |
| 58 | 57 | /** |
| 59 | 58 | * @var Connection |
@@ -66,8 +65,7 @@ discard block |
||
| 66 | 65 | * @param string|array<int, string> $table |
| 67 | 66 | * @param QueryStatement|null $queryStatement |
| 68 | 67 | */ |
| 69 | - public function __construct(Connection $connection, $table, QueryStatement $queryStatement = null) |
|
| 70 | - { |
|
| 68 | + public function __construct(Connection $connection, $table, QueryStatement $queryStatement = null) { |
|
| 71 | 69 | parent::__construct($table, $queryStatement); |
| 72 | 70 | |
| 73 | 71 | $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 | /** |
| 57 | 56 | * The Query statement instance |
@@ -63,8 +62,7 @@ discard block |
||
| 63 | 62 | * InsertStatement constructor. |
| 64 | 63 | * @param QueryStatement|null $queryStatement |
| 65 | 64 | */ |
| 66 | - public function __construct(QueryStatement $queryStatement = null) |
|
| 67 | - { |
|
| 65 | + public function __construct(QueryStatement $queryStatement = null) { |
|
| 68 | 66 | if ($queryStatement === null) { |
| 69 | 67 | $queryStatement = new QueryStatement(); |
| 70 | 68 | } |
@@ -99,16 +97,14 @@ discard block |
||
| 99 | 97 | * @param string $table |
| 100 | 98 | * @return mixed |
| 101 | 99 | */ |
| 102 | - public function into(string $table) |
|
| 103 | - { |
|
| 100 | + public function into(string $table) { |
|
| 104 | 101 | $this->queryStatement->addTables([$table]); |
| 105 | 102 | } |
| 106 | 103 | |
| 107 | 104 | /** |
| 108 | 105 | * @inheritDoc |
| 109 | 106 | */ |
| 110 | - public function __clone() |
|
| 111 | - { |
|
| 107 | + public function __clone() { |
|
| 112 | 108 | $this->queryStatement = clone $this->queryStatement; |
| 113 | 109 | } |
| 114 | 110 | } |
@@ -53,8 +53,7 @@ discard block |
||
| 53 | 53 | * |
| 54 | 54 | * @package Platine\Database\Query |
| 55 | 55 | */ |
| 56 | -class QueryStatement |
|
| 57 | -{ |
|
| 56 | +class QueryStatement { |
|
| 58 | 57 | |
| 59 | 58 | /** |
| 60 | 59 | * The where SQL parts |
@@ -349,8 +348,7 @@ discard block |
||
| 349 | 348 | * @param bool $not |
| 350 | 349 | * @return mixed |
| 351 | 350 | */ |
| 352 | - public function addHavingIn($aggregate, $value, string $separator, bool $not) |
|
| 353 | - { |
|
| 351 | + public function addHavingIn($aggregate, $value, string $separator, bool $not) { |
|
| 354 | 352 | $aggregate = $this->closureToExpression($aggregate); |
| 355 | 353 | |
| 356 | 354 | if ($value instanceof Closure) { |
@@ -618,8 +616,7 @@ discard block |
||
| 618 | 616 | * |
| 619 | 617 | * @return mixed|Expression |
| 620 | 618 | */ |
| 621 | - protected function closureToExpression($value) |
|
| 622 | - { |
|
| 619 | + protected function closureToExpression($value) { |
|
| 623 | 620 | if ($value instanceof Closure) { |
| 624 | 621 | return Expression::fromClosure($value); |
| 625 | 622 | } |
@@ -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 | /** |
| 57 | 56 | * The Query statement instance |
@@ -64,8 +63,7 @@ discard block |
||
| 64 | 63 | * @param string|array<int, string> $table |
| 65 | 64 | * @param QueryStatement|null $queryStatement |
| 66 | 65 | */ |
| 67 | - public function __construct($table, QueryStatement $queryStatement = null) |
|
| 68 | - { |
|
| 66 | + public function __construct($table, QueryStatement $queryStatement = null) { |
|
| 69 | 67 | parent::__construct($queryStatement); |
| 70 | 68 | |
| 71 | 69 | if (!is_array($table)) { |
@@ -80,8 +78,7 @@ discard block |
||
| 80 | 78 | * |
| 81 | 79 | * @return void |
| 82 | 80 | */ |
| 83 | - public function set(array $columns) |
|
| 84 | - { |
|
| 81 | + public function set(array $columns) { |
|
| 85 | 82 | $this->queryStatement->addUpdateColumns($columns); |
| 86 | 83 | } |
| 87 | 84 | } |
@@ -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 | /** |
| 59 | 58 | * @var HavingStatement |
@@ -65,8 +64,7 @@ discard block |
||
| 65 | 64 | * @param string|array<int, string> $tables |
| 66 | 65 | * @param QueryStatement|null $queryStatement |
| 67 | 66 | */ |
| 68 | - public function __construct($tables, QueryStatement $queryStatement = null) |
|
| 69 | - { |
|
| 67 | + public function __construct($tables, QueryStatement $queryStatement = null) { |
|
| 70 | 68 | parent::__construct($queryStatement); |
| 71 | 69 | |
| 72 | 70 | if (!is_array($tables)) { |
@@ -179,8 +177,7 @@ discard block |
||
| 179 | 177 | * @param string|Expression|Closure|string[]|Expression[]|Closure[] $columns |
| 180 | 178 | * @return mixed |
| 181 | 179 | */ |
| 182 | - public function select($columns = []) |
|
| 183 | - { |
|
| 180 | + public function select($columns = []) { |
|
| 184 | 181 | $expr = new ColumnExpression($this->queryStatement); |
| 185 | 182 | |
| 186 | 183 | if ($columns instanceof Closure) { |
@@ -197,8 +194,7 @@ discard block |
||
| 197 | 194 | * @param string|Expression|Closure $name |
| 198 | 195 | * @return mixed |
| 199 | 196 | */ |
| 200 | - public function column($name) |
|
| 201 | - { |
|
| 197 | + public function column($name) { |
|
| 202 | 198 | (new ColumnExpression($this->queryStatement))->column($name); |
| 203 | 199 | } |
| 204 | 200 | |
@@ -207,8 +203,7 @@ discard block |
||
| 207 | 203 | * @param bool $distinct |
| 208 | 204 | * @return mixed |
| 209 | 205 | */ |
| 210 | - public function count($column = '*', bool $distinct = false) |
|
| 211 | - { |
|
| 206 | + public function count($column = '*', bool $distinct = false) { |
|
| 212 | 207 | (new ColumnExpression($this->queryStatement))->count($column, null, $distinct); |
| 213 | 208 | } |
| 214 | 209 | |
@@ -217,8 +212,7 @@ discard block |
||
| 217 | 212 | * @param bool $distinct |
| 218 | 213 | * @return mixed |
| 219 | 214 | */ |
| 220 | - public function avg($column, bool $distinct = false) |
|
| 221 | - { |
|
| 215 | + public function avg($column, bool $distinct = false) { |
|
| 222 | 216 | (new ColumnExpression($this->queryStatement))->avg($column, null, $distinct); |
| 223 | 217 | } |
| 224 | 218 | |
@@ -227,8 +221,7 @@ discard block |
||
| 227 | 221 | * @param bool $distinct |
| 228 | 222 | * @return mixed |
| 229 | 223 | */ |
| 230 | - public function sum($column, bool $distinct = false) |
|
| 231 | - { |
|
| 224 | + public function sum($column, bool $distinct = false) { |
|
| 232 | 225 | (new ColumnExpression($this->queryStatement))->sum($column, null, $distinct); |
| 233 | 226 | } |
| 234 | 227 | |
@@ -237,8 +230,7 @@ discard block |
||
| 237 | 230 | * @param bool $distinct |
| 238 | 231 | * @return mixed |
| 239 | 232 | */ |
| 240 | - public function min($column, bool $distinct = false) |
|
| 241 | - { |
|
| 233 | + public function min($column, bool $distinct = false) { |
|
| 242 | 234 | (new ColumnExpression($this->queryStatement))->min($column, null, $distinct); |
| 243 | 235 | } |
| 244 | 236 | |
@@ -247,16 +239,14 @@ discard block |
||
| 247 | 239 | * @param bool $distinct |
| 248 | 240 | * @return mixed |
| 249 | 241 | */ |
| 250 | - public function max($column, bool $distinct = false) |
|
| 251 | - { |
|
| 242 | + public function max($column, bool $distinct = false) { |
|
| 252 | 243 | (new ColumnExpression($this->queryStatement))->max($column, null, $distinct); |
| 253 | 244 | } |
| 254 | 245 | |
| 255 | 246 | /** |
| 256 | 247 | * @inheritDoc |
| 257 | 248 | */ |
| 258 | - public function __clone() |
|
| 259 | - { |
|
| 249 | + public function __clone() { |
|
| 260 | 250 | parent::__clone(); |
| 261 | 251 | $this->havingStatement = new HavingStatement($this->queryStatement); |
| 262 | 252 | } |
@@ -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 | /** |
| 57 | 56 | * The SelectStatement instance |
@@ -79,8 +78,7 @@ discard block |
||
| 79 | 78 | /** |
| 80 | 79 | * @inheritDoc |
| 81 | 80 | */ |
| 82 | - public function __clone() |
|
| 83 | - { |
|
| 81 | + public function __clone() { |
|
| 84 | 82 | $this->select = clone $this->select; |
| 85 | 83 | } |
| 86 | 84 | } |
@@ -38,6 +38,5 @@ |
||
| 38 | 38 | * Class ConnectionException |
| 39 | 39 | * @package Platine\Database\Exception |
| 40 | 40 | */ |
| 41 | -class ConnectionException extends Exception |
|
| 42 | -{ |
|
| 41 | +class ConnectionException extends Exception { |
|
| 43 | 42 | } |