@@ -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 | |
@@ -54,8 +54,7 @@ discard block |
||
| 54 | 54 | * Class Query |
| 55 | 55 | * @package Platine\Database\Query |
| 56 | 56 | */ |
| 57 | -class Query extends BaseStatement |
|
| 58 | -{ |
|
| 57 | +class Query extends BaseStatement { |
|
| 59 | 58 | |
| 60 | 59 | /** |
| 61 | 60 | * @var Connection |
@@ -89,8 +88,7 @@ discard block |
||
| 89 | 88 | * |
| 90 | 89 | * @return Select|SelectStatement |
| 91 | 90 | */ |
| 92 | - public function distinct(bool $value = true) |
|
| 93 | - { |
|
| 91 | + public function distinct(bool $value = true) { |
|
| 94 | 92 | return $this->buildSelect()->distinct($value); |
| 95 | 93 | } |
| 96 | 94 | |
@@ -99,8 +97,7 @@ discard block |
||
| 99 | 97 | * |
| 100 | 98 | * @return Select|SelectStatement |
| 101 | 99 | */ |
| 102 | - public function groupBy($columns) |
|
| 103 | - { |
|
| 100 | + public function groupBy($columns) { |
|
| 104 | 101 | return $this->buildSelect()->groupBy($columns); |
| 105 | 102 | } |
| 106 | 103 | |
@@ -110,8 +107,7 @@ discard block |
||
| 110 | 107 | * |
| 111 | 108 | * @return Select|SelectStatement |
| 112 | 109 | */ |
| 113 | - public function having($column, Closure $value = null) |
|
| 114 | - { |
|
| 110 | + public function having($column, Closure $value = null) { |
|
| 115 | 111 | return $this->buildSelect()->having($column, $value); |
| 116 | 112 | } |
| 117 | 113 | |
@@ -121,8 +117,7 @@ discard block |
||
| 121 | 117 | * |
| 122 | 118 | * @return Select|SelectStatement |
| 123 | 119 | */ |
| 124 | - public function orHaving($column, Closure $value = null) |
|
| 125 | - { |
|
| 120 | + public function orHaving($column, Closure $value = null) { |
|
| 126 | 121 | return $this->buildSelect()->orHaving($column, $value); |
| 127 | 122 | } |
| 128 | 123 | |
@@ -132,8 +127,7 @@ discard block |
||
| 132 | 127 | * |
| 133 | 128 | * @return Select|SelectStatement |
| 134 | 129 | */ |
| 135 | - public function orderBy($columns, string $order = 'ASC') |
|
| 136 | - { |
|
| 130 | + public function orderBy($columns, string $order = 'ASC') { |
|
| 137 | 131 | return $this->buildSelect()->orderBy($columns, $order); |
| 138 | 132 | } |
| 139 | 133 | |
@@ -142,8 +136,7 @@ discard block |
||
| 142 | 136 | * |
| 143 | 137 | * @return Select|SelectStatement |
| 144 | 138 | */ |
| 145 | - public function limit(int $value) |
|
| 146 | - { |
|
| 139 | + public function limit(int $value) { |
|
| 147 | 140 | return $this->buildSelect()->limit($value); |
| 148 | 141 | } |
| 149 | 142 | |
@@ -152,8 +145,7 @@ discard block |
||
| 152 | 145 | * |
| 153 | 146 | * @return Select|SelectStatement |
| 154 | 147 | */ |
| 155 | - public function offset(int $value) |
|
| 156 | - { |
|
| 148 | + public function offset(int $value) { |
|
| 157 | 149 | return $this->buildSelect()->offset($value); |
| 158 | 150 | } |
| 159 | 151 | |
@@ -161,8 +153,7 @@ discard block |
||
| 161 | 153 | * @param string $table |
| 162 | 154 | * @return Select|SelectStatement |
| 163 | 155 | */ |
| 164 | - public function into(string $table) |
|
| 165 | - { |
|
| 156 | + public function into(string $table) { |
|
| 166 | 157 | return $this->buildSelect()->into($table); |
| 167 | 158 | } |
| 168 | 159 | |
@@ -171,8 +162,7 @@ discard block |
||
| 171 | 162 | * |
| 172 | 163 | * @return ResultSet |
| 173 | 164 | */ |
| 174 | - public function select($columns = []) |
|
| 175 | - { |
|
| 165 | + public function select($columns = []) { |
|
| 176 | 166 | return $this->buildSelect()->select($columns); |
| 177 | 167 | } |
| 178 | 168 | |
@@ -190,8 +180,7 @@ discard block |
||
| 190 | 180 | * |
| 191 | 181 | * @return mixed |
| 192 | 182 | */ |
| 193 | - public function column($name) |
|
| 194 | - { |
|
| 183 | + public function column($name) { |
|
| 195 | 184 | return $this->buildSelect()->column($name); |
| 196 | 185 | } |
| 197 | 186 | |
@@ -212,8 +201,7 @@ discard block |
||
| 212 | 201 | * |
| 213 | 202 | * @return int|float |
| 214 | 203 | */ |
| 215 | - public function avg($column, bool $distinct = false) |
|
| 216 | - { |
|
| 204 | + public function avg($column, bool $distinct = false) { |
|
| 217 | 205 | return $this->buildSelect()->avg($column, $distinct); |
| 218 | 206 | } |
| 219 | 207 | |
@@ -223,8 +211,7 @@ discard block |
||
| 223 | 211 | * |
| 224 | 212 | * @return int|float |
| 225 | 213 | */ |
| 226 | - public function sum($column, bool $distinct = false) |
|
| 227 | - { |
|
| 214 | + public function sum($column, bool $distinct = false) { |
|
| 228 | 215 | return $this->buildSelect()->sum($column, $distinct); |
| 229 | 216 | } |
| 230 | 217 | |
@@ -234,8 +221,7 @@ discard block |
||
| 234 | 221 | * |
| 235 | 222 | * @return mixed |
| 236 | 223 | */ |
| 237 | - public function min($column, bool $distinct = false) |
|
| 238 | - { |
|
| 224 | + public function min($column, bool $distinct = false) { |
|
| 239 | 225 | return $this->buildSelect()->min($column, $distinct); |
| 240 | 226 | } |
| 241 | 227 | |
@@ -245,8 +231,7 @@ discard block |
||
| 245 | 231 | * |
| 246 | 232 | * @return mixed |
| 247 | 233 | */ |
| 248 | - public function max($column, bool $distinct = false) |
|
| 249 | - { |
|
| 234 | + public function max($column, bool $distinct = false) { |
|
| 250 | 235 | return $this->buildSelect()->max($column, $distinct); |
| 251 | 236 | } |
| 252 | 237 | |
@@ -52,8 +52,7 @@ discard block |
||
| 52 | 52 | * Class WhereStatement |
| 53 | 53 | * @package Platine\Database\Query |
| 54 | 54 | */ |
| 55 | -class WhereStatement |
|
| 56 | -{ |
|
| 55 | +class WhereStatement { |
|
| 57 | 56 | |
| 58 | 57 | /** |
| 59 | 58 | * The Query statement instance |
@@ -71,8 +70,7 @@ discard block |
||
| 71 | 70 | * WhereStatement constructor. |
| 72 | 71 | * @param QueryStatement|null $queryStatement |
| 73 | 72 | */ |
| 74 | - public function __construct(QueryStatement $queryStatement = null) |
|
| 75 | - { |
|
| 73 | + public function __construct(QueryStatement $queryStatement = null) { |
|
| 76 | 74 | if ($queryStatement === null) { |
| 77 | 75 | $queryStatement = new QueryStatement(); |
| 78 | 76 | } |
@@ -94,8 +92,7 @@ discard block |
||
| 94 | 92 | * |
| 95 | 93 | * @return WhereStatement|Where|Select|Delete|Update |
| 96 | 94 | */ |
| 97 | - public function where($column, bool $isExpression = false) |
|
| 98 | - { |
|
| 95 | + public function where($column, bool $isExpression = false) { |
|
| 99 | 96 | return $this->addWhereCondition($column, 'AND', $isExpression); |
| 100 | 97 | } |
| 101 | 98 | |
@@ -105,8 +102,7 @@ discard block |
||
| 105 | 102 | * |
| 106 | 103 | * @return WhereStatement|Where|Select|Delete|Update |
| 107 | 104 | */ |
| 108 | - public function orWhere($column, bool $isExpression = false) |
|
| 109 | - { |
|
| 105 | + public function orWhere($column, bool $isExpression = false) { |
|
| 110 | 106 | return $this->addWhereCondition($column, 'OR', $isExpression); |
| 111 | 107 | } |
| 112 | 108 | |
@@ -149,8 +145,7 @@ discard block |
||
| 149 | 145 | /** |
| 150 | 146 | * @inheritDoc |
| 151 | 147 | */ |
| 152 | - public function __clone() |
|
| 153 | - { |
|
| 148 | + public function __clone() { |
|
| 154 | 149 | $this->queryStatement = clone $this->queryStatement; |
| 155 | 150 | $this->where = new Where($this, $this->queryStatement); |
| 156 | 151 | } |
@@ -162,8 +157,7 @@ discard block |
||
| 162 | 157 | * |
| 163 | 158 | * @return WhereStatement|Where |
| 164 | 159 | */ |
| 165 | - protected function addWhereCondition($column, string $separator = 'AND', bool $isExpression = false) |
|
| 166 | - { |
|
| 160 | + protected function addWhereCondition($column, string $separator = 'AND', bool $isExpression = false) { |
|
| 167 | 161 | if (($column instanceof Closure) && !$isExpression) { |
| 168 | 162 | $this->queryStatement->addWhereGroup($column, $separator); |
| 169 | 163 | |
@@ -292,7 +292,7 @@ |
||
| 292 | 292 | bool $isColumn = false |
| 293 | 293 | ): WhereStatement { |
| 294 | 294 | if ($isColumn && is_string($value)) { |
| 295 | - $value = function (Expression $expr) use ($value) { |
|
| 295 | + $value = function(Expression $expr) use ($value) { |
|
| 296 | 296 | return $expr->column($value); |
| 297 | 297 | }; |
| 298 | 298 | } |
@@ -38,7 +38,6 @@ |
||
| 38 | 38 | * Class TransactionException |
| 39 | 39 | * @package Platine\Database\Exception |
| 40 | 40 | */ |
| 41 | -class TransactionException extends Exception |
|
| 42 | -{ |
|
| 41 | +class TransactionException extends Exception { |
|
| 43 | 42 | |
| 44 | 43 | } |
@@ -38,7 +38,6 @@ |
||
| 38 | 38 | * Class QueryException |
| 39 | 39 | * @package Platine\Database\Exception |
| 40 | 40 | */ |
| 41 | -class QueryException extends Exception |
|
| 42 | -{ |
|
| 41 | +class QueryException extends Exception { |
|
| 43 | 42 | |
| 44 | 43 | } |