@@ -109,8 +109,7 @@ discard block |
||
| 109 | 109 | protected function _removeWithPost (string $rmPath, array $data, string $field, $diff) { |
| 110 | 110 | if ($this->hasGid()) { |
| 111 | 111 | return $this->_setWithPost($rmPath, $data, $field); |
| 112 | - } |
|
| 113 | - elseif (is_array($diff)) { |
|
| 112 | + } elseif (is_array($diff)) { |
|
| 114 | 113 | return $this->_set($field, array_values(array_diff($this->data[$field] ?? [], $diff))); |
| 115 | 114 | } |
| 116 | 115 | return $this->_set($field, array_values(array_filter($this->data[$field] ?? [], $diff))); |
@@ -126,11 +125,9 @@ discard block |
||
| 126 | 125 | protected function _save (string $dir = null) { |
| 127 | 126 | if (isset($dir)) { |
| 128 | 127 | $remote = $this->api->post($dir, $this->getDiff(), ['expand' => 'this']); |
| 129 | - } |
|
| 130 | - elseif ($this->isDiff()) { |
|
| 128 | + } elseif ($this->isDiff()) { |
|
| 131 | 129 | $remote = $this->api->put($this, $this->getDiff(), ['expand' => 'this']); |
| 132 | - } |
|
| 133 | - else { |
|
| 130 | + } else { |
|
| 134 | 131 | return $this; |
| 135 | 132 | } |
| 136 | 133 | /** @var array $remote */ |
@@ -186,11 +183,9 @@ discard block |
||
| 186 | 183 | $optField = static::$optFields[$field] ?? $field; |
| 187 | 184 | $value = $this->api->get($this, [], ['fields' => $optField])[$field] ?? null; |
| 188 | 185 | $this->_setMapped($field, $value); |
| 189 | - } |
|
| 190 | - elseif ($remote = $this->api->get($this, [], ['expand' => 'this'])) { |
|
| 186 | + } elseif ($remote = $this->api->get($this, [], ['expand' => 'this'])) { |
|
| 191 | 187 | $this->_setData($remote); |
| 192 | - } |
|
| 193 | - else { // deleted upstream. |
|
| 188 | + } else { // deleted upstream. |
|
| 194 | 189 | $this->api->getCache()->remove($this); |
| 195 | 190 | throw new RuntimeException("{$this} was deleted upstream."); |
| 196 | 191 | } |