@@ -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 | } |
@@ -108,8 +108,7 @@ discard block |
||
108 | 108 | if ($table instanceof Select) { |
109 | 109 | $this->table = $table->toSubquery(); |
110 | 110 | $this->alias = uniqid('_') . "_{$table->alias}"; |
111 | - } |
|
112 | - else { |
|
111 | + } else { |
|
113 | 112 | $this->table = (string)$table; |
114 | 113 | $this->alias = uniqid('_') . "__{$table}"; |
115 | 114 | } |
@@ -219,8 +218,7 @@ discard block |
||
219 | 218 | public function group (string $column) { |
220 | 219 | if (!strlen($this->_group)) { |
221 | 220 | $this->_group = " GROUP BY {$column}"; |
222 | - } |
|
223 | - else { |
|
221 | + } else { |
|
224 | 222 | $this->_group .= ", {$column}"; |
225 | 223 | } |
226 | 224 | return $this; |
@@ -235,8 +233,7 @@ discard block |
||
235 | 233 | public function having (string $condition) { |
236 | 234 | if (!strlen($this->_having)) { |
237 | 235 | $this->_having = " HAVING {$condition}"; |
238 | - } |
|
239 | - else { |
|
236 | + } else { |
|
240 | 237 | $this->_having .= " AND {$condition}"; |
241 | 238 | } |
242 | 239 | return $this; |
@@ -286,8 +283,7 @@ discard block |
||
286 | 283 | public function limit (int $limit, int $offset = 0) { |
287 | 284 | if ($limit == 0) { |
288 | 285 | $this->_limit = ''; |
289 | - } |
|
290 | - else { |
|
286 | + } else { |
|
291 | 287 | $this->_limit = " LIMIT {$limit}"; |
292 | 288 | if ($offset > 1) { |
293 | 289 | $this->_limit .= " OFFSET {$offset}"; |
@@ -366,8 +362,7 @@ discard block |
||
366 | 362 | } |
367 | 363 | if ($name === $alias) { |
368 | 364 | $_columns[] = "{$column}"; |
369 | - } |
|
370 | - else { |
|
365 | + } else { |
|
371 | 366 | $_columns[] = "{$column} AS {$alias}"; |
372 | 367 | } |
373 | 368 | $i++; |
@@ -419,8 +414,7 @@ discard block |
||
419 | 414 | public function where (string $condition) { |
420 | 415 | if (!strlen($this->_where)) { |
421 | 416 | $this->_where = " WHERE {$condition}"; |
422 | - } |
|
423 | - else { |
|
417 | + } else { |
|
424 | 418 | $this->_where .= " AND {$condition}"; |
425 | 419 | } |
426 | 420 | return $this; |
@@ -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]; |