@@ -29,8 +29,7 @@ |
||
| 29 | 29 | public function is ($arg): Predicate { |
| 30 | 30 | if ($arg === null or is_bool($arg)) { |
| 31 | 31 | $arg = ['' => 'NULL', 1 => 'TRUE', 0 => 'FALSE'][$arg]; |
| 32 | - } |
|
| 33 | - else { |
|
| 32 | + } else { |
|
| 34 | 33 | $arg = $this->db->quote($arg); |
| 35 | 34 | } |
| 36 | 35 | $oper = ['mysql' => '<=>', 'sqlite' => 'IS'][$this->db->getDriver()]; |
@@ -60,8 +60,7 @@ |
||
| 60 | 60 | public static function compare ($a, $b, $oper = '=', $subOper = 'ANY', $listOper = 'IN') { |
| 61 | 61 | if (is_array($b)) { |
| 62 | 62 | return new static("{$a} {$listOper} (" . implode(',', $b) . ")"); |
| 63 | - } |
|
| 64 | - elseif ($b instanceof Select) { |
|
| 63 | + } elseif ($b instanceof Select) { |
|
| 65 | 64 | return new static("{$a} {$oper} {$subOper} ({$b->toSql()})"); |
| 66 | 65 | } |
| 67 | 66 | return new static("{$a} {$oper} {$b}"); |
@@ -173,8 +173,7 @@ discard block |
||
| 173 | 173 | public function group (string $column) { |
| 174 | 174 | if (!strlen($this->_group)) { |
| 175 | 175 | $this->_group = " GROUP BY {$column}"; |
| 176 | - } |
|
| 177 | - else { |
|
| 176 | + } else { |
|
| 178 | 177 | $this->_group .= ", {$column}"; |
| 179 | 178 | } |
| 180 | 179 | return $this; |
@@ -189,8 +188,7 @@ discard block |
||
| 189 | 188 | public function having (string $condition) { |
| 190 | 189 | if (!strlen($this->_having)) { |
| 191 | 190 | $this->_having = " HAVING {$condition}"; |
| 192 | - } |
|
| 193 | - else { |
|
| 191 | + } else { |
|
| 194 | 192 | $this->_having .= " AND {$condition}"; |
| 195 | 193 | } |
| 196 | 194 | return $this; |
@@ -222,8 +220,7 @@ discard block |
||
| 222 | 220 | public function limit (int $limit, int $offset = 0) { |
| 223 | 221 | if ($limit == 0) { |
| 224 | 222 | $this->_limit = ''; |
| 225 | - } |
|
| 226 | - else { |
|
| 223 | + } else { |
|
| 227 | 224 | $this->_limit = " LIMIT {$limit}"; |
| 228 | 225 | if ($offset > 1) { |
| 229 | 226 | $this->_limit .= " OFFSET {$offset}"; |
@@ -314,8 +311,7 @@ discard block |
||
| 314 | 311 | public function where (string $condition) { |
| 315 | 312 | if (!strlen($this->_where)) { |
| 316 | 313 | $this->_where = " WHERE {$condition}"; |
| 317 | - } |
|
| 318 | - else { |
|
| 314 | + } else { |
|
| 319 | 315 | $this->_where .= " AND {$condition}"; |
| 320 | 316 | } |
| 321 | 317 | return $this; |
@@ -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 | } |