@@ -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 | } |
@@ -111,8 +111,7 @@ discard block |
||
| 111 | 111 | if ($table instanceof Select) { |
| 112 | 112 | $this->table = $table->toSubquery(); |
| 113 | 113 | $this->alias = uniqid('_') . "_{$table->alias}"; |
| 114 | - } |
|
| 115 | - else { |
|
| 114 | + } else { |
|
| 116 | 115 | $this->table = (string)$table; |
| 117 | 116 | $this->alias = uniqid('_') . "__{$table}"; |
| 118 | 117 | } |
@@ -222,8 +221,7 @@ discard block |
||
| 222 | 221 | public function group (string $column) { |
| 223 | 222 | if (!strlen($this->_group)) { |
| 224 | 223 | $this->_group = " GROUP BY {$column}"; |
| 225 | - } |
|
| 226 | - else { |
|
| 224 | + } else { |
|
| 227 | 225 | $this->_group .= ", {$column}"; |
| 228 | 226 | } |
| 229 | 227 | return $this; |
@@ -238,8 +236,7 @@ discard block |
||
| 238 | 236 | public function having (string $condition) { |
| 239 | 237 | if (!strlen($this->_having)) { |
| 240 | 238 | $this->_having = " HAVING {$condition}"; |
| 241 | - } |
|
| 242 | - else { |
|
| 239 | + } else { |
|
| 243 | 240 | $this->_having .= " AND {$condition}"; |
| 244 | 241 | } |
| 245 | 242 | return $this; |
@@ -289,8 +286,7 @@ discard block |
||
| 289 | 286 | public function limit (int $limit, int $offset = 0) { |
| 290 | 287 | if ($limit == 0) { |
| 291 | 288 | $this->_limit = ''; |
| 292 | - } |
|
| 293 | - else { |
|
| 289 | + } else { |
|
| 294 | 290 | $this->_limit = " LIMIT {$limit}"; |
| 295 | 291 | if ($offset > 1) { |
| 296 | 292 | $this->_limit .= " OFFSET {$offset}"; |
@@ -367,8 +363,7 @@ discard block |
||
| 367 | 363 | } |
| 368 | 364 | if ($name !== $alias) { |
| 369 | 365 | $_columns[] = "{$column} AS {$alias}"; |
| 370 | - } |
|
| 371 | - else { |
|
| 366 | + } else { |
|
| 372 | 367 | $_columns[] = "{$column}"; |
| 373 | 368 | } |
| 374 | 369 | if (is_string($name)) { |
@@ -424,8 +419,7 @@ discard block |
||
| 424 | 419 | public function where (string $condition) { |
| 425 | 420 | if (!strlen($this->_where)) { |
| 426 | 421 | $this->_where = " WHERE {$condition}"; |
| 427 | - } |
|
| 428 | - else { |
|
| 422 | + } else { |
|
| 429 | 423 | $this->_where .= " AND {$condition}"; |
| 430 | 424 | } |
| 431 | 425 | return $this; |
@@ -59,8 +59,7 @@ |
||
| 59 | 59 | public static function compare ($a, $b, $oper = '=', $listOper = 'IN') { |
| 60 | 60 | if (is_array($b)) { |
| 61 | 61 | return new static("{$a} {$listOper} (" . implode(',', $b) . ")"); |
| 62 | - } |
|
| 63 | - elseif ($b instanceof Select) { |
|
| 62 | + } elseif ($b instanceof Select) { |
|
| 64 | 63 | return new static("{$a} {$listOper} ({$b->toSql()})"); |
| 65 | 64 | } |
| 66 | 65 | return new static("{$a} {$oper} {$b}"); |
@@ -56,8 +56,7 @@ |
||
| 56 | 56 | public function is ($arg): Predicate { |
| 57 | 57 | if ($arg === null or is_bool($arg)) { |
| 58 | 58 | $arg = ['' => 'NULL', 1 => 'TRUE', 0 => 'FALSE'][$arg]; |
| 59 | - } |
|
| 60 | - else { |
|
| 59 | + } else { |
|
| 61 | 60 | $arg = $this->db->quote($arg); |
| 62 | 61 | } |
| 63 | 62 | switch ($this->db) { |