@@ -53,8 +53,7 @@ |
||
| 53 | 53 | * Class PostgreSQL |
| 54 | 54 | * @package Platine\Database\Driver |
| 55 | 55 | */ |
| 56 | -class PostgreSQL extends Driver |
|
| 57 | -{ |
|
| 56 | +class PostgreSQL extends Driver { |
|
| 58 | 57 | |
| 59 | 58 | /** |
| 60 | 59 | * @inheritDoc |
@@ -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 | /** |
| 60 | 59 | * The Connection instance |
@@ -84,8 +83,7 @@ discard block |
||
| 84 | 83 | * Class constructor |
| 85 | 84 | * @param Connection $connection |
| 86 | 85 | */ |
| 87 | - public function __construct(Connection $connection) |
|
| 88 | - { |
|
| 86 | + public function __construct(Connection $connection) { |
|
| 89 | 87 | $this->connection = $connection; |
| 90 | 88 | } |
| 91 | 89 | |
@@ -64,8 +64,7 @@ discard block |
||
| 64 | 64 | * Class Connection |
| 65 | 65 | * @package Platine\Database |
| 66 | 66 | */ |
| 67 | -class Connection |
|
| 68 | -{ |
|
| 67 | +class Connection { |
|
| 69 | 68 | |
| 70 | 69 | /** |
| 71 | 70 | * The PDO instance |
@@ -544,8 +543,7 @@ discard block |
||
| 544 | 543 | * @return mixed |
| 545 | 544 | * @throws QueryException |
| 546 | 545 | */ |
| 547 | - public function exec(string $sql, array $params = []) |
|
| 548 | - { |
|
| 546 | + public function exec(string $sql, array $params = []) { |
|
| 549 | 547 | return $this->execute($this->prepare($sql, $params)); |
| 550 | 548 | } |
| 551 | 549 | |
@@ -575,8 +573,7 @@ discard block |
||
| 575 | 573 | * @return mixed |
| 576 | 574 | * @throws QueryException |
| 577 | 575 | */ |
| 578 | - public function column(string $sql, array $params = []) |
|
| 579 | - { |
|
| 576 | + public function column(string $sql, array $params = []) { |
|
| 580 | 577 | $prepared = $this->prepare($sql, $params); |
| 581 | 578 | $this->execute($prepared); |
| 582 | 579 | |
@@ -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; |
@@ -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 | |
@@ -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 | } |