@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | */ |
97 | 97 | protected $activationUrl; |
98 | 98 | |
99 | - protected function _setData (array $data) { |
|
99 | + protected function _setData(array $data) { |
|
100 | 100 | // redundant |
101 | 101 | unset($data['default_address']); |
102 | 102 | |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | /** |
107 | 107 | * @return string |
108 | 108 | */ |
109 | - public function getActivationUrl (): string { |
|
109 | + public function getActivationUrl(): string { |
|
110 | 110 | assert($this->hasId()); |
111 | 111 | return $this->activationUrl |
112 | 112 | ?? $this->activationUrl = $this->api->post("{$this}/account_activation_url")['account_activation_url']; |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | /** |
116 | 116 | * @return null|Address |
117 | 117 | */ |
118 | - public function getDefaultAddress () { |
|
118 | + public function getDefaultAddress() { |
|
119 | 119 | return $this->selectAddresses(function(Address $address) { |
120 | 120 | return $address->isDefault(); |
121 | 121 | })[0] ?? null; |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | /** |
125 | 125 | * @return Order[] |
126 | 126 | */ |
127 | - public function getOrders () { |
|
127 | + public function getOrders() { |
|
128 | 128 | assert($this->hasId()); |
129 | 129 | return Order::loadAll($this, "{$this}/orders"); |
130 | 130 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | /** |
133 | 133 | * @return string[] |
134 | 134 | */ |
135 | - public function getPoolKeys () { |
|
135 | + public function getPoolKeys() { |
|
136 | 136 | $keys = parent::getPoolKeys(); |
137 | 137 | $keys[] = $this->data['email'] ?? null; |
138 | 138 | $keys[] = $this->data['phone'] ?? null; |
@@ -143,35 +143,35 @@ discard block |
||
143 | 143 | /** |
144 | 144 | * @return bool |
145 | 145 | */ |
146 | - final public function isDeclined (): bool { |
|
146 | + final public function isDeclined(): bool { |
|
147 | 147 | return $this->data['state'] === self::IS_DECLINED; |
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
151 | 151 | * @return bool |
152 | 152 | */ |
153 | - final public function isDisabled (): bool { |
|
153 | + final public function isDisabled(): bool { |
|
154 | 154 | return $this->data['state'] === self::IS_DISABLED; |
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
158 | 158 | * @return bool |
159 | 159 | */ |
160 | - final public function isEnabled (): bool { |
|
160 | + final public function isEnabled(): bool { |
|
161 | 161 | return $this->data['state'] === self::IS_ENABLED; |
162 | 162 | } |
163 | 163 | |
164 | 164 | /** |
165 | 165 | * @return bool |
166 | 166 | */ |
167 | - final public function isInvited (): bool { |
|
167 | + final public function isInvited(): bool { |
|
168 | 168 | return $this->data['state'] === self::IS_INVITED; |
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
172 | 172 | * @return Address |
173 | 173 | */ |
174 | - public function newAddress () { |
|
174 | + public function newAddress() { |
|
175 | 175 | return $this->api->factory($this, Address::class, [ |
176 | 176 | 'customer_id' => $this->getId() |
177 | 177 | ]); |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | * |
183 | 183 | * @return Invite |
184 | 184 | */ |
185 | - public function newInvite () { |
|
185 | + public function newInvite() { |
|
186 | 186 | return new Invite($this); |
187 | 187 | } |
188 | 188 | |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | * @param string $password |
191 | 191 | * @return $this |
192 | 192 | */ |
193 | - public function setPassword (string $password) { |
|
193 | + public function setPassword(string $password) { |
|
194 | 194 | $this->_set('password', $password); |
195 | 195 | $this->_set('password_confirmation', $password); |
196 | 196 | return $this; |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | /** |
69 | 69 | * @return Image |
70 | 70 | */ |
71 | - public function newImage () { |
|
71 | + public function newImage() { |
|
72 | 72 | return $this->api->factory($this, Image::class, [ |
73 | 73 | 'product_id' => $this->getId() |
74 | 74 | ]); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | /** |
78 | 78 | * @return Option |
79 | 79 | */ |
80 | - public function newOption () { |
|
80 | + public function newOption() { |
|
81 | 81 | return $this->api->factory($this, Option::class, [ |
82 | 82 | 'product_id' => $this->getId() |
83 | 83 | ]); |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | /** |
87 | 87 | * @return Variant |
88 | 88 | */ |
89 | - public function newVariant () { |
|
89 | + public function newVariant() { |
|
90 | 90 | return $this->api->factory($this, Variant::class, [ |
91 | 91 | 'product_id' => $this->getId() |
92 | 92 | ]); |
@@ -55,21 +55,21 @@ discard block |
||
55 | 55 | 'image' => Data::class |
56 | 56 | ]; |
57 | 57 | |
58 | - protected function _container () { |
|
58 | + protected function _container() { |
|
59 | 59 | return $this->getBlog(); |
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
63 | 63 | * @return Blog |
64 | 64 | */ |
65 | - public function getBlog () { |
|
65 | + public function getBlog() { |
|
66 | 66 | return Blog::load($this, $this->getBlogId()); |
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
70 | 70 | * @return Comment[] |
71 | 71 | */ |
72 | - public function getComments () { |
|
72 | + public function getComments() { |
|
73 | 73 | assert($this->hasId()); |
74 | 74 | return Comment::loadAll($this, 'comments', [ |
75 | 75 | 'blog_id' => $this->getBlogId(), |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | /** |
81 | 81 | * @return int |
82 | 82 | */ |
83 | - public function getCommentsCount (): int { |
|
83 | + public function getCommentsCount(): int { |
|
84 | 84 | assert($this->hasId()); |
85 | 85 | return $this->api->get("comments/count", [ |
86 | 86 | 'blog_id' => $this->getBlogId(), |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * |
94 | 94 | * @return Comment |
95 | 95 | */ |
96 | - public function newComment () { |
|
96 | + public function newComment() { |
|
97 | 97 | assert($this->hasId()); |
98 | 98 | return $this->api->factory($this, Comment::class, [ |
99 | 99 | 'blog_id' => $this->getBlogId(), |
@@ -38,25 +38,25 @@ |
||
38 | 38 | const TYPE = 'comment'; |
39 | 39 | const DIR = 'comments'; |
40 | 40 | |
41 | - protected function _container () { |
|
41 | + protected function _container() { |
|
42 | 42 | return $this->getArticle(); |
43 | 43 | } |
44 | 44 | |
45 | - protected function _dir (): string { |
|
45 | + protected function _dir(): string { |
|
46 | 46 | return 'comments'; |
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
50 | 50 | * @return Article |
51 | 51 | */ |
52 | - public function getArticle () { |
|
52 | + public function getArticle() { |
|
53 | 53 | return Article::load($this, $this->getArticleId()); |
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
57 | 57 | * @return Blog |
58 | 58 | */ |
59 | - public function getBlog () { |
|
59 | + public function getBlog() { |
|
60 | 60 | return Blog::load($this, $this->getBlogId()); |
61 | 61 | } |
62 | 62 | } |
63 | 63 | \ No newline at end of file |
@@ -18,7 +18,7 @@ |
||
18 | 18 | /** |
19 | 19 | * @return SmartCollection |
20 | 20 | */ |
21 | - public function getCollection () { |
|
21 | + public function getCollection() { |
|
22 | 22 | return SmartCollection::load($this, $this->getCollectionId()); |
23 | 23 | } |
24 | 24 | } |
25 | 25 | \ No newline at end of file |
@@ -43,7 +43,7 @@ |
||
43 | 43 | * |
44 | 44 | * @return Article |
45 | 45 | */ |
46 | - public function newArticle () { |
|
46 | + public function newArticle() { |
|
47 | 47 | assert($this->hasId()); |
48 | 48 | return $this->api->factory($this, Article::class, [ |
49 | 49 | 'blog_id' => $this->getId() |
@@ -40,15 +40,15 @@ |
||
40 | 40 | const TYPE = 'image'; |
41 | 41 | const DIR = 'images'; |
42 | 42 | |
43 | - protected function _container () { |
|
43 | + protected function _container() { |
|
44 | 44 | return $this->getProduct(); |
45 | 45 | } |
46 | 46 | |
47 | - final protected function _metafieldType (): string { |
|
47 | + final protected function _metafieldType(): string { |
|
48 | 48 | return 'product_image'; |
49 | 49 | } |
50 | 50 | |
51 | - public function getProduct () { |
|
51 | + public function getProduct() { |
|
52 | 52 | return Product::load($this, $this->getProductId()); |
53 | 53 | } |
54 | 54 |
@@ -20,7 +20,7 @@ |
||
20 | 20 | /** |
21 | 21 | * @return Traversable|string[] |
22 | 22 | */ |
23 | - public function getIterator () { |
|
23 | + public function getIterator() { |
|
24 | 24 | yield from $this->_get('values', []); |
25 | 25 | } |
26 | 26 | } |
27 | 27 | \ No newline at end of file |
@@ -76,18 +76,18 @@ |
||
76 | 76 | const POLICY_CONTINUE = 'continue'; |
77 | 77 | const POLICY_DENY = 'deny'; |
78 | 78 | |
79 | - protected function _container () { |
|
79 | + protected function _container() { |
|
80 | 80 | return $this->getProduct(); |
81 | 81 | } |
82 | 82 | |
83 | - final protected function _metafieldType (): string { |
|
83 | + final protected function _metafieldType(): string { |
|
84 | 84 | return 'product_variant'; |
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
88 | 88 | * @return Product |
89 | 89 | */ |
90 | - public function getProduct () { |
|
90 | + public function getProduct() { |
|
91 | 91 | return Product::load($this, $this->getProductId()); |
92 | 92 | } |
93 | 93 |