@@ -54,8 +54,7 @@ discard block |
||
| 54 | 54 | * Class ResultSet |
| 55 | 55 | * @package Platine\Database |
| 56 | 56 | */ |
| 57 | -class ResultSet |
|
| 58 | -{ |
|
| 57 | +class ResultSet { |
|
| 59 | 58 | |
| 60 | 59 | /** |
| 61 | 60 | * The PDOStatement instance |
@@ -67,8 +66,7 @@ discard block |
||
| 67 | 66 | * Class constructor |
| 68 | 67 | * @param PDOStatement $statement |
| 69 | 68 | */ |
| 70 | - public function __construct(PDOStatement $statement) |
|
| 71 | - { |
|
| 69 | + public function __construct(PDOStatement $statement) { |
|
| 72 | 70 | $this->statement = $statement; |
| 73 | 71 | } |
| 74 | 72 | |
@@ -76,8 +74,7 @@ discard block |
||
| 76 | 74 | * Destructor of the class |
| 77 | 75 | * |
| 78 | 76 | */ |
| 79 | - public function __destruct() |
|
| 80 | - { |
|
| 77 | + public function __destruct() { |
|
| 81 | 78 | $this->statement->closeCursor(); |
| 82 | 79 | } |
| 83 | 80 | |
@@ -96,8 +93,7 @@ discard block |
||
| 96 | 93 | * @param int $fetchStyle the PDO fetch style |
| 97 | 94 | * @return array<int, mixed>|false |
| 98 | 95 | */ |
| 99 | - public function all(callable $callable = null, int $fetchStyle = 0) |
|
| 100 | - { |
|
| 96 | + public function all(callable $callable = null, int $fetchStyle = 0) { |
|
| 101 | 97 | if ($callable === null) { |
| 102 | 98 | return $this->statement->fetchAll($fetchStyle); |
| 103 | 99 | } |
@@ -110,8 +106,7 @@ discard block |
||
| 110 | 106 | * @param callable $callable |
| 111 | 107 | * @return array<int, mixed>|false |
| 112 | 108 | */ |
| 113 | - public function allGroup(bool $uniq = false, callable $callable = null) |
|
| 114 | - { |
|
| 109 | + public function allGroup(bool $uniq = false, callable $callable = null) { |
|
| 115 | 110 | $fetchStyle = PDO::FETCH_GROUP | ($uniq ? PDO::FETCH_UNIQUE : 0); |
| 116 | 111 | |
| 117 | 112 | if ($callable === null) { |
@@ -125,8 +120,7 @@ discard block |
||
| 125 | 120 | * @param callable $callable |
| 126 | 121 | * @return mixed |
| 127 | 122 | */ |
| 128 | - public function get(callable $callable = null) |
|
| 129 | - { |
|
| 123 | + public function get(callable $callable = null) { |
|
| 130 | 124 | $result = $this->statement->fetch(); |
| 131 | 125 | $this->statement->closeCursor(); |
| 132 | 126 | if ($callable !== null) { |
@@ -141,8 +135,7 @@ discard block |
||
| 141 | 135 | * |
| 142 | 136 | * @return mixed |
| 143 | 137 | */ |
| 144 | - public function next() |
|
| 145 | - { |
|
| 138 | + public function next() { |
|
| 146 | 139 | return $this->statement->fetch(); |
| 147 | 140 | } |
| 148 | 141 | |
@@ -150,8 +143,7 @@ discard block |
||
| 150 | 143 | * Close the cursor |
| 151 | 144 | * @return mixed |
| 152 | 145 | */ |
| 153 | - public function flush() |
|
| 154 | - { |
|
| 146 | + public function flush() { |
|
| 155 | 147 | return $this->statement->closeCursor(); |
| 156 | 148 | } |
| 157 | 149 | |
@@ -161,8 +153,7 @@ discard block |
||
| 161 | 153 | * |
| 162 | 154 | * @return mixed |
| 163 | 155 | */ |
| 164 | - public function column(int $col = 0) |
|
| 165 | - { |
|
| 156 | + public function column(int $col = 0) { |
|
| 166 | 157 | return $this->statement->fetchColumn($col); |
| 167 | 158 | } |
| 168 | 159 | |
@@ -133,9 +133,9 @@ |
||
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | /** |
| 136 | - * Connect to the database |
|
| 137 | - * @return void |
|
| 138 | - */ |
|
| 136 | + * Connect to the database |
|
| 137 | + * @return void |
|
| 138 | + */ |
|
| 139 | 139 | public function connect(): void |
| 140 | 140 | { |
| 141 | 141 | $this->setConnectionParams(); |
@@ -376,7 +376,7 @@ |
||
| 376 | 376 | |
| 377 | 377 | return (string) preg_replace_callback( |
| 378 | 378 | '/\?/', |
| 379 | - function () use ($driver, &$params) { |
|
| 379 | + function() use ($driver, &$params) { |
|
| 380 | 380 | $param = array_shift($params); |
| 381 | 381 | |
| 382 | 382 | $value = is_object($param) ? get_class($param) : $param; |
@@ -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]) ? $this->properties[$name] : $default; |
| 158 | 155 | } |
| 159 | 156 | |
@@ -50,8 +50,7 @@ discard block |
||
| 50 | 50 | * Class ForeignKey |
| 51 | 51 | * @package Platine\Database\Schema |
| 52 | 52 | */ |
| 53 | -class ForeignKey |
|
| 54 | -{ |
|
| 53 | +class ForeignKey { |
|
| 55 | 54 | |
| 56 | 55 | /** |
| 57 | 56 | * The referenced table |
@@ -81,8 +80,7 @@ discard block |
||
| 81 | 80 | * Class constructor |
| 82 | 81 | * @param array<int, string> $columns |
| 83 | 82 | */ |
| 84 | - public function __construct(array $columns) |
|
| 85 | - { |
|
| 83 | + public function __construct(array $columns) { |
|
| 86 | 84 | $this->columns = $columns; |
| 87 | 85 | } |
| 88 | 86 | |
@@ -58,8 +58,7 @@ discard block |
||
| 58 | 58 | * Class Configuration |
| 59 | 59 | * @package Platine\Database |
| 60 | 60 | */ |
| 61 | -class Configuration implements ConfigurationInterface |
|
| 62 | -{ |
|
| 61 | +class Configuration implements ConfigurationInterface { |
|
| 63 | 62 | /** |
| 64 | 63 | * The connection driver to use |
| 65 | 64 | * @var string |
@@ -159,8 +158,7 @@ discard block |
||
| 159 | 158 | * Class constructor |
| 160 | 159 | * @param array<string, mixed> $config the connection configuration |
| 161 | 160 | */ |
| 162 | - public function __construct(array $config = []) |
|
| 163 | - { |
|
| 161 | + public function __construct(array $config = []) { |
|
| 164 | 162 | $this->load($config); |
| 165 | 163 | } |
| 166 | 164 | |
@@ -291,8 +289,7 @@ discard block |
||
| 291 | 289 | /** |
| 292 | 290 | * {@inheritedoc} |
| 293 | 291 | */ |
| 294 | - public function getAttribute(string $name, $default = null) |
|
| 295 | - { |
|
| 292 | + public function getAttribute(string $name, $default = null) { |
|
| 296 | 293 | return $this->hasAttribute($name) |
| 297 | 294 | ? $this->attributes[$name] |
| 298 | 295 | : $default; |
@@ -50,8 +50,7 @@ |
||
| 50 | 50 | * Interface ConfigurationInterface |
| 51 | 51 | * @package Platine\Database |
| 52 | 52 | */ |
| 53 | -interface ConfigurationInterface |
|
| 54 | -{ |
|
| 53 | +interface ConfigurationInterface { |
|
| 55 | 54 | |
| 56 | 55 | /** |
| 57 | 56 | * |
@@ -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 | $tables = [$tables]; |
| 80 | 77 | } |
@@ -60,8 +60,7 @@ discard block |
||
| 60 | 60 | * Class Query |
| 61 | 61 | * @package Platine\Database\Query |
| 62 | 62 | */ |
| 63 | -class Query extends BaseStatement |
|
| 64 | -{ |
|
| 63 | +class Query extends BaseStatement { |
|
| 65 | 64 | |
| 66 | 65 | /** |
| 67 | 66 | * @var Connection |
@@ -95,8 +94,7 @@ discard block |
||
| 95 | 94 | * |
| 96 | 95 | * @return Select|SelectStatement |
| 97 | 96 | */ |
| 98 | - public function distinct(bool $value = true) |
|
| 99 | - { |
|
| 97 | + public function distinct(bool $value = true) { |
|
| 100 | 98 | return $this->buildSelect()->distinct($value); |
| 101 | 99 | } |
| 102 | 100 | |
@@ -105,8 +103,7 @@ discard block |
||
| 105 | 103 | * |
| 106 | 104 | * @return Select|SelectStatement |
| 107 | 105 | */ |
| 108 | - public function groupBy($columns) |
|
| 109 | - { |
|
| 106 | + public function groupBy($columns) { |
|
| 110 | 107 | return $this->buildSelect()->groupBy($columns); |
| 111 | 108 | } |
| 112 | 109 | |
@@ -116,8 +113,7 @@ discard block |
||
| 116 | 113 | * |
| 117 | 114 | * @return Select|SelectStatement |
| 118 | 115 | */ |
| 119 | - public function having($column, Closure $value = null) |
|
| 120 | - { |
|
| 116 | + public function having($column, Closure $value = null) { |
|
| 121 | 117 | return $this->buildSelect()->having($column, $value); |
| 122 | 118 | } |
| 123 | 119 | |
@@ -127,8 +123,7 @@ discard block |
||
| 127 | 123 | * |
| 128 | 124 | * @return Select|SelectStatement |
| 129 | 125 | */ |
| 130 | - public function orHaving($column, Closure $value = null) |
|
| 131 | - { |
|
| 126 | + public function orHaving($column, Closure $value = null) { |
|
| 132 | 127 | return $this->buildSelect()->orHaving($column, $value); |
| 133 | 128 | } |
| 134 | 129 | |
@@ -138,8 +133,7 @@ discard block |
||
| 138 | 133 | * |
| 139 | 134 | * @return Select|SelectStatement |
| 140 | 135 | */ |
| 141 | - public function orderBy($columns, string $order = 'ASC') |
|
| 142 | - { |
|
| 136 | + public function orderBy($columns, string $order = 'ASC') { |
|
| 143 | 137 | return $this->buildSelect()->orderBy($columns, $order); |
| 144 | 138 | } |
| 145 | 139 | |
@@ -148,8 +142,7 @@ discard block |
||
| 148 | 142 | * |
| 149 | 143 | * @return Select|SelectStatement |
| 150 | 144 | */ |
| 151 | - public function limit(int $value) |
|
| 152 | - { |
|
| 145 | + public function limit(int $value) { |
|
| 153 | 146 | return $this->buildSelect()->limit($value); |
| 154 | 147 | } |
| 155 | 148 | |
@@ -158,8 +151,7 @@ discard block |
||
| 158 | 151 | * |
| 159 | 152 | * @return Select|SelectStatement |
| 160 | 153 | */ |
| 161 | - public function offset(int $value) |
|
| 162 | - { |
|
| 154 | + public function offset(int $value) { |
|
| 163 | 155 | return $this->buildSelect()->offset($value); |
| 164 | 156 | } |
| 165 | 157 | |
@@ -167,8 +159,7 @@ discard block |
||
| 167 | 159 | * @param string $table |
| 168 | 160 | * @return Select|SelectStatement |
| 169 | 161 | */ |
| 170 | - public function into(string $table) |
|
| 171 | - { |
|
| 162 | + public function into(string $table) { |
|
| 172 | 163 | return $this->buildSelect()->into($table); |
| 173 | 164 | } |
| 174 | 165 | |
@@ -177,8 +168,7 @@ discard block |
||
| 177 | 168 | * |
| 178 | 169 | * @return ResultSet |
| 179 | 170 | */ |
| 180 | - public function select($columns = []) |
|
| 181 | - { |
|
| 171 | + public function select($columns = []) { |
|
| 182 | 172 | return $this->buildSelect()->select($columns); |
| 183 | 173 | } |
| 184 | 174 | |
@@ -196,8 +186,7 @@ discard block |
||
| 196 | 186 | * |
| 197 | 187 | * @return Select|SelectStatement |
| 198 | 188 | */ |
| 199 | - public function column($name) |
|
| 200 | - { |
|
| 189 | + public function column($name) { |
|
| 201 | 190 | return $this->buildSelect()->column($name); |
| 202 | 191 | } |
| 203 | 192 | |
@@ -218,8 +207,7 @@ discard block |
||
| 218 | 207 | * |
| 219 | 208 | * @return int|float |
| 220 | 209 | */ |
| 221 | - public function avg($column, bool $distinct = false) |
|
| 222 | - { |
|
| 210 | + public function avg($column, bool $distinct = false) { |
|
| 223 | 211 | return $this->buildSelect()->avg($column, $distinct); |
| 224 | 212 | } |
| 225 | 213 | |
@@ -229,8 +217,7 @@ discard block |
||
| 229 | 217 | * |
| 230 | 218 | * @return int|float |
| 231 | 219 | */ |
| 232 | - public function sum($column, bool $distinct = false) |
|
| 233 | - { |
|
| 220 | + public function sum($column, bool $distinct = false) { |
|
| 234 | 221 | return $this->buildSelect()->sum($column, $distinct); |
| 235 | 222 | } |
| 236 | 223 | |
@@ -240,8 +227,7 @@ discard block |
||
| 240 | 227 | * |
| 241 | 228 | * @return int|float |
| 242 | 229 | */ |
| 243 | - public function min($column, bool $distinct = false) |
|
| 244 | - { |
|
| 230 | + public function min($column, bool $distinct = false) { |
|
| 245 | 231 | return $this->buildSelect()->min($column, $distinct); |
| 246 | 232 | } |
| 247 | 233 | |
@@ -251,8 +237,7 @@ discard block |
||
| 251 | 237 | * |
| 252 | 238 | * @return int|float |
| 253 | 239 | */ |
| 254 | - public function max($column, bool $distinct = false) |
|
| 255 | - { |
|
| 240 | + public function max($column, bool $distinct = false) { |
|
| 256 | 241 | return $this->buildSelect()->max($column, $distinct); |
| 257 | 242 | } |
| 258 | 243 | |
@@ -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 | /** |
| 59 | 58 | * @var string|Expression |
@@ -75,8 +74,7 @@ discard block |
||
| 75 | 74 | * Having constructor. |
| 76 | 75 | * @param QueryStatement $queryStatement |
| 77 | 76 | */ |
| 78 | - public function __construct(QueryStatement $queryStatement) |
|
| 79 | - { |
|
| 77 | + public function __construct(QueryStatement $queryStatement) { |
|
| 80 | 78 | $this->queryStatement = $queryStatement; |
| 81 | 79 | } |
| 82 | 80 | |
@@ -227,8 +225,7 @@ discard block |
||
| 227 | 225 | /** |
| 228 | 226 | * @inheritDoc |
| 229 | 227 | */ |
| 230 | - public function __clone() |
|
| 231 | - { |
|
| 228 | + public function __clone() { |
|
| 232 | 229 | if ($this->aggregate instanceof Expression) { |
| 233 | 230 | $this->aggregate = clone $this->aggregate; |
| 234 | 231 | } |