@@ -39,8 +39,7 @@ |
||
| 39 | 39 | try { |
| 40 | 40 | $colors = (new ReflectionClass(self::class))->getConstants(); |
| 41 | 41 | return $colors[array_rand($colors)]; |
| 42 | - } |
|
| 43 | - catch (ReflectionException $exception) { |
|
| 42 | + } catch (ReflectionException $exception) { |
|
| 44 | 43 | return 'none'; // unreachable |
| 45 | 44 | } |
| 46 | 45 | } |
@@ -68,8 +68,7 @@ discard block |
||
| 68 | 68 | 'enum_option' => $this->getGid(), |
| 69 | 69 | 'after_enum_option' => $option->getGid() |
| 70 | 70 | ]); |
| 71 | - } |
|
| 72 | - else { |
|
| 71 | + } else { |
|
| 73 | 72 | unset($this->data['insert_before'], $this->diff['insert_before']); |
| 74 | 73 | $this->_set('insert_after', $option->getGid()); |
| 75 | 74 | } |
@@ -87,8 +86,7 @@ discard block |
||
| 87 | 86 | 'enum_option' => $this->getGid(), |
| 88 | 87 | 'before_enum_option' => $option->getGid() |
| 89 | 88 | ]); |
| 90 | - } |
|
| 91 | - else { |
|
| 89 | + } else { |
|
| 92 | 90 | unset($this->data['insert_after'], $this->diff['insert_after']); |
| 93 | 91 | $this->_set('insert_before', $option->getGid()); |
| 94 | 92 | } |
@@ -62,8 +62,7 @@ |
||
| 62 | 62 | $option->setName($name); |
| 63 | 63 | if ($this->hasGid()) { |
| 64 | 64 | $option->create(); |
| 65 | - } |
|
| 66 | - else { |
|
| 65 | + } else { |
|
| 67 | 66 | $this->diff['enum_options'] = true; |
| 68 | 67 | } |
| 69 | 68 | $this->data['enum_options'][] = $option; |
@@ -460,8 +460,7 @@ |
||
| 460 | 460 | 'sync' => $token, |
| 461 | 461 | 'opt_expand' => 'this' |
| 462 | 462 | ])); |
| 463 | - } |
|
| 464 | - catch (Error $error) { |
|
| 463 | + } catch (Error $error) { |
|
| 465 | 464 | if ($error->getCode() !== 412) { |
| 466 | 465 | throw $error; |
| 467 | 466 | } |
@@ -179,8 +179,7 @@ discard block |
||
| 179 | 179 | if ($this->hasGid()) { |
| 180 | 180 | $this->api->post("{$this}/addFollowers", ['followers' => static::_getGids($users)]); |
| 181 | 181 | $this->_merge('followers', $users); |
| 182 | - } |
|
| 183 | - else { |
|
| 182 | + } else { |
|
| 184 | 183 | $this->_merge('followers', $users, true); |
| 185 | 184 | } |
| 186 | 185 | return $this; |
@@ -196,8 +195,7 @@ discard block |
||
| 196 | 195 | if ($this->hasGid()) { |
| 197 | 196 | $this->api->post("{$this}/addTag", ['tag' => $tag->getGid()]); |
| 198 | 197 | $this->_merge('tags', [$tag]); |
| 199 | - } |
|
| 200 | - else { |
|
| 198 | + } else { |
|
| 201 | 199 | $this->_merge('tags', [$tag], true); |
| 202 | 200 | } |
| 203 | 201 | return $this; |
@@ -222,8 +220,7 @@ discard block |
||
| 222 | 220 | 'section' => $section |
| 223 | 221 | ]); |
| 224 | 222 | } |
| 225 | - } |
|
| 226 | - else { |
|
| 223 | + } else { |
|
| 227 | 224 | if (!$this->hasWorkspace()) { |
| 228 | 225 | $this->setWorkspace($project->getWorkspace()); |
| 229 | 226 | } |
@@ -509,8 +506,7 @@ discard block |
||
| 509 | 506 | if ($this->hasGid()) { |
| 510 | 507 | $this->api->post("{$this}/setParent", ['parent' => $parent ? $parent->getGid() : null]); |
| 511 | 508 | $this->data['parent'] = $parent; |
| 512 | - } |
|
| 513 | - else { |
|
| 509 | + } else { |
|
| 514 | 510 | $this->_set('parent', $parent); |
| 515 | 511 | } |
| 516 | 512 | return $this; |
@@ -59,8 +59,7 @@ discard block |
||
| 59 | 59 | $this->data[$key] = array_values(array_unique($this->data[$key])); |
| 60 | 60 | if ($force) { |
| 61 | 61 | $this->diff[$key] = true; |
| 62 | - } |
|
| 63 | - else { |
|
| 62 | + } else { |
|
| 64 | 63 | $this->api->getCache()->add($this); |
| 65 | 64 | } |
| 66 | 65 | } |
@@ -110,8 +109,7 @@ discard block |
||
| 110 | 109 | $map = $this->_getMap(); |
| 111 | 110 | $this->data[$key] = isset($map[$key]) ? $this->_getMapped($map[$key], $value) : $value; |
| 112 | 111 | unset($this->diff[$key]); |
| 113 | - } |
|
| 114 | - else { |
|
| 112 | + } else { |
|
| 115 | 113 | $this->_setData($this->api->get($this, [], ['expand' => 'this'])); |
| 116 | 114 | } |
| 117 | 115 | $this->api->getCache()->add($this); |
@@ -291,11 +291,9 @@ |
||
| 291 | 291 | $dehydrate = function($each) use (&$dehydrate) { |
| 292 | 292 | if ($each instanceof AbstractEntity and $each->hasGid()) { |
| 293 | 293 | return $each->getGid(); |
| 294 | - } |
|
| 295 | - elseif ($each instanceof self) { |
|
| 294 | + } elseif ($each instanceof self) { |
|
| 296 | 295 | return $each->toArray(); |
| 297 | - } |
|
| 298 | - elseif (is_array($each)) { |
|
| 296 | + } elseif (is_array($each)) { |
|
| 299 | 297 | return array_map($dehydrate, $each); |
| 300 | 298 | } |
| 301 | 299 | return $each; |
@@ -73,8 +73,7 @@ |
||
| 73 | 73 | if ($this->hasGid()) { |
| 74 | 74 | $this->api->post("{$this}/addMembers", ['members' => static::_getGids($users)]); |
| 75 | 75 | $this->_merge('members', $users); |
| 76 | - } |
|
| 77 | - else { |
|
| 76 | + } else { |
|
| 78 | 77 | $this->_merge('members', $users, true); |
| 79 | 78 | } |
| 80 | 79 | return $this; |
@@ -68,8 +68,7 @@ |
||
| 68 | 68 | /** @var null|AbstractEntity $entity */ |
| 69 | 69 | if ($entity = $this->get($entity, $caller, $factory)) { |
| 70 | 70 | $this->cache->set($key, $entity->getGid()); // renew potentially nonstandard key |
| 71 | - } |
|
| 72 | - else { |
|
| 71 | + } else { |
|
| 73 | 72 | $this->cache->delete($key); // remove invalid key |
| 74 | 73 | } |
| 75 | 74 | return $entity; // null or hydrated. parent calls add() |