@@ -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 | } |
@@ -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; |
@@ -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() |
@@ -41,11 +41,9 @@ |
||
41 | 41 | if ($field['type'] === CustomField::TYPE_ENUM) { |
42 | 42 | $this->optionNames[$gid] = array_column($field['enum_options'], 'name', 'gid'); |
43 | 43 | $this->data[$gid] = $field['enum_value']['gid']; |
44 | - } |
|
45 | - elseif ($field['type'] === CustomField::TYPE_TEXT) { |
|
44 | + } elseif ($field['type'] === CustomField::TYPE_TEXT) { |
|
46 | 45 | $this->data[$gid] = $field['text_value']; |
47 | - } |
|
48 | - elseif ($field['type'] === CustomField::TYPE_NUMBER) { |
|
46 | + } elseif ($field['type'] === CustomField::TYPE_NUMBER) { |
|
49 | 47 | $this->data[$gid] = $field['number_value']; |
50 | 48 | } |
51 | 49 | } |
@@ -68,8 +68,7 @@ discard block |
||
68 | 68 | $this->data[$key] = array_values(array_unique($this->data[$key])); |
69 | 69 | if ($force) { |
70 | 70 | $this->diff[$key] = true; |
71 | - } |
|
72 | - else { |
|
71 | + } else { |
|
73 | 72 | $this->api->getCache()->add($this); |
74 | 73 | } |
75 | 74 | } |
@@ -117,8 +116,7 @@ discard block |
||
117 | 116 | if (isset($key)) { |
118 | 117 | $value = $this->api->get($this, [], ['fields' => static::$optFields[$key] ?? $key])[$key] ?? null; |
119 | 118 | $this->_setMapped($key, $value); |
120 | - } |
|
121 | - else { |
|
119 | + } else { |
|
122 | 120 | $this->_setData($this->api->get($this, [], ['expand' => 'this'])); |
123 | 121 | } |
124 | 122 | $this->api->getCache()->add($this); |
@@ -73,8 +73,7 @@ |
||
73 | 73 | if ($this->hasGid()) { |
74 | 74 | $this->api->post("{$this}/addMembers", ['members' => array_column($users, 'gid')]); |
75 | 75 | $this->_merge('members', $users); |
76 | - } |
|
77 | - else { |
|
76 | + } else { |
|
78 | 77 | $this->_merge('members', $users, true); |
79 | 78 | } |
80 | 79 | return $this; |