@@ -509,8 +509,7 @@ |
||
| 509 | 509 | 'sync' => $token, |
| 510 | 510 | 'opt_expand' => 'this' |
| 511 | 511 | ])); |
| 512 | - } |
|
| 513 | - catch (AsanaError $error) { |
|
| 512 | + } catch (AsanaError $error) { |
|
| 514 | 513 | if ($error->getCode() === 412) { |
| 515 | 514 | $remote = $this->_jsonDecode($error->getMessage()); |
| 516 | 515 | if (!isset($token)) { |
@@ -58,8 +58,7 @@ discard block |
||
| 58 | 58 | $this->_log("CACHE DELINK {$key}"); |
| 59 | 59 | unlink($ref); |
| 60 | 60 | unlink($path); |
| 61 | - } |
|
| 62 | - elseif (is_file($path)) { |
|
| 61 | + } elseif (is_file($path)) { |
|
| 63 | 62 | $this->_log("CACHE DELETE {$key}"); |
| 64 | 63 | unlink($path); |
| 65 | 64 | } |
@@ -117,8 +116,7 @@ discard block |
||
| 117 | 116 | ["CACHE SET {$key}", "CACHE BURN {$key}"][$value instanceof ImmutableInterface], |
| 118 | 117 | "CACHE UPDATE {$key}" |
| 119 | 118 | ][is_file($path)]); |
| 120 | - } |
|
| 121 | - else { |
|
| 119 | + } else { |
|
| 122 | 120 | $this->_log([ |
| 123 | 121 | "CACHE LINK {$key} => {$value}", |
| 124 | 122 | "CACHE RENEW LINK {$key} => {$value}" |
@@ -60,8 +60,7 @@ discard block |
||
| 60 | 60 | public function __construct ($caller, array $data = []) { |
| 61 | 61 | if ($caller instanceof self) { |
| 62 | 62 | $this->api = $caller->api; |
| 63 | - } |
|
| 64 | - else { |
|
| 63 | + } else { |
|
| 65 | 64 | $this->api = $caller; |
| 66 | 65 | } |
| 67 | 66 | $this->_setData($data); |
@@ -263,8 +262,7 @@ discard block |
||
| 263 | 262 | |
| 264 | 263 | if ($isList) { |
| 265 | 264 | $this->data[$field] = array_map($hydrate, $value); |
| 266 | - } |
|
| 267 | - else { |
|
| 265 | + } else { |
|
| 268 | 266 | $this->data[$field] = $hydrate($value); |
| 269 | 267 | } |
| 270 | 268 | } |
@@ -92,8 +92,7 @@ discard block |
||
| 92 | 92 | protected function _removeWithPost (string $rmPath, array $data, string $field, $diff) { |
| 93 | 93 | if ($this->hasGid()) { |
| 94 | 94 | return $this->_setWithPost($rmPath, $data, $field); |
| 95 | - } |
|
| 96 | - elseif (is_array($diff)) { |
|
| 95 | + } elseif (is_array($diff)) { |
|
| 97 | 96 | return $this->_set($field, array_values(array_diff($this->data[$field] ?? [], $diff))); |
| 98 | 97 | } |
| 99 | 98 | return $this->_set($field, array_values(array_filter($this->data[$field] ?? [], $diff))); |
@@ -109,11 +108,9 @@ discard block |
||
| 109 | 108 | protected function _save (string $dir = null) { |
| 110 | 109 | if (isset($dir)) { // create() |
| 111 | 110 | $remote = $this->api->post($dir, $this->getDiff(), ['expand' => 'this']); |
| 112 | - } |
|
| 113 | - elseif ($this->isDiff()) { // update() |
|
| 111 | + } elseif ($this->isDiff()) { // update() |
|
| 114 | 112 | $remote = $this->api->put($this, $this->getDiff(), ['expand' => 'this']); |
| 115 | - } |
|
| 116 | - else { // update() but no change |
|
| 113 | + } else { // update() but no change |
|
| 117 | 114 | return $this; |
| 118 | 115 | } |
| 119 | 116 | /** @var array $remote */ |
@@ -204,11 +201,9 @@ discard block |
||
| 204 | 201 | if (isset($field)) { |
| 205 | 202 | $remote = $this->api->get($this, [], ['fields' => static::OPT_FIELDS[$field] ?? $field]); |
| 206 | 203 | $this->_setMapped($field, $remote[$field] ?? null); |
| 207 | - } |
|
| 208 | - elseif ($remote = $this->api->get($this, [], ['expand' => 'this'])) { |
|
| 204 | + } elseif ($remote = $this->api->get($this, [], ['expand' => 'this'])) { |
|
| 209 | 205 | $this->_setData($remote); |
| 210 | - } |
|
| 211 | - else { // deleted upstream. |
|
| 206 | + } else { // deleted upstream. |
|
| 212 | 207 | $this->api->getPool()->remove($this->getPoolKeys()); |
| 213 | 208 | throw new RuntimeException("{$this} was deleted upstream."); |
| 214 | 209 | } |