@@ -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 | } |
@@ -50,16 +50,14 @@ 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 | /** |
| 57 | 56 | * DeleteStatement constructor. |
| 58 | 57 | * @param string|array<string> $from |
| 59 | 58 | * @param QueryStatement|null $queryStatement |
| 60 | 59 | */ |
| 61 | - public function __construct($from, QueryStatement $queryStatement = null) |
|
| 62 | - { |
|
| 60 | + public function __construct($from, QueryStatement $queryStatement = null) { |
|
| 63 | 61 | parent::__construct($queryStatement); |
| 64 | 62 | |
| 65 | 63 | if (!is_array($from)) { |
@@ -73,8 +71,7 @@ discard block |
||
| 73 | 71 | * @param string|array<string> $tables |
| 74 | 72 | * @return mixed |
| 75 | 73 | */ |
| 76 | - public function delete($tables = []) |
|
| 77 | - { |
|
| 74 | + public function delete($tables = []) { |
|
| 78 | 75 | if (!is_array($tables)) { |
| 79 | 76 | /** @var array<string> $tables */ |
| 80 | 77 | $tables = [$tables]; |
@@ -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 | /** |
| 61 | 60 | * @var Connection |
@@ -89,8 +88,7 @@ discard block |
||
| 89 | 88 | * |
| 90 | 89 | * @return Select|SelectStatement |
| 91 | 90 | */ |
| 92 | - public function distinct(bool $value = true) |
|
| 93 | - { |
|
| 91 | + public function distinct(bool $value = true) { |
|
| 94 | 92 | return $this->buildSelect()->distinct($value); |
| 95 | 93 | } |
| 96 | 94 | |
@@ -99,8 +97,7 @@ discard block |
||
| 99 | 97 | * |
| 100 | 98 | * @return Select|SelectStatement |
| 101 | 99 | */ |
| 102 | - public function groupBy($columns) |
|
| 103 | - { |
|
| 100 | + public function groupBy($columns) { |
|
| 104 | 101 | return $this->buildSelect()->groupBy($columns); |
| 105 | 102 | } |
| 106 | 103 | |
@@ -110,8 +107,7 @@ discard block |
||
| 110 | 107 | * |
| 111 | 108 | * @return Select|SelectStatement |
| 112 | 109 | */ |
| 113 | - public function having($column, Closure $value = null) |
|
| 114 | - { |
|
| 110 | + public function having($column, Closure $value = null) { |
|
| 115 | 111 | return $this->buildSelect()->having($column, $value); |
| 116 | 112 | } |
| 117 | 113 | |
@@ -121,8 +117,7 @@ discard block |
||
| 121 | 117 | * |
| 122 | 118 | * @return Select|SelectStatement |
| 123 | 119 | */ |
| 124 | - public function orHaving($column, Closure $value = null) |
|
| 125 | - { |
|
| 120 | + public function orHaving($column, Closure $value = null) { |
|
| 126 | 121 | return $this->buildSelect()->orHaving($column, $value); |
| 127 | 122 | } |
| 128 | 123 | |
@@ -132,8 +127,7 @@ discard block |
||
| 132 | 127 | * |
| 133 | 128 | * @return Select|SelectStatement |
| 134 | 129 | */ |
| 135 | - public function orderBy($columns, string $order = 'ASC') |
|
| 136 | - { |
|
| 130 | + public function orderBy($columns, string $order = 'ASC') { |
|
| 137 | 131 | return $this->buildSelect()->orderBy($columns, $order); |
| 138 | 132 | } |
| 139 | 133 | |
@@ -142,8 +136,7 @@ discard block |
||
| 142 | 136 | * |
| 143 | 137 | * @return Select|SelectStatement |
| 144 | 138 | */ |
| 145 | - public function limit(int $value) |
|
| 146 | - { |
|
| 139 | + public function limit(int $value) { |
|
| 147 | 140 | return $this->buildSelect()->limit($value); |
| 148 | 141 | } |
| 149 | 142 | |
@@ -152,8 +145,7 @@ discard block |
||
| 152 | 145 | * |
| 153 | 146 | * @return Select|SelectStatement |
| 154 | 147 | */ |
| 155 | - public function offset(int $value) |
|
| 156 | - { |
|
| 148 | + public function offset(int $value) { |
|
| 157 | 149 | return $this->buildSelect()->offset($value); |
| 158 | 150 | } |
| 159 | 151 | |
@@ -161,8 +153,7 @@ discard block |
||
| 161 | 153 | * @param string $table |
| 162 | 154 | * @return Select|SelectStatement |
| 163 | 155 | */ |
| 164 | - public function into(string $table) |
|
| 165 | - { |
|
| 156 | + public function into(string $table) { |
|
| 166 | 157 | return $this->buildSelect()->into($table); |
| 167 | 158 | } |
| 168 | 159 | |
@@ -171,8 +162,7 @@ discard block |
||
| 171 | 162 | * |
| 172 | 163 | * @return ResultSet |
| 173 | 164 | */ |
| 174 | - public function select($columns = []) |
|
| 175 | - { |
|
| 165 | + public function select($columns = []) { |
|
| 176 | 166 | return $this->buildSelect()->select($columns); |
| 177 | 167 | } |
| 178 | 168 | |
@@ -190,8 +180,7 @@ discard block |
||
| 190 | 180 | * |
| 191 | 181 | * @return mixed |
| 192 | 182 | */ |
| 193 | - public function column($name) |
|
| 194 | - { |
|
| 183 | + public function column($name) { |
|
| 195 | 184 | return $this->buildSelect()->column($name); |
| 196 | 185 | } |
| 197 | 186 | |
@@ -212,8 +201,7 @@ discard block |
||
| 212 | 201 | * |
| 213 | 202 | * @return int|float |
| 214 | 203 | */ |
| 215 | - public function avg($column, bool $distinct = false) |
|
| 216 | - { |
|
| 204 | + public function avg($column, bool $distinct = false) { |
|
| 217 | 205 | return $this->buildSelect()->avg($column, $distinct); |
| 218 | 206 | } |
| 219 | 207 | |
@@ -223,8 +211,7 @@ discard block |
||
| 223 | 211 | * |
| 224 | 212 | * @return int|float |
| 225 | 213 | */ |
| 226 | - public function sum($column, bool $distinct = false) |
|
| 227 | - { |
|
| 214 | + public function sum($column, bool $distinct = false) { |
|
| 228 | 215 | return $this->buildSelect()->sum($column, $distinct); |
| 229 | 216 | } |
| 230 | 217 | |
@@ -234,8 +221,7 @@ discard block |
||
| 234 | 221 | * |
| 235 | 222 | * @return mixed |
| 236 | 223 | */ |
| 237 | - public function min($column, bool $distinct = false) |
|
| 238 | - { |
|
| 224 | + public function min($column, bool $distinct = false) { |
|
| 239 | 225 | return $this->buildSelect()->min($column, $distinct); |
| 240 | 226 | } |
| 241 | 227 | |
@@ -245,8 +231,7 @@ discard block |
||
| 245 | 231 | * |
| 246 | 232 | * @return mixed |
| 247 | 233 | */ |
| 248 | - public function max($column, bool $distinct = false) |
|
| 249 | - { |
|
| 234 | + public function max($column, bool $distinct = false) { |
|
| 250 | 235 | return $this->buildSelect()->max($column, $distinct); |
| 251 | 236 | } |
| 252 | 237 | |
@@ -52,8 +52,7 @@ discard block |
||
| 52 | 52 | * Class WhereStatement |
| 53 | 53 | * @package Platine\Database\Query |
| 54 | 54 | */ |
| 55 | -class WhereStatement |
|
| 56 | -{ |
|
| 55 | +class WhereStatement { |
|
| 57 | 56 | |
| 58 | 57 | /** |
| 59 | 58 | * The Query statement instance |
@@ -71,8 +70,7 @@ discard block |
||
| 71 | 70 | * WhereStatement constructor. |
| 72 | 71 | * @param QueryStatement|null $queryStatement |
| 73 | 72 | */ |
| 74 | - public function __construct(QueryStatement $queryStatement = null) |
|
| 75 | - { |
|
| 73 | + public function __construct(QueryStatement $queryStatement = null) { |
|
| 76 | 74 | if ($queryStatement === null) { |
| 77 | 75 | $queryStatement = new QueryStatement(); |
| 78 | 76 | } |
@@ -94,8 +92,7 @@ discard block |
||
| 94 | 92 | * |
| 95 | 93 | * @return WhereStatement|Where|Select|Delete|Update |
| 96 | 94 | */ |
| 97 | - public function where($column, bool $isExpression = false) |
|
| 98 | - { |
|
| 95 | + public function where($column, bool $isExpression = false) { |
|
| 99 | 96 | return $this->addWhereCondition($column, 'AND', $isExpression); |
| 100 | 97 | } |
| 101 | 98 | |
@@ -105,8 +102,7 @@ discard block |
||
| 105 | 102 | * |
| 106 | 103 | * @return WhereStatement|Where|Select|Delete|Update |
| 107 | 104 | */ |
| 108 | - public function orWhere($column, bool $isExpression = false) |
|
| 109 | - { |
|
| 105 | + public function orWhere($column, bool $isExpression = false) { |
|
| 110 | 106 | return $this->addWhereCondition($column, 'OR', $isExpression); |
| 111 | 107 | } |
| 112 | 108 | |
@@ -149,8 +145,7 @@ discard block |
||
| 149 | 145 | /** |
| 150 | 146 | * @inheritDoc |
| 151 | 147 | */ |
| 152 | - public function __clone() |
|
| 153 | - { |
|
| 148 | + public function __clone() { |
|
| 154 | 149 | $this->queryStatement = clone $this->queryStatement; |
| 155 | 150 | $this->where = new Where($this, $this->queryStatement); |
| 156 | 151 | } |
@@ -162,8 +157,7 @@ discard block |
||
| 162 | 157 | * |
| 163 | 158 | * @return WhereStatement|Where |
| 164 | 159 | */ |
| 165 | - protected function addWhereCondition($column, string $separator = 'AND', bool $isExpression = false) |
|
| 166 | - { |
|
| 160 | + protected function addWhereCondition($column, string $separator = 'AND', bool $isExpression = false) { |
|
| 167 | 161 | if (($column instanceof Closure) && !$isExpression) { |
| 168 | 162 | $this->queryStatement->addWhereGroup($column, $separator); |
| 169 | 163 | |
@@ -50,8 +50,7 @@ discard block |
||
| 50 | 50 | * Class BaseColumn |
| 51 | 51 | * @package Platine\Database\Schema |
| 52 | 52 | */ |
| 53 | -class BaseColumn |
|
| 54 | -{ |
|
| 53 | +class BaseColumn { |
|
| 55 | 54 | |
| 56 | 55 | /** |
| 57 | 56 | * The name of the column |
@@ -76,8 +75,7 @@ discard block |
||
| 76 | 75 | * @param string $name |
| 77 | 76 | * @param string|null $type |
| 78 | 77 | */ |
| 79 | - public function __construct(string $name, ?string $type = null) |
|
| 80 | - { |
|
| 78 | + public function __construct(string $name, ?string $type = null) { |
|
| 81 | 79 | $this->name = $name; |
| 82 | 80 | $this->type = $type; |
| 83 | 81 | } |
@@ -152,8 +150,7 @@ discard block |
||
| 152 | 150 | * @param mixed|null $default |
| 153 | 151 | * @return mixed |
| 154 | 152 | */ |
| 155 | - public function get(string $name, $default = null) |
|
| 156 | - { |
|
| 153 | + public function get(string $name, $default = null) { |
|
| 157 | 154 | return isset($this->properties[$name]) |
| 158 | 155 | ? $this->properties[$name] |
| 159 | 156 | : $default; |
@@ -78,7 +78,7 @@ |
||
| 78 | 78 | !empty($config['connections']) |
| 79 | 79 | && is_array($config['connections']) |
| 80 | 80 | ) { |
| 81 | - /** @var array<string, array<string, mixed>> $connections */ |
|
| 81 | + /** @var array<string, array<string, mixed>> $connections */ |
|
| 82 | 82 | $connections = $config['connections']; |
| 83 | 83 | |
| 84 | 84 | foreach ($connections as $name => $connection) { |
@@ -52,8 +52,7 @@ discard block |
||
| 52 | 52 | * Class Pool |
| 53 | 53 | * @package Platine\Database |
| 54 | 54 | */ |
| 55 | -class Pool |
|
| 56 | -{ |
|
| 55 | +class Pool { |
|
| 57 | 56 | |
| 58 | 57 | /** |
| 59 | 58 | * The default connection name |
@@ -71,8 +70,7 @@ discard block |
||
| 71 | 70 | * Class constructor |
| 72 | 71 | * @param array<string, mixed> $config |
| 73 | 72 | */ |
| 74 | - public function __construct(array $config = []) |
|
| 75 | - { |
|
| 73 | + public function __construct(array $config = []) { |
|
| 76 | 74 | if (!empty($config)) { |
| 77 | 75 | if ( |
| 78 | 76 | !empty($config['connections']) |
@@ -38,6 +38,5 @@ |
||
| 38 | 38 | * Class ConnectionNotFoundException |
| 39 | 39 | * @package Platine\Database\Exception |
| 40 | 40 | */ |
| 41 | -class ConnectionNotFoundException extends Exception |
|
| 42 | -{ |
|
| 41 | +class ConnectionNotFoundException extends Exception { |
|
| 43 | 42 | } |