@@ -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) { |
@@ -53,8 +53,7 @@ discard block |
||
| 53 | 53 | * @class Pool |
| 54 | 54 | * @package Platine\Database |
| 55 | 55 | */ |
| 56 | -class Pool |
|
| 57 | -{ |
|
| 56 | +class Pool { |
|
| 58 | 57 | /** |
| 59 | 58 | * The default connection name |
| 60 | 59 | * @var string |
@@ -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']) |
@@ -198,10 +198,10 @@ discard block |
||
| 198 | 198 | return $this->appname; |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | - /** |
|
| 202 | - * Return the host |
|
| 203 | - * @return string |
|
| 204 | - */ |
|
| 201 | + /** |
|
| 202 | + * Return the host |
|
| 203 | + * @return string |
|
| 204 | + */ |
|
| 205 | 205 | public function getHostname(): string |
| 206 | 206 | { |
| 207 | 207 | return $this->hostname; |
@@ -399,12 +399,12 @@ discard block |
||
| 399 | 399 | public function getDriverClassName(): string |
| 400 | 400 | { |
| 401 | 401 | $maps = [ |
| 402 | - 'mysql' => MySQL::class, |
|
| 403 | - 'pgsql' => PostgreSQL::class, |
|
| 404 | - 'sqlsrv' => SQLServer::class, |
|
| 405 | - 'oci' => Oracle::class, |
|
| 406 | - 'oracle' => Oracle::class, |
|
| 407 | - 'sqlite' => SQLite::class, |
|
| 402 | + 'mysql' => MySQL::class, |
|
| 403 | + 'pgsql' => PostgreSQL::class, |
|
| 404 | + 'sqlsrv' => SQLServer::class, |
|
| 405 | + 'oci' => Oracle::class, |
|
| 406 | + 'oracle' => Oracle::class, |
|
| 407 | + 'sqlite' => SQLite::class, |
|
| 408 | 408 | ]; |
| 409 | 409 | |
| 410 | 410 | return isset($maps[$this->driver]) |
@@ -59,8 +59,7 @@ discard block |
||
| 59 | 59 | * @class Configuration |
| 60 | 60 | * @package Platine\Database |
| 61 | 61 | */ |
| 62 | -class Configuration extends AbstractConfiguration |
|
| 63 | -{ |
|
| 62 | +class Configuration extends AbstractConfiguration { |
|
| 64 | 63 | /** |
| 65 | 64 | * The connection driver to use |
| 66 | 65 | * @var string |
@@ -377,8 +376,7 @@ discard block |
||
| 377 | 376 | * |
| 378 | 377 | * @return mixed |
| 379 | 378 | */ |
| 380 | - public function getAttribute(string $name, $default = null) |
|
| 381 | - { |
|
| 379 | + public function getAttribute(string $name, $default = null) { |
|
| 382 | 380 | return $this->hasAttribute($name) |
| 383 | 381 | ? $this->attributes[$name] |
| 384 | 382 | : $default; |
@@ -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 | * The where SQL parts |
| 60 | 59 | * @var array<int, mixed> |
@@ -348,8 +347,7 @@ discard block |
||
| 348 | 347 | * @param bool $not |
| 349 | 348 | * @return mixed |
| 350 | 349 | */ |
| 351 | - public function addHavingIn($aggregate, $value, string $separator, bool $not) |
|
| 352 | - { |
|
| 350 | + public function addHavingIn($aggregate, $value, string $separator, bool $not) { |
|
| 353 | 351 | $aggregate = $this->closureToExpression($aggregate); |
| 354 | 352 | |
| 355 | 353 | if ($value instanceof Closure) { |
@@ -617,8 +615,7 @@ discard block |
||
| 617 | 615 | * |
| 618 | 616 | * @return mixed|Expression |
| 619 | 617 | */ |
| 620 | - protected function closureToExpression($value) |
|
| 621 | - { |
|
| 618 | + protected function closureToExpression($value) { |
|
| 622 | 619 | if ($value instanceof Closure) { |
| 623 | 620 | return Expression::fromClosure($value); |
| 624 | 621 | } |
@@ -475,12 +475,12 @@ |
||
| 475 | 475 | } |
| 476 | 476 | } |
| 477 | 477 | |
| 478 | - /** |
|
| 479 | - * Change the query parameters placeholder with the value |
|
| 480 | - * @param string $query |
|
| 481 | - * @param array<int, mixed> $params |
|
| 482 | - * @return string |
|
| 483 | - */ |
|
| 478 | + /** |
|
| 479 | + * Change the query parameters placeholder with the value |
|
| 480 | + * @param string $query |
|
| 481 | + * @param array<int, mixed> $params |
|
| 482 | + * @return string |
|
| 483 | + */ |
|
| 484 | 484 | protected function replaceParameters(string $query, array $params): string |
| 485 | 485 | { |
| 486 | 486 | $driver = $this->driver; |
@@ -61,8 +61,7 @@ discard block |
||
| 61 | 61 | * @class Connection |
| 62 | 62 | * @package Platine\Database |
| 63 | 63 | */ |
| 64 | -class Connection |
|
| 65 | -{ |
|
| 64 | +class Connection { |
|
| 66 | 65 | /** |
| 67 | 66 | * The PDO instance |
| 68 | 67 | * @var PDO |
@@ -401,8 +400,7 @@ discard block |
||
| 401 | 400 | * @return mixed |
| 402 | 401 | * @throws QueryException |
| 403 | 402 | */ |
| 404 | - public function column(string $sql, array $params = []) |
|
| 405 | - { |
|
| 403 | + public function column(string $sql, array $params = []) { |
|
| 406 | 404 | $prepared = $this->prepare($sql, $params); |
| 407 | 405 | $this->execute($prepared); |
| 408 | 406 | |
@@ -454,8 +452,7 @@ discard block |
||
| 454 | 452 | /** |
| 455 | 453 | * {@inheritdoc} |
| 456 | 454 | */ |
| 457 | - public function __sleep() |
|
| 458 | - { |
|
| 455 | + public function __sleep() { |
|
| 459 | 456 | return [ |
| 460 | 457 | 'dsn', |
| 461 | 458 | 'driver', |
@@ -469,8 +466,7 @@ discard block |
||
| 469 | 466 | /** |
| 470 | 467 | * {@inheritdoc} |
| 471 | 468 | */ |
| 472 | - public function __wakeup() |
|
| 473 | - { |
|
| 469 | + public function __wakeup() { |
|
| 474 | 470 | $this->createPDO(); |
| 475 | 471 | } |
| 476 | 472 | |
@@ -53,8 +53,7 @@ discard block |
||
| 53 | 53 | * @class Schema |
| 54 | 54 | * @package Platine\Database |
| 55 | 55 | */ |
| 56 | -class Schema |
|
| 57 | -{ |
|
| 56 | +class Schema { |
|
| 58 | 57 | /** |
| 59 | 58 | * The Connection instance |
| 60 | 59 | * @var Connection |
@@ -89,8 +88,7 @@ discard block |
||
| 89 | 88 | * Class constructor |
| 90 | 89 | * @param Connection $connection |
| 91 | 90 | */ |
| 92 | - public function __construct(Connection $connection) |
|
| 93 | - { |
|
| 91 | + public function __construct(Connection $connection) { |
|
| 94 | 92 | $this->connection = $connection; |
| 95 | 93 | } |
| 96 | 94 | |
@@ -55,8 +55,7 @@ discard block |
||
| 55 | 55 | * @class QueryBuilder |
| 56 | 56 | * @package Platine\Database |
| 57 | 57 | */ |
| 58 | -class QueryBuilder |
|
| 59 | -{ |
|
| 58 | +class QueryBuilder { |
|
| 60 | 59 | /** |
| 61 | 60 | * The Connection instance |
| 62 | 61 | * @var Connection |
@@ -73,8 +72,7 @@ discard block |
||
| 73 | 72 | * Class constructor |
| 74 | 73 | * @param Connection $connection |
| 75 | 74 | */ |
| 76 | - public function __construct(Connection $connection) |
|
| 77 | - { |
|
| 75 | + public function __construct(Connection $connection) { |
|
| 78 | 76 | $this->connection = $connection; |
| 79 | 77 | $this->schema = $this->connection->getSchema(); |
| 80 | 78 | } |
@@ -113,8 +111,7 @@ discard block |
||
| 113 | 111 | * @param callable $callback |
| 114 | 112 | * @return mixed |
| 115 | 113 | */ |
| 116 | - public function transaction(callable $callback) |
|
| 117 | - { |
|
| 114 | + public function transaction(callable $callback) { |
|
| 118 | 115 | return $this->connection->transaction($callback, $this); |
| 119 | 116 | } |
| 120 | 117 | |
@@ -36,6 +36,5 @@ |
||
| 36 | 36 | * @class TransactionException |
| 37 | 37 | * @package Platine\Database\Exception |
| 38 | 38 | */ |
| 39 | -class TransactionException extends DatabaseException |
|
| 40 | -{ |
|
| 39 | +class TransactionException extends DatabaseException { |
|
| 41 | 40 | } |
@@ -38,6 +38,5 @@ |
||
| 38 | 38 | * @class ConnectionAlreadyExistsException |
| 39 | 39 | * @package Platine\Database\Exception |
| 40 | 40 | */ |
| 41 | -class ConnectionAlreadyExistsException extends Exception |
|
| 42 | -{ |
|
| 41 | +class ConnectionAlreadyExistsException extends Exception { |
|
| 43 | 42 | } |
@@ -36,6 +36,5 @@ |
||
| 36 | 36 | * @class ConnectionException |
| 37 | 37 | * @package Platine\Database\Exception |
| 38 | 38 | */ |
| 39 | -class ConnectionException extends DatabaseException |
|
| 40 | -{ |
|
| 39 | +class ConnectionException extends DatabaseException { |
|
| 41 | 40 | } |