@@ -53,8 +53,7 @@ discard block |
||
| 53 | 53 | * Class Select |
| 54 | 54 | * @package Platine\Database\Query |
| 55 | 55 | */ |
| 56 | -class Select extends SelectStatement |
|
| 57 | -{ |
|
| 56 | +class Select extends SelectStatement { |
|
| 58 | 57 | |
| 59 | 58 | /** |
| 60 | 59 | * @var Connection |
@@ -67,8 +66,7 @@ discard block |
||
| 67 | 66 | * @param string|array $tables |
| 68 | 67 | * @param QueryStatement|null $queryStatement |
| 69 | 68 | */ |
| 70 | - public function __construct(Connection $connection, $tables, QueryStatement $queryStatement = null) |
|
| 71 | - { |
|
| 69 | + public function __construct(Connection $connection, $tables, QueryStatement $queryStatement = null) { |
|
| 72 | 70 | parent::__construct($tables, $queryStatement); |
| 73 | 71 | $this->connection = $connection; |
| 74 | 72 | } |
@@ -78,8 +76,7 @@ discard block |
||
| 78 | 76 | * |
| 79 | 77 | * @return ResultSet |
| 80 | 78 | */ |
| 81 | - public function select($columns = []) |
|
| 82 | - { |
|
| 79 | + public function select($columns = []) { |
|
| 83 | 80 | parent::select($columns); |
| 84 | 81 | $driver = $this->connection->getDriver(); |
| 85 | 82 | |
@@ -94,8 +91,7 @@ discard block |
||
| 94 | 91 | * |
| 95 | 92 | * @return mixed|false |
| 96 | 93 | */ |
| 97 | - public function column($name) |
|
| 98 | - { |
|
| 94 | + public function column($name) { |
|
| 99 | 95 | parent::column($name); |
| 100 | 96 | return $this->getColumnResultSet(); |
| 101 | 97 | } |
@@ -118,8 +114,7 @@ discard block |
||
| 118 | 114 | * |
| 119 | 115 | * @return int|float |
| 120 | 116 | */ |
| 121 | - public function avg($column, bool $distinct = false) |
|
| 122 | - { |
|
| 117 | + public function avg($column, bool $distinct = false) { |
|
| 123 | 118 | parent::avg($column, $distinct); |
| 124 | 119 | return $this->getColumnResultSet(); |
| 125 | 120 | } |
@@ -130,8 +125,7 @@ discard block |
||
| 130 | 125 | * |
| 131 | 126 | * @return int|float |
| 132 | 127 | */ |
| 133 | - public function sum($column, bool $distinct = false) |
|
| 134 | - { |
|
| 128 | + public function sum($column, bool $distinct = false) { |
|
| 135 | 129 | parent::sum($column, $distinct); |
| 136 | 130 | return $this->getColumnResultSet(); |
| 137 | 131 | } |
@@ -142,8 +136,7 @@ discard block |
||
| 142 | 136 | * |
| 143 | 137 | * @return int|float |
| 144 | 138 | */ |
| 145 | - public function min($column, bool $distinct = false) |
|
| 146 | - { |
|
| 139 | + public function min($column, bool $distinct = false) { |
|
| 147 | 140 | parent::min($column, $distinct); |
| 148 | 141 | return $this->getColumnResultSet(); |
| 149 | 142 | } |
@@ -154,8 +147,7 @@ discard block |
||
| 154 | 147 | * |
| 155 | 148 | * @return int|float |
| 156 | 149 | */ |
| 157 | - public function max($column, bool $distinct = false) |
|
| 158 | - { |
|
| 150 | + public function max($column, bool $distinct = false) { |
|
| 159 | 151 | parent::max($column, $distinct); |
| 160 | 152 | return $this->getColumnResultSet(); |
| 161 | 153 | } |
@@ -164,8 +156,7 @@ discard block |
||
| 164 | 156 | * Return the result set for column |
| 165 | 157 | * @return mixed |
| 166 | 158 | */ |
| 167 | - protected function getColumnResultSet() |
|
| 168 | - { |
|
| 159 | + protected function getColumnResultSet() { |
|
| 169 | 160 | $driver = $this->connection->getDriver(); |
| 170 | 161 | return $this->connection->column( |
| 171 | 162 | $driver->select($this->queryStatement), |
@@ -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 $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; |
@@ -55,8 +55,7 @@ discard block |
||
| 55 | 55 | * Class Database |
| 56 | 56 | * @package Platine\Database |
| 57 | 57 | */ |
| 58 | -class Database |
|
| 59 | -{ |
|
| 58 | +class Database { |
|
| 60 | 59 | |
| 61 | 60 | /** |
| 62 | 61 | * The Connection instance |
@@ -74,8 +73,7 @@ discard block |
||
| 74 | 73 | * Class constructor |
| 75 | 74 | * @param Connection $connection |
| 76 | 75 | */ |
| 77 | - public function __construct(Connection $connection) |
|
| 78 | - { |
|
| 76 | + public function __construct(Connection $connection) { |
|
| 79 | 77 | $this->connection = $connection; |
| 80 | 78 | } |
| 81 | 79 | |
@@ -116,8 +114,7 @@ discard block |
||
| 116 | 114 | * @param callable $callback |
| 117 | 115 | * @return mixed |
| 118 | 116 | */ |
| 119 | - public function transaction(callable $callback) |
|
| 120 | - { |
|
| 117 | + public function transaction(callable $callback) { |
|
| 121 | 118 | return $this->connection->transaction($callback, $this); |
| 122 | 119 | } |
| 123 | 120 | |
@@ -664,7 +664,7 @@ |
||
| 664 | 664 | |
| 665 | 665 | return preg_replace_callback( |
| 666 | 666 | '/\?/', |
| 667 | - function () use ($driver, &$params) { |
|
| 667 | + function() use ($driver, &$params) { |
|
| 668 | 668 | $param = array_shift($params); |
| 669 | 669 | $param = is_object($param) ? get_class($param) : $param; |
| 670 | 670 | if (is_int($param) || is_float($param)) { |
@@ -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 |
@@ -130,8 +129,7 @@ discard block |
||
| 130 | 129 | * @param array $config |
| 131 | 130 | * @throws ConnectionException |
| 132 | 131 | */ |
| 133 | - public function __construct(array $config) |
|
| 134 | - { |
|
| 132 | + public function __construct(array $config) { |
|
| 135 | 133 | if (isset($config['logger'])) { |
| 136 | 134 | if (!$config['logger'] instanceof Logger) { |
| 137 | 135 | throw new InvalidArgumentException(sprintf( |
@@ -574,8 +572,7 @@ discard block |
||
| 574 | 572 | * @return mixed |
| 575 | 573 | * @throws QueryException |
| 576 | 574 | */ |
| 577 | - public function exec(string $sql, array $params = []) |
|
| 578 | - { |
|
| 575 | + public function exec(string $sql, array $params = []) { |
|
| 579 | 576 | return $this->execute($this->prepare($sql, $params)); |
| 580 | 577 | } |
| 581 | 578 | |
@@ -605,8 +602,7 @@ discard block |
||
| 605 | 602 | * @return mixed |
| 606 | 603 | * @throws QueryException |
| 607 | 604 | */ |
| 608 | - public function column(string $sql, array $params = []) |
|
| 609 | - { |
|
| 605 | + public function column(string $sql, array $params = []) { |
|
| 610 | 606 | $prepared = $this->prepare($sql, $params); |
| 611 | 607 | $this->execute($prepared); |
| 612 | 608 | |
@@ -50,8 +50,7 @@ discard block |
||
| 50 | 50 | * Class CreateTable |
| 51 | 51 | * @package Platine\Database\Schema |
| 52 | 52 | */ |
| 53 | -class CreateTable |
|
| 54 | -{ |
|
| 53 | +class CreateTable { |
|
| 55 | 54 | |
| 56 | 55 | /** |
| 57 | 56 | * The list of CreateColumn |
@@ -105,8 +104,7 @@ discard block |
||
| 105 | 104 | * Class constructor |
| 106 | 105 | * @param string $table |
| 107 | 106 | */ |
| 108 | - public function __construct(string $table) |
|
| 109 | - { |
|
| 107 | + public function __construct(string $table) { |
|
| 110 | 108 | $this->table = $table; |
| 111 | 109 | } |
| 112 | 110 | |
@@ -132,8 +130,7 @@ discard block |
||
| 132 | 130 | * |
| 133 | 131 | * @return mixed |
| 134 | 132 | */ |
| 135 | - public function getPrimaryKey() |
|
| 136 | - { |
|
| 133 | + public function getPrimaryKey() { |
|
| 137 | 134 | return $this->primaryKey; |
| 138 | 135 | } |
| 139 | 136 | |
@@ -50,8 +50,7 @@ discard block |
||
| 50 | 50 | * Class AlterTable |
| 51 | 51 | * @package Platine\Database\Schema |
| 52 | 52 | */ |
| 53 | -class AlterTable |
|
| 54 | -{ |
|
| 53 | +class AlterTable { |
|
| 55 | 54 | |
| 56 | 55 | /** |
| 57 | 56 | * The name of table |
@@ -69,8 +68,7 @@ discard block |
||
| 69 | 68 | * Class constructor |
| 70 | 69 | * @param string $table |
| 71 | 70 | */ |
| 72 | - public function __construct(string $table) |
|
| 73 | - { |
|
| 71 | + public function __construct(string $table) { |
|
| 74 | 72 | $this->table = $table; |
| 75 | 73 | } |
| 76 | 74 | |
@@ -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 | } |
@@ -151,8 +149,7 @@ discard block |
||
| 151 | 149 | * @param string $name |
| 152 | 150 | * @param mixed|null $default |
| 153 | 151 | */ |
| 154 | - public function get(string $name, $default = null) |
|
| 155 | - { |
|
| 152 | + public function get(string $name, $default = null) { |
|
| 156 | 153 | return isset($this->properties[$name]) ? $this->properties[$name] : $default; |
| 157 | 154 | } |
| 158 | 155 | |
@@ -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 $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 | |
@@ -50,8 +50,7 @@ discard block |
||
| 50 | 50 | * Class CreateColumn |
| 51 | 51 | * @package Platine\Database\Schema |
| 52 | 52 | */ |
| 53 | -class CreateColumn extends BaseColumn |
|
| 54 | -{ |
|
| 53 | +class CreateColumn extends BaseColumn { |
|
| 55 | 54 | |
| 56 | 55 | /** |
| 57 | 56 | * The associated table instance |
@@ -65,8 +64,7 @@ discard block |
||
| 65 | 64 | * @param string $name |
| 66 | 65 | * @param string|null $type |
| 67 | 66 | */ |
| 68 | - public function __construct(CreateTable $table, string $name, ?string $type = null) |
|
| 69 | - { |
|
| 67 | + public function __construct(CreateTable $table, string $name, ?string $type = null) { |
|
| 70 | 68 | $this->table = $table; |
| 71 | 69 | parent::__construct($name, $type); |
| 72 | 70 | } |