@@ -89,11 +89,9 @@ discard block |
||
89 | 89 | protected function _removeWithPost (string $path, array $data, string $field, $diff) { |
90 | 90 | if ($this->hasGid()) { |
91 | 91 | return $this->_setWithPost($path, $data, $field); |
92 | - } |
|
93 | - elseif (is_array($diff)) { |
|
92 | + } elseif (is_array($diff)) { |
|
94 | 93 | $this->_set($field, array_values(array_diff($this->data[$field] ?? [], $diff))); |
95 | - } |
|
96 | - else { |
|
94 | + } else { |
|
97 | 95 | $this->_set($field, array_filter($this->data[$field] ?? [], $diff)); |
98 | 96 | } |
99 | 97 | return $this; |
@@ -109,11 +107,9 @@ discard block |
||
109 | 107 | protected function _save (string $dir = null) { |
110 | 108 | if (isset($dir)) { |
111 | 109 | $remote = $this->api->post($dir, $this->getDiff(), ['expand' => 'this']); |
112 | - } |
|
113 | - elseif ($this->isDiff()) { |
|
110 | + } elseif ($this->isDiff()) { |
|
114 | 111 | $remote = $this->api->put($this, $this->getDiff(), ['expand' => 'this']); |
115 | - } |
|
116 | - else { |
|
112 | + } else { |
|
117 | 113 | return $this; |
118 | 114 | } |
119 | 115 | /** @var array $remote */ |
@@ -169,11 +165,9 @@ discard block |
||
169 | 165 | $optField = static::$optFields[$field] ?? $field; |
170 | 166 | $value = $this->api->get($this, [], ['fields' => $optField])[$field] ?? null; |
171 | 167 | $this->_setMapped($field, $value); |
172 | - } |
|
173 | - elseif ($remote = $this->api->get($this, [], ['expand' => 'this'])) { |
|
168 | + } elseif ($remote = $this->api->get($this, [], ['expand' => 'this'])) { |
|
174 | 169 | $this->_setData($remote); |
175 | - } |
|
176 | - else { // deleted upstream. |
|
170 | + } else { // deleted upstream. |
|
177 | 171 | $this->api->getCache()->remove($this); |
178 | 172 | throw new RuntimeException("{$this} was deleted upstream."); |
179 | 173 | } |