@@ -31,8 +31,7 @@ |
||
| 31 | 31 | public static function fromInterface (DB $db, string $interface) { |
| 32 | 32 | try { |
| 33 | 33 | $ref = new ReflectionClass($interface); |
| 34 | - } |
|
| 35 | - catch (ReflectionException $exception) { |
|
| 34 | + } catch (ReflectionException $exception) { |
|
| 36 | 35 | throw new LogicException('Unexpected ReflectionException', 0, $exception); |
| 37 | 36 | } |
| 38 | 37 | $doc = $ref->getDocComment(); |
@@ -62,8 +62,7 @@ discard block |
||
| 62 | 62 | public static function fromClass (DB $db, $class) { |
| 63 | 63 | try { |
| 64 | 64 | $rClass = new ReflectionClass($class); |
| 65 | - } |
|
| 66 | - catch (ReflectionException $exception) { |
|
| 65 | + } catch (ReflectionException $exception) { |
|
| 67 | 66 | throw new LogicException('Unexpected ReflectionException', 0, $exception); |
| 68 | 67 | } |
| 69 | 68 | $columns = []; |
@@ -73,8 +72,7 @@ discard block |
||
| 73 | 72 | $name = $rProp->getName(); |
| 74 | 73 | if (preg_match('/@col(umn)?[\s$]/', $doc)) { |
| 75 | 74 | $columns[] = $name; |
| 76 | - } |
|
| 77 | - elseif (preg_match('/@eav\s+(?<table>\S+)/', $doc, $attr)) { |
|
| 75 | + } elseif (preg_match('/@eav\s+(?<table>\S+)/', $doc, $attr)) { |
|
| 78 | 76 | $eav[$name] = new EAV($db, $attr['table']); |
| 79 | 77 | } |
| 80 | 78 | } |
@@ -113,8 +111,7 @@ discard block |
||
| 113 | 111 | $rProp->setAccessible(true); |
| 114 | 112 | $this->properties[$name] = $rProp; |
| 115 | 113 | } |
| 116 | - } |
|
| 117 | - catch (ReflectionException $exception) { |
|
| 114 | + } catch (ReflectionException $exception) { |
|
| 118 | 115 | throw new LogicException('Unexpected ReflectionException', 0, $exception); |
| 119 | 116 | } |
| 120 | 117 | } |
@@ -242,8 +239,7 @@ discard block |
||
| 242 | 239 | public function save (EntityInterface $entity): int { |
| 243 | 240 | if (!$entity->getId()) { |
| 244 | 241 | $this->saveInsert($entity); |
| 245 | - } |
|
| 246 | - else { |
|
| 242 | + } else { |
|
| 247 | 243 | $this->saveUpdate($entity); |
| 248 | 244 | } |
| 249 | 245 | $this->saveEav($entity); |
@@ -196,8 +196,7 @@ |
||
| 196 | 196 | public function offsetSet ($class, $access) { |
| 197 | 197 | if ($access instanceof Record) { |
| 198 | 198 | $this->setRecord($class, $access); |
| 199 | - } |
|
| 200 | - else { |
|
| 199 | + } else { |
|
| 201 | 200 | $this->setJunction($class, $access); |
| 202 | 201 | } |
| 203 | 202 | } |
@@ -66,8 +66,7 @@ |
||
| 66 | 66 | } |
| 67 | 67 | if ($arg === null or is_bool($arg)) { |
| 68 | 68 | $arg = ['' => 'NULL', 1 => 'TRUE', 0 => 'FALSE'][$arg]; |
| 69 | - } |
|
| 70 | - else { |
|
| 69 | + } else { |
|
| 71 | 70 | $arg = $this->db->quote($arg); |
| 72 | 71 | } |
| 73 | 72 | $oper = ['mysql' => '<=>', 'sqlite' => 'IS'][$driver]; |
@@ -117,8 +117,7 @@ discard block |
||
| 117 | 117 | if ($table instanceof Select) { |
| 118 | 118 | $this->table = $table->toSubquery(); |
| 119 | 119 | $this->alias = uniqid('_') . "_{$table->alias}"; |
| 120 | - } |
|
| 121 | - else { |
|
| 120 | + } else { |
|
| 122 | 121 | $this->table = (string)$table; |
| 123 | 122 | $this->alias = uniqid('_') . "__{$table}"; |
| 124 | 123 | } |
@@ -228,8 +227,7 @@ discard block |
||
| 228 | 227 | public function group (string $column) { |
| 229 | 228 | if (!strlen($this->_group)) { |
| 230 | 229 | $this->_group = " GROUP BY {$column}"; |
| 231 | - } |
|
| 232 | - else { |
|
| 230 | + } else { |
|
| 233 | 231 | $this->_group .= ", {$column}"; |
| 234 | 232 | } |
| 235 | 233 | return $this; |
@@ -244,8 +242,7 @@ discard block |
||
| 244 | 242 | public function having (string $condition) { |
| 245 | 243 | if (!strlen($this->_having)) { |
| 246 | 244 | $this->_having = " HAVING {$condition}"; |
| 247 | - } |
|
| 248 | - else { |
|
| 245 | + } else { |
|
| 249 | 246 | $this->_having .= " AND {$condition}"; |
| 250 | 247 | } |
| 251 | 248 | return $this; |
@@ -264,8 +261,7 @@ discard block |
||
| 264 | 261 | $select->_limit = ''; |
| 265 | 262 | if ($all) { |
| 266 | 263 | $this->_import .= " INTERSECT ALL {$select->toSql()}"; |
| 267 | - } |
|
| 268 | - else { |
|
| 264 | + } else { |
|
| 269 | 265 | $this->_import .= " INTERSECT {$select->toSql()}"; |
| 270 | 266 | } |
| 271 | 267 | return $this; |
@@ -315,8 +311,7 @@ discard block |
||
| 315 | 311 | public function limit (int $limit, int $offset = 0) { |
| 316 | 312 | if ($limit == 0) { |
| 317 | 313 | $this->_limit = ''; |
| 318 | - } |
|
| 319 | - else { |
|
| 314 | + } else { |
|
| 320 | 315 | $this->_limit = " LIMIT {$limit}"; |
| 321 | 316 | if ($offset > 1) { |
| 322 | 317 | $this->_limit .= " OFFSET {$offset}"; |
@@ -454,8 +449,7 @@ discard block |
||
| 454 | 449 | $select->_limit = ''; |
| 455 | 450 | if ($all) { |
| 456 | 451 | $this->_import .= " UNION ALL {$select->toSql()}"; |
| 457 | - } |
|
| 458 | - else { |
|
| 452 | + } else { |
|
| 459 | 453 | $this->_import .= " UNION {$select->toSql()}"; |
| 460 | 454 | } |
| 461 | 455 | return $this; |
@@ -470,8 +464,7 @@ discard block |
||
| 470 | 464 | public function where (string $condition) { |
| 471 | 465 | if (!strlen($this->_where)) { |
| 472 | 466 | $this->_where = " WHERE {$condition}"; |
| 473 | - } |
|
| 474 | - else { |
|
| 467 | + } else { |
|
| 475 | 468 | $this->_where .= " AND {$condition}"; |
| 476 | 469 | } |
| 477 | 470 | return $this; |