@@ -27,30 +27,30 @@ |
||
| 27 | 27 | 'rules' => [Rule::class, 'toDataSet'], |
| 28 | 28 | ]; |
| 29 | 29 | |
| 30 | - final protected static function getSearchPath (): string { |
|
| 30 | + final protected static function getSearchPath(): string { |
|
| 31 | 31 | return 'smart_collections'; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - final protected static function getSearchType (): string { |
|
| 34 | + final protected static function getSearchType(): string { |
|
| 35 | 35 | return 'smart_collections'; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - final protected static function getType (): string { |
|
| 38 | + final protected static function getType(): string { |
|
| 39 | 39 | return 'smart_collection'; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - final public function __toString (): string { |
|
| 42 | + final public function __toString(): string { |
|
| 43 | 43 | return "smart_collections/{$this->getId()}"; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - final protected function getDir (): string { |
|
| 46 | + final protected function getDir(): string { |
|
| 47 | 47 | return 'smart_collections'; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
| 51 | 51 | * @return Rule |
| 52 | 52 | */ |
| 53 | - public function newRule () { |
|
| 53 | + public function newRule() { |
|
| 54 | 54 | return $this->data['rules']->add(Rule::toData($this, [])); |
| 55 | 55 | } |
| 56 | 56 | } |
| 57 | 57 | \ No newline at end of file |
@@ -55,23 +55,23 @@ discard block |
||
| 55 | 55 | 'tax_lines' => [Tax::class, 'toDataSet'] |
| 56 | 56 | ]; |
| 57 | 57 | |
| 58 | - final protected static function getMetafieldType (): string { |
|
| 58 | + final protected static function getMetafieldType(): string { |
|
| 59 | 59 | return 'draft_order'; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - final protected static function getSearchPath (): string { |
|
| 62 | + final protected static function getSearchPath(): string { |
|
| 63 | 63 | return 'draft_orders'; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - protected static function getSearchType (): string { |
|
| 66 | + protected static function getSearchType(): string { |
|
| 67 | 67 | return 'draft_orders'; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - final protected static function getType (): string { |
|
| 70 | + final protected static function getType(): string { |
|
| 71 | 71 | return 'draft_order'; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - final public function __toString (): string { |
|
| 74 | + final public function __toString(): string { |
|
| 75 | 75 | return "draft_orders/{$this->getId()}"; |
| 76 | 76 | } |
| 77 | 77 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | * @param bool $paymentPending |
| 80 | 80 | * @return $this |
| 81 | 81 | */ |
| 82 | - public function complete (bool $paymentPending = false) { |
|
| 82 | + public function complete(bool $paymentPending = false) { |
|
| 83 | 83 | assert($this->hasId()); |
| 84 | 84 | $remote = $this->api->put("{$this}/complete", [ |
| 85 | 85 | 'payment_pending' => ['false', 'true'][$paymentPending] |
@@ -87,11 +87,11 @@ discard block |
||
| 87 | 87 | return $this->import($remote['draft_order']); |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - final protected function getDir (): string { |
|
| 90 | + final protected function getDir(): string { |
|
| 91 | 91 | return 'draft_orders'; |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - final protected function getMetafieldDir (): string { |
|
| 94 | + final protected function getMetafieldDir(): string { |
|
| 95 | 95 | return "{$this}/metafields"; |
| 96 | 96 | } |
| 97 | 97 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | * @param Invoice|null $invoice |
| 100 | 100 | * @return $this |
| 101 | 101 | */ |
| 102 | - public function sendInvoice (Invoice $invoice = null) { |
|
| 102 | + public function sendInvoice(Invoice $invoice = null) { |
|
| 103 | 103 | assert($this->hasId()); |
| 104 | 104 | $this->api->post("{$this}/send_invoice", [ |
| 105 | 105 | 'draft_order_invoice' => $invoice ? $invoice->getData() : (object)[] |
@@ -19,23 +19,23 @@ |
||
| 19 | 19 | |
| 20 | 20 | use SearchTrait; |
| 21 | 21 | |
| 22 | - final protected static function getSearchPath (): string { |
|
| 22 | + final protected static function getSearchPath(): string { |
|
| 23 | 23 | return 'redirects'; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - final protected static function getSearchType (): string { |
|
| 26 | + final protected static function getSearchType(): string { |
|
| 27 | 27 | return 'redirects'; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - final protected static function getType (): string { |
|
| 30 | + final protected static function getType(): string { |
|
| 31 | 31 | return 'redirect'; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - final public function __toString (): string { |
|
| 34 | + final public function __toString(): string { |
|
| 35 | 35 | return "redirects/{$this->getId()}"; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - final protected function getDir (): string { |
|
| 38 | + final protected function getDir(): string { |
|
| 39 | 39 | return 'redirects'; |
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | \ No newline at end of file |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | * @param string $id |
| 52 | 52 | * @return null|User |
| 53 | 53 | */ |
| 54 | - public static function load (Api $api, string $id) { |
|
| 54 | + public static function load(Api $api, string $id) { |
|
| 55 | 55 | if ($remote = $api->get("users/{$id}")) { |
| 56 | 56 | return new static($api, $remote['user']); |
| 57 | 57 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | * @param Api $api |
| 63 | 63 | * @return static[] |
| 64 | 64 | */ |
| 65 | - public static function loadAll (Api $api) { |
|
| 65 | + public static function loadAll(Api $api) { |
|
| 66 | 66 | return array_map(function(array $row) use ($api) { |
| 67 | 67 | return new static($api, $row); |
| 68 | 68 | }, $api->get('users')['users']); |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | * @param Api $api |
| 73 | 73 | * @return User |
| 74 | 74 | */ |
| 75 | - public static function me (Api $api) { |
|
| 75 | + public static function me(Api $api) { |
|
| 76 | 76 | return new static($api, $api->get("users/current")['user']); |
| 77 | 77 | } |
| 78 | 78 | |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | /** |
| 16 | 16 | * Throws. |
| 17 | 17 | */ |
| 18 | - final public function delete (): void { |
|
| 18 | + final public function delete(): void { |
|
| 19 | 19 | throw new DomainException('This entity cannot be deleted.'); |
| 20 | 20 | } |
| 21 | 21 | } |
| 22 | 22 | \ No newline at end of file |
@@ -71,31 +71,31 @@ discard block |
||
| 71 | 71 | 'addresses' => [Address::class, 'toDataSet'], |
| 72 | 72 | ]; |
| 73 | 73 | |
| 74 | - final protected static function getAdvancedSearchPath (): string { |
|
| 74 | + final protected static function getAdvancedSearchPath(): string { |
|
| 75 | 75 | return 'customers/search'; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - final protected static function getMetafieldType (): string { |
|
| 78 | + final protected static function getMetafieldType(): string { |
|
| 79 | 79 | return 'customer'; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - final protected static function getSearchPath (): string { |
|
| 82 | + final protected static function getSearchPath(): string { |
|
| 83 | 83 | return 'customers'; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - final protected static function getSearchType (): string { |
|
| 86 | + final protected static function getSearchType(): string { |
|
| 87 | 87 | return 'customers'; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - final protected static function getType (): string { |
|
| 90 | + final protected static function getType(): string { |
|
| 91 | 91 | return 'customer'; |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - final public function __toString (): string { |
|
| 94 | + final public function __toString(): string { |
|
| 95 | 95 | return "customers/{$this->getId()}"; |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - public function getActivationUrl (): string { |
|
| 98 | + public function getActivationUrl(): string { |
|
| 99 | 99 | assert($this->hasId()); |
| 100 | 100 | if (!$this->activationUrl) { |
| 101 | 101 | $remote = $this->api->post("{$this}/account_activation_url", []); |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | /** |
| 108 | 108 | * @return null|Address |
| 109 | 109 | */ |
| 110 | - public function getDefaultAddress () { |
|
| 110 | + public function getDefaultAddress() { |
|
| 111 | 111 | /** @var null|Address $address */ |
| 112 | 112 | $address = $this->data['addresses']->first(function(Address $address) { |
| 113 | 113 | return $address->isDefault(); |
@@ -115,14 +115,14 @@ discard block |
||
| 115 | 115 | return $address; |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - final protected function getDir (): string { |
|
| 118 | + final protected function getDir(): string { |
|
| 119 | 119 | return 'customers'; |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
| 123 | 123 | * @return Order[] |
| 124 | 124 | */ |
| 125 | - public function getOrders () { |
|
| 125 | + public function getOrders() { |
|
| 126 | 126 | assert($this->hasId()); |
| 127 | 127 | return Order::toList($this, $this->api->get("{$this}/orders")['orders']); |
| 128 | 128 | } |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | /** |
| 131 | 131 | * @return Address |
| 132 | 132 | */ |
| 133 | - public function newAddress () { |
|
| 133 | + public function newAddress() { |
|
| 134 | 134 | return $this->data['addresses']->add(Address::toData($this, ['customer_id' => $this->getId()])); |
| 135 | 135 | } |
| 136 | 136 | |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | * |
| 140 | 140 | * @return Invite |
| 141 | 141 | */ |
| 142 | - public function newInvite () { |
|
| 142 | + public function newInvite() { |
|
| 143 | 143 | return new Invite($this); |
| 144 | 144 | } |
| 145 | 145 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | * @param Address $address |
| 150 | 150 | * @return $this |
| 151 | 151 | */ |
| 152 | - public function setDefaultAddress (Address $address) { |
|
| 152 | + public function setDefaultAddress(Address $address) { |
|
| 153 | 153 | assert($this->hasId()); |
| 154 | 154 | assert($address->hasId()); |
| 155 | 155 | assert($address->getCustomerId() === $this->getId()); |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | * @param string $password |
| 166 | 166 | * @return $this |
| 167 | 167 | */ |
| 168 | - public function setPassword (string $password) { |
|
| 168 | + public function setPassword(string $password) { |
|
| 169 | 169 | return $this->apply([ |
| 170 | 170 | 'password' => $password, |
| 171 | 171 | 'password_confirmation' => $password |