@@ -41,8 +41,7 @@ |
||
| 41 | 41 | $type = static::getType(); |
| 42 | 42 | if (!$this->hasId()) { |
| 43 | 43 | $remote = $this->api->post($this->getDir(), [$type => $this->getPatch()]); |
| 44 | - } |
|
| 45 | - else { |
|
| 44 | + } else { |
|
| 46 | 45 | assert($this->canUpdate); |
| 47 | 46 | $remote = $this->api->put($this, [$type => $this->getPatch()]); |
| 48 | 47 | } |
@@ -128,8 +128,7 @@ |
||
| 128 | 128 | public function __construct ($caller, array $data = []) { |
| 129 | 129 | if ($caller instanceof Api) { |
| 130 | 130 | $this->api = $caller; |
| 131 | - } |
|
| 132 | - elseif ($caller instanceof Data) { |
|
| 131 | + } elseif ($caller instanceof Data) { |
|
| 133 | 132 | $this->api = $caller->api; |
| 134 | 133 | } |
| 135 | 134 | $this->import($data); |
@@ -59,11 +59,9 @@ |
||
| 59 | 59 | protected function getDir (): string { |
| 60 | 60 | if ($this->owner instanceof Shop) { |
| 61 | 61 | return 'metafields'; |
| 62 | - } |
|
| 63 | - elseif ($this->owner instanceof AbstractCollection) { |
|
| 62 | + } elseif ($this->owner instanceof AbstractCollection) { |
|
| 64 | 63 | return "collections/{$this->owner->getId()}/metafields"; |
| 65 | - } |
|
| 66 | - elseif ($this->owner instanceof Variant) { |
|
| 64 | + } elseif ($this->owner instanceof Variant) { |
|
| 67 | 65 | return "{$this->owner->getDir()}/{$this->owner->getId()}/metafields"; |
| 68 | 66 | } |
| 69 | 67 | return "{$this->owner}/metafields"; |
@@ -50,8 +50,7 @@ |
||
| 50 | 50 | if ($this->isDiff()) { |
| 51 | 51 | if ($this->getUpdatedAt()) { |
| 52 | 52 | $remote = $this->api->post('inventory_levels/adjust', $this->getData()); |
| 53 | - } |
|
| 54 | - else { |
|
| 53 | + } else { |
|
| 55 | 54 | $remote = $this->api->post('inventory_levels/connect', $this->getData()); |
| 56 | 55 | } |
| 57 | 56 | $this->import($remote['inventory_level']); |
@@ -98,8 +98,7 @@ |
||
| 98 | 98 | $payload = json_encode($args[1], JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR); |
| 99 | 99 | curl_setopt($ch, CURLOPT_POST, true); |
| 100 | 100 | curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); |
| 101 | - } |
|
| 102 | - else { |
|
| 101 | + } else { |
|
| 103 | 102 | $query = $args[1] ?? []; |
| 104 | 103 | $payload = null; |
| 105 | 104 | } |
@@ -66,8 +66,7 @@ |
||
| 66 | 66 | if ($this->hasId()) { |
| 67 | 67 | $collects = Collect::search($this->api, ['collection_id' => $this->getId()]); |
| 68 | 68 | $this->collects = new DataSet(iterator_to_array($collects)); |
| 69 | - } |
|
| 70 | - else { |
|
| 69 | + } else { |
|
| 71 | 70 | $this->collects = new DataSet(); |
| 72 | 71 | } |
| 73 | 72 | } |