@@ -23,12 +23,12 @@ |
||
23 | 23 | */ |
24 | 24 | protected $customer; |
25 | 25 | |
26 | - public function __construct (Customer $customer) { |
|
26 | + public function __construct(Customer $customer) { |
|
27 | 27 | $this->customer = $customer; |
28 | 28 | parent::__construct($customer); |
29 | 29 | } |
30 | 30 | |
31 | - public function send (): void { |
|
31 | + public function send(): void { |
|
32 | 32 | $this->api->post("{$this->customer}/send_invite", ['customer_invite' => $this->getData()]); |
33 | 33 | } |
34 | 34 | } |
35 | 35 | \ No newline at end of file |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | protected $assets; |
36 | 36 | |
37 | - final protected static function getType (): string { |
|
37 | + final protected static function getType(): string { |
|
38 | 38 | return 'theme'; |
39 | 39 | } |
40 | 40 | |
@@ -42,18 +42,18 @@ discard block |
||
42 | 42 | * @param Api $api |
43 | 43 | * @return Theme[] |
44 | 44 | */ |
45 | - public static function loadAll (Api $api) { |
|
45 | + public static function loadAll(Api $api) { |
|
46 | 46 | return static::toList(new static($api), $api->get('themes')['themes']); |
47 | 47 | } |
48 | 48 | |
49 | - final public function __toString (): string { |
|
49 | + final public function __toString(): string { |
|
50 | 50 | return "themes/{$this->getId()}"; |
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
54 | 54 | * @return Asset[] |
55 | 55 | */ |
56 | - public function getAssets () { |
|
56 | + public function getAssets() { |
|
57 | 57 | if (!isset($this->assets)) { |
58 | 58 | /** |
59 | 59 | * Asset values are not returned by Shopify for this query. |
@@ -69,14 +69,14 @@ discard block |
||
69 | 69 | return $this->assets->getItems(); |
70 | 70 | } |
71 | 71 | |
72 | - final protected function getDir (): string { |
|
72 | + final protected function getDir(): string { |
|
73 | 73 | return 'themes'; |
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
77 | 77 | * @return Asset |
78 | 78 | */ |
79 | - public function newAsset () { |
|
79 | + public function newAsset() { |
|
80 | 80 | $this->getAssets(); |
81 | 81 | return $this->assets->add(Asset::toData($this, ['theme_id' => $this->getId()])); |
82 | 82 | } |
@@ -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,20 +107,20 @@ discard block |
||
107 | 107 | /** |
108 | 108 | * @return null|Address |
109 | 109 | */ |
110 | - public function getDefaultAddress () { |
|
110 | + public function getDefaultAddress() { |
|
111 | 111 | return $this->data['addresses']->first(function(Address $address) { |
112 | 112 | return $address->isDefault(); |
113 | 113 | }); |
114 | 114 | } |
115 | 115 | |
116 | - final protected function getDir (): string { |
|
116 | + final protected function getDir(): string { |
|
117 | 117 | return 'customers'; |
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
121 | 121 | * @return Order[] |
122 | 122 | */ |
123 | - public function getOrders () { |
|
123 | + public function getOrders() { |
|
124 | 124 | assert($this->hasId()); |
125 | 125 | return Order::toList($this, $this->api->get("{$this}/orders")['orders']); |
126 | 126 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | /** |
129 | 129 | * @return Address |
130 | 130 | */ |
131 | - public function newAddress () { |
|
131 | + public function newAddress() { |
|
132 | 132 | return $this->data['addresses']->add(Address::toData($this, ['customer_id' => $this->getId()])); |
133 | 133 | } |
134 | 134 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * |
138 | 138 | * @return Invite |
139 | 139 | */ |
140 | - public function newInvite () { |
|
140 | + public function newInvite() { |
|
141 | 141 | return new Invite($this); |
142 | 142 | } |
143 | 143 | |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * @param Address $address |
148 | 148 | * @return $this |
149 | 149 | */ |
150 | - public function setDefaultAddress (Address $address) { |
|
150 | + public function setDefaultAddress(Address $address) { |
|
151 | 151 | assert($this->hasId()); |
152 | 152 | assert($address->hasId()); |
153 | 153 | assert($address->getCustomerId() === $this->getId()); |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | * @param string $password |
164 | 164 | * @return $this |
165 | 165 | */ |
166 | - public function setPassword (string $password) { |
|
166 | + public function setPassword(string $password) { |
|
167 | 167 | return $this->apply([ |
168 | 168 | 'password' => $password, |
169 | 169 | 'password_confirmation' => $password |
@@ -61,34 +61,34 @@ discard block |
||
61 | 61 | 'variants' => [Variant::class, 'toDataSet'] |
62 | 62 | ]; |
63 | 63 | |
64 | - final protected static function getMetafieldType (): string { |
|
64 | + final protected static function getMetafieldType(): string { |
|
65 | 65 | return 'product'; |
66 | 66 | } |
67 | 67 | |
68 | - final protected static function getSearchPath (): string { |
|
68 | + final protected static function getSearchPath(): string { |
|
69 | 69 | return 'products'; |
70 | 70 | } |
71 | 71 | |
72 | - final protected static function getSearchType (): string { |
|
72 | + final protected static function getSearchType(): string { |
|
73 | 73 | return 'products'; |
74 | 74 | } |
75 | 75 | |
76 | - final protected static function getType (): string { |
|
76 | + final protected static function getType(): string { |
|
77 | 77 | return 'product'; |
78 | 78 | } |
79 | 79 | |
80 | - final public function __toString (): string { |
|
80 | + final public function __toString(): string { |
|
81 | 81 | return "products/{$this->getId()}"; |
82 | 82 | } |
83 | 83 | |
84 | - final protected function getDir (): string { |
|
84 | + final protected function getDir(): string { |
|
85 | 85 | return 'products'; |
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
89 | 89 | * @return Image |
90 | 90 | */ |
91 | - public function newImage () { |
|
91 | + public function newImage() { |
|
92 | 92 | return $this->data['images']->add(Image::toData($this, ['product_id' => $this->getId()])); |
93 | 93 | } |
94 | 94 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * @param string[] $values |
98 | 98 | * @return Option |
99 | 99 | */ |
100 | - public function newOption (string $name, array $values) { |
|
100 | + public function newOption(string $name, array $values) { |
|
101 | 101 | $option = Option::toData($this, ['product_id' => $this->getId()]); |
102 | 102 | $option->setName($name)->setValues($values); |
103 | 103 | return $this->data['options']->add($option); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | /** |
107 | 107 | * @return Variant |
108 | 108 | */ |
109 | - public function newVariant () { |
|
109 | + public function newVariant() { |
|
110 | 110 | return $this->data['variants']->add(Variant::toData($this, ['product_id' => $this->getId()])); |
111 | 111 | } |
112 | 112 |
@@ -21,23 +21,23 @@ |
||
21 | 21 | |
22 | 22 | use SearchTrait; |
23 | 23 | |
24 | - final protected static function getSearchPath (): string { |
|
24 | + final protected static function getSearchPath(): string { |
|
25 | 25 | return 'reports'; |
26 | 26 | } |
27 | 27 | |
28 | - final protected static function getSearchType (): string { |
|
28 | + final protected static function getSearchType(): string { |
|
29 | 29 | return 'reports'; |
30 | 30 | } |
31 | 31 | |
32 | - final protected static function getType (): string { |
|
32 | + final protected static function getType(): string { |
|
33 | 33 | return 'report'; |
34 | 34 | } |
35 | 35 | |
36 | - final public function __toString (): string { |
|
36 | + final public function __toString(): string { |
|
37 | 37 | return "reports/{$this->getId()}"; |
38 | 38 | } |
39 | 39 | |
40 | - final protected function getDir (): string { |
|
40 | + final protected function getDir(): string { |
|
41 | 41 | return 'reports'; |
42 | 42 | } |
43 | 43 | } |
44 | 44 | \ No newline at end of file |
@@ -21,14 +21,14 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @return string |
23 | 23 | */ |
24 | - abstract protected static function getType (): string; |
|
24 | + abstract protected static function getType(): string; |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * The entity's unique path for GET/PUT/DELETE. |
28 | 28 | * |
29 | 29 | * @return string |
30 | 30 | */ |
31 | - abstract public function __toString (): string; |
|
31 | + abstract public function __toString(): string; |
|
32 | 32 | |
33 | 33 | /** |
34 | 34 | * @var Api |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * @param mixed ...$extra Other arguments needed by the constructor. |
42 | 42 | * @return null|static |
43 | 43 | */ |
44 | - public static function load (Api $api, array $data, ...$extra) { |
|
44 | + public static function load(Api $api, array $data, ...$extra) { |
|
45 | 45 | $class = static::class; |
46 | 46 | /** @var Data $proto */ |
47 | 47 | $proto = new $class($api, $data, ...$extra); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | return null; |
54 | 54 | } |
55 | 55 | |
56 | - public function delete (): void { |
|
56 | + public function delete(): void { |
|
57 | 57 | /** @var Data $this */ |
58 | 58 | $this->api->delete($this); |
59 | 59 | $this->notify('delete'); |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | * |
18 | 18 | * @return string |
19 | 19 | */ |
20 | - abstract protected function getDir (): string; |
|
20 | + abstract protected function getDir(): string; |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * @var bool |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * |
37 | 37 | * @return $this |
38 | 38 | */ |
39 | - public function save () { |
|
39 | + public function save() { |
|
40 | 40 | if ($this->isDiff()) { |
41 | 41 | $type = static::getType(); |
42 | 42 | if (!$this->hasId()) { |
@@ -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 | } |
@@ -19,7 +19,7 @@ |
||
19 | 19 | * @deprecated |
20 | 20 | * @internal |
21 | 21 | */ |
22 | - final public function delete (): void { |
|
22 | + final public function delete(): void { |
|
23 | 23 | throw new DomainException('This entity cannot be deleted.'); |
24 | 24 | } |
25 | 25 | } |
26 | 26 | \ No newline at end of file |
@@ -13,21 +13,21 @@ |
||
13 | 13 | * @param array $query |
14 | 14 | * @return string |
15 | 15 | */ |
16 | - abstract protected static function getSearchPath (array $query): string; |
|
16 | + abstract protected static function getSearchPath(array $query): string; |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * The pluralized key that results are wrapped in. |
20 | 20 | * |
21 | 21 | * @return string |
22 | 22 | */ |
23 | - abstract protected static function getSearchType (): string; |
|
23 | + abstract protected static function getSearchType(): string; |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * @param Api $api |
27 | 27 | * @param array $query |
28 | 28 | * @return Traversable|static[] |
29 | 29 | */ |
30 | - public static function search (Api $api, array $query) { |
|
30 | + public static function search(Api $api, array $query) { |
|
31 | 31 | $continue = !isset($query['limit']); |
32 | 32 | $query += ['limit' => 250]; |
33 | 33 | $class = static::class; |