@@ -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 (Exception $exception) { |
|
| 42 | + } catch (Exception $exception) { |
|
| 44 | 43 | return 'none'; // unreachable |
| 45 | 44 | } |
| 46 | 45 | } |
@@ -33,8 +33,7 @@ |
||
| 33 | 33 | protected function _setMapped (string $field, $value): void { |
| 34 | 34 | if (!is_array($value)) { |
| 35 | 35 | $this->data[$field] = $value; |
| 36 | - } |
|
| 37 | - else { |
|
| 36 | + } else { |
|
| 38 | 37 | parent::_setMapped($field, $value); |
| 39 | 38 | } |
| 40 | 39 | } |
@@ -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 | } |
@@ -84,8 +84,7 @@ discard block |
||
| 84 | 84 | protected function _removeWithPost (string $rmPath, array $data, string $field, $diff) { |
| 85 | 85 | if ($this->hasGid()) { |
| 86 | 86 | return $this->_setWithPost($rmPath, $data, $field); |
| 87 | - } |
|
| 88 | - elseif (is_array($diff)) { |
|
| 87 | + } elseif (is_array($diff)) { |
|
| 89 | 88 | return $this->_set($field, array_values(array_diff($this->data[$field] ?? [], $diff))); |
| 90 | 89 | } |
| 91 | 90 | return $this->_set($field, array_values(array_filter($this->data[$field] ?? [], $diff))); |
@@ -173,11 +172,9 @@ discard block |
||
| 173 | 172 | if (isset($field)) { |
| 174 | 173 | $remote = $this->api->get($this, [], ['fields' => static::OPT_FIELDS[$field] ?? $field]); |
| 175 | 174 | $this->_setMapped($field, $remote[$field] ?? null); |
| 176 | - } |
|
| 177 | - elseif ($remote = $this->api->get($this, [], ['expand' => 'this'])) { |
|
| 175 | + } elseif ($remote = $this->api->get($this, [], ['expand' => 'this'])) { |
|
| 178 | 176 | $this->_setData($remote); |
| 179 | - } |
|
| 180 | - else { // deleted upstream. |
|
| 177 | + } else { // deleted upstream. |
|
| 181 | 178 | $this->api->getPool()->remove($this->getPoolKeys()); |
| 182 | 179 | throw new RuntimeException("{$this} was deleted upstream."); |
| 183 | 180 | } |