@@ -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; |
@@ -60,8 +60,7 @@ discard block |
||
60 | 60 | * Class Connection |
61 | 61 | * @package Platine\Database |
62 | 62 | */ |
63 | -class Connection |
|
64 | -{ |
|
63 | +class Connection { |
|
65 | 64 | |
66 | 65 | /** |
67 | 66 | * The PDO instance |
@@ -322,8 +321,7 @@ discard block |
||
322 | 321 | * @return mixed |
323 | 322 | * @throws QueryException |
324 | 323 | */ |
325 | - public function column(string $sql, array $params = []) |
|
326 | - { |
|
324 | + public function column(string $sql, array $params = []) { |
|
327 | 325 | $prepared = $this->prepare($sql, $params); |
328 | 326 | $this->execute($prepared); |
329 | 327 |
@@ -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; |
@@ -393,12 +393,12 @@ |
||
393 | 393 | public function getDriverClassName(): string |
394 | 394 | { |
395 | 395 | $maps = [ |
396 | - 'mysql' => MySQL::class, |
|
397 | - 'pgsql' => PostgreSQL::class, |
|
398 | - 'sqlsrv' => SQLServer::class, |
|
399 | - 'oci' => Oracle::class, |
|
400 | - 'oracle' => Oracle::class, |
|
401 | - 'sqlite' => SQLite::class, |
|
396 | + 'mysql' => MySQL::class, |
|
397 | + 'pgsql' => PostgreSQL::class, |
|
398 | + 'sqlsrv' => SQLServer::class, |
|
399 | + 'oci' => Oracle::class, |
|
400 | + 'oracle' => Oracle::class, |
|
401 | + 'sqlite' => SQLite::class, |
|
402 | 402 | ]; |
403 | 403 | |
404 | 404 | return isset($maps[$this->driver]) |
@@ -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 | * |
@@ -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 | } |
@@ -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; |
@@ -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; |
@@ -125,11 +125,11 @@ |
||
125 | 125 | |
126 | 126 | foreach ($columns as $key => $val) { |
127 | 127 | if (is_numeric($key)) { |
128 | - $values[$val] = function (Expression $expr) use ($sign, $val, $value) { |
|
128 | + $values[$val] = function(Expression $expr) use ($sign, $val, $value) { |
|
129 | 129 | $expr->column($val)->op($sign)->value($value); |
130 | 130 | }; |
131 | 131 | } else { |
132 | - $values[$key] = function (Expression $expr) use ($sign, $key, $val) { |
|
132 | + $values[$key] = function(Expression $expr) use ($sign, $key, $val) { |
|
133 | 133 | $expr->column($key)->op($sign)->value($val); |
134 | 134 | }; |
135 | 135 | } |
@@ -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 | } |