@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * |
86 | 86 | * @return mixed |
87 | 87 | */ |
88 | - public function newEngagement () { |
|
88 | + public function newEngagement() { |
|
89 | 89 | return $this->api->factory($this, Engagement::class); |
90 | 90 | } |
91 | 91 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * |
95 | 95 | * @return Resource |
96 | 96 | */ |
97 | - public function newResource () { |
|
97 | + public function newResource() { |
|
98 | 98 | return $this->api->factory($this, Resource::class); |
99 | 99 | } |
100 | 100 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | * @param Engagement[] $engagements |
103 | 103 | * @return $this |
104 | 104 | */ |
105 | - public function sendEngagements (array $engagements) { |
|
105 | + public function sendEngagements(array $engagements) { |
|
106 | 106 | $this->api->post("{$this}/engagements", [ |
107 | 107 | 'engagements' => $engagements |
108 | 108 | ]); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * @param array $query ignored |
79 | 79 | * @internal Use {@link Api::getShop()} instead. |
80 | 80 | */ |
81 | - final public static function load ($caller, string $id, array $query = []) { |
|
81 | + final public static function load($caller, string $id, array $query = []) { |
|
82 | 82 | throw new LogicException; |
83 | 83 | } |
84 | 84 | |
@@ -88,14 +88,14 @@ discard block |
||
88 | 88 | * @param array $query ignored |
89 | 89 | * @internal Use {@link Api::getShop()} instead. |
90 | 90 | */ |
91 | - final public static function loadAll ($caller, string $path, array $query = []) { |
|
91 | + final public static function loadAll($caller, string $path, array $query = []) { |
|
92 | 92 | throw new LogicException; |
93 | 93 | } |
94 | 94 | |
95 | 95 | /** |
96 | 96 | * @return string |
97 | 97 | */ |
98 | - final public function __toString (): string { |
|
98 | + final public function __toString(): string { |
|
99 | 99 | return 'shop'; |
100 | 100 | } |
101 | 101 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * @param array $query |
104 | 104 | * @return AbandonedCheckout[] |
105 | 105 | */ |
106 | - public function getAbandonedCheckouts (array $query = []) { |
|
106 | + public function getAbandonedCheckouts(array $query = []) { |
|
107 | 107 | $checkouts = $this->api->get('checkouts', $query)['checkouts'] ?? []; |
108 | 108 | return $this->api->factoryAll($this, AbandonedCheckout::class, $checkouts); |
109 | 109 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | /** |
112 | 112 | * @return int |
113 | 113 | */ |
114 | - public function getAbandonedCheckoutsCount (): int { |
|
114 | + public function getAbandonedCheckoutsCount(): int { |
|
115 | 115 | return $this->api->get('checkouts/count')['count']; |
116 | 116 | } |
117 | 117 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * @param string $code |
120 | 120 | * @return Country |
121 | 121 | */ |
122 | - public function newCountry (string $code) { |
|
122 | + public function newCountry(string $code) { |
|
123 | 123 | return $this->api->factory($this, Country::class, [ |
124 | 124 | 'code' => $code |
125 | 125 | ]); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | /** |
129 | 129 | * @return Customer |
130 | 130 | */ |
131 | - public function newCustomer () { |
|
131 | + public function newCustomer() { |
|
132 | 132 | return $this->api->factory($this, Customer::class); |
133 | 133 | } |
134 | 134 | } |
135 | 135 | \ No newline at end of file |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | */ |
20 | 20 | protected $ids = []; |
21 | 21 | |
22 | - protected function _add (AbstractEntity $entity): void { |
|
22 | + protected function _add(AbstractEntity $entity): void { |
|
23 | 23 | assert($entity->hasId()); |
24 | 24 | $this->entities[$entity->getId()] = $entity; |
25 | 25 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * @param AbstractEntity $entity |
29 | 29 | * @param string[] $keys |
30 | 30 | */ |
31 | - protected function _addKeys (AbstractEntity $entity, ...$keys): void { |
|
31 | + protected function _addKeys(AbstractEntity $entity, ...$keys): void { |
|
32 | 32 | assert($entity->hasId()); |
33 | 33 | $this->ids += array_fill_keys($keys, $entity->getId()); |
34 | 34 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * @param Api|Data $caller |
39 | 39 | * @return null|AbstractEntity |
40 | 40 | */ |
41 | - protected function _get (string $key, $caller) { |
|
41 | + protected function _get(string $key, $caller) { |
|
42 | 42 | if (isset($this->ids[$key])) { |
43 | 43 | return $this->entities[$this->ids[$key]]; |
44 | 44 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | return null; |
47 | 47 | } |
48 | 48 | |
49 | - final public function add (AbstractEntity $entity): void { |
|
49 | + final public function add(AbstractEntity $entity): void { |
|
50 | 50 | if ($entity->hasId() and !$entity->isDiff()) { |
51 | 51 | $this->_add($entity); |
52 | 52 | $this->_addKeys($entity, $entity->getPoolKeys()); |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * @param Closure $factory `fn( $caller ): ?AbstractEntity` |
60 | 60 | * @return null|AbstractEntity |
61 | 61 | */ |
62 | - final public function get (string $key, $caller, Closure $factory) { |
|
62 | + final public function get(string $key, $caller, Closure $factory) { |
|
63 | 63 | /** @var AbstractEntity $entity */ |
64 | 64 | if (!$entity = $this->_get($key, $caller) and $entity = $factory($caller)) { |
65 | 65 | $id = $entity->getId(); |
@@ -82,14 +82,14 @@ discard block |
||
82 | 82 | * @param string $key |
83 | 83 | * @return bool |
84 | 84 | */ |
85 | - public function has (string $key): bool { |
|
85 | + public function has(string $key): bool { |
|
86 | 86 | return isset($this->ids[$key]); |
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
90 | 90 | * @param string[] $keys |
91 | 91 | */ |
92 | - public function remove (...$keys): void { |
|
92 | + public function remove(...$keys): void { |
|
93 | 93 | foreach ($keys as $key) { |
94 | 94 | unset($this->entities[$key]); |
95 | 95 | unset($this->ids[$key]); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @param string $message |
41 | 41 | * @param array $curlInfo |
42 | 42 | */ |
43 | - public function __construct (int $code, string $message, array $curlInfo) { |
|
43 | + public function __construct(int $code, string $message, array $curlInfo) { |
|
44 | 44 | parent::__construct(self::NO_DATA[$code] ?? $message, $code); |
45 | 45 | $this->curlInfo = $curlInfo; |
46 | 46 | } |
@@ -48,14 +48,14 @@ discard block |
||
48 | 48 | /** |
49 | 49 | * @return array |
50 | 50 | */ |
51 | - public function getCurlInfo (): array { |
|
51 | + public function getCurlInfo(): array { |
|
52 | 52 | return $this->curlInfo; |
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
56 | 56 | * @return bool |
57 | 57 | */ |
58 | - final public function isCurl (): bool { |
|
58 | + final public function isCurl(): bool { |
|
59 | 59 | return $this->code < 400; |
60 | 60 | } |
61 | 61 | } |
62 | 62 | \ No newline at end of file |
@@ -26,14 +26,14 @@ |
||
26 | 26 | const TYPE = 'discount_code'; |
27 | 27 | const DIR = 'discount_codes'; |
28 | 28 | |
29 | - protected function _container () { |
|
29 | + protected function _container() { |
|
30 | 30 | return $this->getPriceRule(); |
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
34 | 34 | * @return PriceRule |
35 | 35 | */ |
36 | - public function getPriceRule () { |
|
36 | + public function getPriceRule() { |
|
37 | 37 | return PriceRule::load($this, $this->getPriceRuleId()); |
38 | 38 | } |
39 | 39 | } |
40 | 40 | \ No newline at end of file |
@@ -50,7 +50,7 @@ |
||
50 | 50 | * |
51 | 51 | * @return CHSCode |
52 | 52 | */ |
53 | - public function newCHSCode () { |
|
53 | + public function newCHSCode() { |
|
54 | 54 | return $this->api->factory($this, CHSCode::class); |
55 | 55 | } |
56 | 56 |
@@ -20,7 +20,7 @@ |
||
20 | 20 | * |
21 | 21 | * @return string |
22 | 22 | */ |
23 | - final public function __toString (): string { |
|
23 | + final public function __toString(): string { |
|
24 | 24 | return $this->getHarmonizedSystemCode(); |
25 | 25 | } |
26 | 26 | } |
27 | 27 | \ No newline at end of file |
@@ -39,14 +39,14 @@ |
||
39 | 39 | /** |
40 | 40 | * @return Asset[] |
41 | 41 | */ |
42 | - public function getAssets () { |
|
42 | + public function getAssets() { |
|
43 | 43 | return Asset::loadAll($this, "{$this}/assets"); |
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
47 | 47 | * @return Asset |
48 | 48 | */ |
49 | - public function newAsset () { |
|
49 | + public function newAsset() { |
|
50 | 50 | return $this->api->factory($this, Asset::class, [ |
51 | 51 | 'theme_id' => $this->getId() |
52 | 52 | ]); |
@@ -94,35 +94,35 @@ discard block |
||
94 | 94 | /** |
95 | 95 | * @return DiscountCode[] |
96 | 96 | */ |
97 | - public function getDiscountCodes () { |
|
97 | + public function getDiscountCodes() { |
|
98 | 98 | return DiscountCode::loadAll($this, "{$this}/discount_codes"); |
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
102 | 102 | * @return null|number |
103 | 103 | */ |
104 | - public function getMaxShipping () { |
|
104 | + public function getMaxShipping() { |
|
105 | 105 | return $this->data['prerequisite_shipping_price_range']['less_than_or_equal_to'] ?? null; |
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
109 | 109 | * @return null|int |
110 | 110 | */ |
111 | - public function getMinQuantity () { |
|
111 | + public function getMinQuantity() { |
|
112 | 112 | return $this->data['prerequisite_quantity_range']['greater_than_or_equal_to'] ?? null; |
113 | 113 | } |
114 | 114 | |
115 | 115 | /** |
116 | 116 | * @return null|number |
117 | 117 | */ |
118 | - public function getMinSubtotal () { |
|
118 | + public function getMinSubtotal() { |
|
119 | 119 | return $this->data['prerequisite_subtotal_range']['greater_than_or_equal_to'] ?? null; |
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
123 | 123 | * @return DiscountCode |
124 | 124 | */ |
125 | - public function newDiscountCode () { |
|
125 | + public function newDiscountCode() { |
|
126 | 126 | return $this->api->factory($this, DiscountCode::class, [ |
127 | 127 | 'price_rule_id' => $this->getId() |
128 | 128 | ]); |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * @param null|number $max |
133 | 133 | * @return $this |
134 | 134 | */ |
135 | - public function setMaxShipping ($max) { |
|
135 | + public function setMaxShipping($max) { |
|
136 | 136 | return $this->_set('prerequisite_shipping_price_range', isset($max) ? ['less_than_or_equal_to' => $max] : null); |
137 | 137 | } |
138 | 138 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * @param null|int $min |
141 | 141 | * @return $this |
142 | 142 | */ |
143 | - public function setMinQuantity (?int $min) { |
|
143 | + public function setMinQuantity(?int $min) { |
|
144 | 144 | return $this->_set('prerequisite_quantity_range', isset($min) ? ['greater_than_or_equal_to' => $min] : null); |
145 | 145 | } |
146 | 146 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * @param null|number $min |
149 | 149 | * @return $this |
150 | 150 | */ |
151 | - public function setMinSubtotal ($min) { |
|
151 | + public function setMinSubtotal($min) { |
|
152 | 152 | return $this->_set('prerequisite_subtotal_range', isset($min) ? ['greater_than_or_equal_to' => $min] : null); |
153 | 153 | } |
154 | 154 | } |
155 | 155 | \ No newline at end of file |