Passed
Branch master (9b6ab6)
by y
01:32
created
src/AbandonedCheckout.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
         'tax_lines' => [Tax::class]
62 62
     ];
63 63
 
64
-    protected function _setData (array $data) {
64
+    protected function _setData(array $data) {
65 65
         // abandoned checkouts aren't entities.
66 66
         unset($data['id']);
67 67
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     /**
75 75
      * @return Discount[]
76 76
      */
77
-    public function getDiscountCodes () {
77
+    public function getDiscountCodes() {
78 78
         // the discounts are in an extra dimension for some reason.
79 79
         $discounts = array_column($this->data['discount_codes'], 'discount_code');
80 80
         return $this->api->factoryAll($this, Discount::class, $discounts);
Please login to merge, or discard this patch.
src/Api.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      * @param string $password
49 49
      * @param null|Pool $pool
50 50
      */
51
-    public function __construct (string $domain, string $key, string $password, Pool $pool = null) {
51
+    public function __construct(string $domain, string $key, string $password, Pool $pool = null) {
52 52
         $this->domain = $domain;
53 53
         $this->key = $key;
54 54
         $this->password = $password;
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      * @param array $query
61 61
      * @return Generator|mixed|AbstractEntity[]
62 62
      */
63
-    public function advancedSearch (string $class, array $query) {
63
+    public function advancedSearch(string $class, array $query) {
64 64
         $continue = !isset($query['limit']);
65 65
         $query['limit'] += ['limit' => 250];
66 66
         do {
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
      * @param string $path
77 77
      * @param array $query
78 78
      */
79
-    public function delete (string $path, array $query = []): void {
79
+    public function delete(string $path, array $query = []): void {
80 80
         $path .= '.json';
81 81
         if ($query) {
82 82
             $path .= '?' . http_build_query($query);
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
      * @param array $curlOpts
91 91
      * @return null|array
92 92
      */
93
-    public function exec (string $method, string $path, array $curlOpts = []) {
93
+    public function exec(string $method, string $path, array $curlOpts = []) {
94 94
         $this->getLogger()->log(LOG_DEBUG, "{$method} {$path}", $curlOpts);
95 95
         $ch = curl_init();
96 96
         curl_setopt_array($ch, [
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
      * @param array $data
135 135
      * @return mixed
136 136
      */
137
-    public function factory ($caller, string $class, array $data = []) {
137
+    public function factory($caller, string $class, array $data = []) {
138 138
         return new $class($caller, $data);
139 139
     }
140 140
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
      * @param array[] $list
145 145
      * @return array
146 146
      */
147
-    public function factoryAll ($caller, string $class, array $list) {
147
+    public function factoryAll($caller, string $class, array $list) {
148 148
         return array_map(function(array $each) use ($caller, $class) {
149 149
             return $this->factory($caller, $class, $each);
150 150
         }, $list);
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
      * @param array $query
156 156
      * @return null|array
157 157
      */
158
-    public function get (string $path, array $query = []) {
158
+    public function get(string $path, array $query = []) {
159 159
         $path .= '.json';
160 160
         if ($query) {
161 161
             $path .= '?' . http_build_query($query);
@@ -167,35 +167,35 @@  discard block
 block discarded – undo
167 167
      * @param string $id
168 168
      * @return null|Location
169 169
      */
170
-    public function getLocation (string $id) {
170
+    public function getLocation(string $id) {
171 171
         return $this->load($this, Location::class, "locations/{$id}");
172 172
     }
173 173
 
174 174
     /**
175 175
      * @return LoggerInterface
176 176
      */
177
-    public function getLogger (): LoggerInterface {
177
+    public function getLogger(): LoggerInterface {
178 178
         return $this->logger ?? $this->logger = new NullLogger();
179 179
     }
180 180
 
181 181
     /**
182 182
      * @return User
183 183
      */
184
-    public function getMe () {
184
+    public function getMe() {
185 185
         return $this->load($this, User::class, 'users/current');
186 186
     }
187 187
 
188 188
     /**
189 189
      * @return Pool
190 190
      */
191
-    public function getPool () {
191
+    public function getPool() {
192 192
         return $this->pool;
193 193
     }
194 194
 
195 195
     /**
196 196
      * @return Shop
197 197
      */
198
-    public function getShop () {
198
+    public function getShop() {
199 199
         return $this->load($this, Shop::class, 'shop');
200 200
     }
201 201
 
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
      * @param array $query
207 207
      * @return null|mixed|AbstractEntity
208 208
      */
209
-    public function load ($caller, string $class, string $path, array $query = []) {
209
+    public function load($caller, string $class, string $path, array $query = []) {
210 210
         return $this->pool->get($path, $caller, function($caller) use ($class, $path, $query) {
211 211
             if ($remote = $this->get($path, $query)) {
212 212
                 return $this->factory($caller, $class, $remote[$class::TYPE]);
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
      * @param array $query
223 223
      * @return array|Data[]
224 224
      */
225
-    public function loadAll ($caller, string $class, string $path, array $query = []) {
225
+    public function loadAll($caller, string $class, string $path, array $query = []) {
226 226
         return array_map(function(array $each) use ($caller, $class) {
227 227
             return $this->pool->get($each['id'], $caller, function($caller) use ($class, $each) {
228 228
                 return $this->factory($caller, $class, $each);
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
      * @param array $data
236 236
      * @return null|array
237 237
      */
238
-    public function post (string $path, array $data = []) {
238
+    public function post(string $path, array $data = []) {
239 239
         return $this->exec('POST', "{$path}.json", [
240 240
             CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
241 241
             CURLOPT_POSTFIELDS => json_encode($data, JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR)
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
      * @param array $data
248 248
      * @return null|array
249 249
      */
250
-    public function put (string $path, array $data = []) {
250
+    public function put(string $path, array $data = []) {
251 251
         return $this->exec('PUT', "{$path}.json", [
252 252
             CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
253 253
             CURLOPT_POSTFIELDS => json_encode($data, JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR)
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
      * @param LoggerInterface $logger
259 259
      * @return $this
260 260
      */
261
-    final public function setLogger (LoggerInterface $logger) {
261
+    final public function setLogger(LoggerInterface $logger) {
262 262
         $this->logger = $logger;
263 263
         return $this;
264 264
     }
Please login to merge, or discard this patch.
src/Country/Province.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,11 +41,11 @@
 block discarded – undo
41 41
     const TAX_TYPE_HARMONIZED = 'harmonized';
42 42
     const TAX_TYPE_COMPOUNDED = 'compounded';
43 43
 
44
-    protected function _container () {
44
+    protected function _container() {
45 45
         return $this->getCountry();
46 46
     }
47 47
 
48
-    public function getCountry () {
48
+    public function getCountry() {
49 49
         return Country::load($this, $this->getCountryId());
50 50
     }
51 51
 
Please login to merge, or discard this patch.
src/Customer/Invite.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,12 +24,12 @@
 block discarded – undo
24 24
      */
25 25
     protected $customer;
26 26
 
27
-    public function __construct (Customer $customer) {
27
+    public function __construct(Customer $customer) {
28 28
         $this->customer = $customer;
29 29
         parent::__construct($customer);
30 30
     }
31 31
 
32
-    public function send (): void {
32
+    public function send(): void {
33 33
         $this->api->post("{$this->customer}/send_invite", [
34 34
             'customer_invite' => $this->data
35 35
         ]);
Please login to merge, or discard this patch.
src/Customer/Address.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -48,16 +48,16 @@  discard block
 block discarded – undo
48 48
     const TYPE = 'customer_address';
49 49
     const DIR = 'addresses';
50 50
 
51
-    protected function _container () {
51
+    protected function _container() {
52 52
         return $this->getCustomer();
53 53
     }
54 54
 
55
-    protected function _onDelete (): void {
55
+    protected function _onDelete(): void {
56 56
         parent::_onDelete();
57 57
         $this->getCustomer()->_reload('addresses');
58 58
     }
59 59
 
60
-    protected function _onSave (): void {
60
+    protected function _onSave(): void {
61 61
         parent::_onSave();
62 62
         $customer = $this->getCustomer();
63 63
         $customer->_reload('addresses');
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
     /**
70 70
      * @return Customer
71 71
      */
72
-    public function getCustomer () {
72
+    public function getCustomer() {
73 73
         return Customer::load($this, $this->getCustomerId());
74 74
     }
75 75
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
      *
79 79
      * @return string
80 80
      */
81
-    final public function getState () {
81
+    final public function getState() {
82 82
         return $this->getProvince();
83 83
     }
84 84
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
      *
88 88
      * @return string
89 89
      */
90
-    final public function getStateCode () {
90
+    final public function getStateCode() {
91 91
         return $this->getProvinceCode();
92 92
     }
93 93
 
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
      *
97 97
      * @return $this
98 98
      */
99
-    public function setDefault () {
99
+    public function setDefault() {
100 100
         assert($this->hasId());
101 101
         // tell the prior default address.
102 102
         if ($default = $this->getCustomer()->getDefaultAddress()) {
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
      * @param string $state
113 113
      * @return $this
114 114
      */
115
-    final public function setState (string $state) {
115
+    final public function setState(string $state) {
116 116
         return $this->setProvince($state);
117 117
     }
118 118
 
Please login to merge, or discard this patch.
src/Customer/SavedSearch.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
      * @param array $query
32 32
      * @return Customer[]
33 33
      */
34
-    public function getCustomers (array $query) {
34
+    public function getCustomers(array $query) {
35 35
         unset($query['fields']);
36 36
         return Customer::loadAll($this, "{$this}/customers", $query);
37 37
     }
Please login to merge, or discard this patch.
src/Metafield.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -47,20 +47,20 @@  discard block
 block discarded – undo
47 47
      * @param AbstractEntity $container
48 48
      * @param array $data
49 49
      */
50
-    public function __construct (AbstractEntity $container, array $data = []) {
50
+    public function __construct(AbstractEntity $container, array $data = []) {
51 51
         $this->container = $container;
52 52
         parent::__construct($container, $data);
53 53
     }
54 54
 
55
-    final public function __toString (): string {
55
+    final public function __toString(): string {
56 56
         return "metafields/{$this->getId()}";
57 57
     }
58 58
 
59
-    protected function _container () {
59
+    protected function _container() {
60 60
         return $this->container;
61 61
     }
62 62
 
63
-    protected function _dir (): string {
63
+    protected function _dir(): string {
64 64
         if ($this->container instanceof Shop) {
65 65
             return 'metafields';
66 66
         }
@@ -70,14 +70,14 @@  discard block
 block discarded – undo
70 70
     /**
71 71
      * @return AbstractEntity
72 72
      */
73
-    public function getResource () {
73
+    public function getResource() {
74 74
         return $this->container;
75 75
     }
76 76
 
77 77
     /**
78 78
      * @return mixed
79 79
      */
80
-    public function getValue () {
80
+    public function getValue() {
81 81
         if ($this->isJson()) {
82 82
             return json_decode($this->data['value'] ?? 'null', true, JSON_BIGINT_AS_STRING | JSON_THROW_ON_ERROR);
83 83
         }
@@ -87,21 +87,21 @@  discard block
 block discarded – undo
87 87
     /**
88 88
      * @return bool
89 89
      */
90
-    final public function isInt (): bool {
90
+    final public function isInt(): bool {
91 91
         return $this->getValueType() === self::TYPE_INT;
92 92
     }
93 93
 
94 94
     /**
95 95
      * @return bool
96 96
      */
97
-    final public function isJson (): bool {
97
+    final public function isJson(): bool {
98 98
         return $this->getValueType() === self::TYPE_JSON;
99 99
     }
100 100
 
101 101
     /**
102 102
      * @return bool
103 103
      */
104
-    final public function isString (): bool {
104
+    final public function isString(): bool {
105 105
         return $this->getValueType() === self::TYPE_STRING;
106 106
     }
107 107
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      * @param mixed $value
110 110
      * @return $this
111 111
      */
112
-    public function setValue ($value) {
112
+    public function setValue($value) {
113 113
         if (is_int($value)) {
114 114
             $this->_set('value_type', self::TYPE_INT);
115 115
             return $this->_set('value', $value);
Please login to merge, or discard this patch.
src/SmartCollection.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      * @param Product $product
37 37
      * @return SmartCollect
38 38
      */
39
-    public function newCollect (Product $product) {
39
+    public function newCollect(Product $product) {
40 40
         return $this->api->factory($this, SmartCollect::class, [
41 41
             'collection_id' => $this->getId(),
42 42
             'product_id' => $product->getId()
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     /**
47 47
      * @return Rule
48 48
      */
49
-    public function newRule () {
49
+    public function newRule() {
50 50
         return $this->api->factory($this, Rule::class);
51 51
     }
52 52
 }
53 53
\ No newline at end of file
Please login to merge, or discard this patch.
src/InventoryLevel.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
      * @param int $qty +/-
23 23
      * @return $this
24 24
      */
25
-    public function adjustAvailable (int $qty) {
25
+    public function adjustAvailable(int $qty) {
26 26
         $remote = $this->api->post('inventory_levels', [
27 27
             'inventory_item_id' => $this->getInventoryItemId(),
28 28
             'location_id' => $this->getLocationId(),
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
      * @param bool $relocate
36 36
      * @return $this
37 37
      */
38
-    public function connect (bool $relocate = false) {
38
+    public function connect(bool $relocate = false) {
39 39
         $remote = $this->api->post('inventory_levels/connect', [
40 40
             'inventory_item_id' => $this->getInventoryItemId(),
41 41
             'location_id' => $this->getLocationId(),
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
         return $this->_setData($remote['inventory_level']);
45 45
     }
46 46
 
47
-    public function disconnect (): void {
47
+    public function disconnect(): void {
48 48
         $this->api->delete('inventory_levels', [
49 49
             'inventory_item_id' => $this->getInventoryItemId(),
50 50
             'location_id' => $this->getLocationId()
@@ -54,14 +54,14 @@  discard block
 block discarded – undo
54 54
     /**
55 55
      * @return InventoryItem
56 56
      */
57
-    public function getInventoryItem () {
57
+    public function getInventoryItem() {
58 58
         return InventoryItem::load($this, $this->getInventoryItemId());
59 59
     }
60 60
 
61 61
     /**
62 62
      * @return Location
63 63
      */
64
-    public function getLocation () {
64
+    public function getLocation() {
65 65
         return Location::load($this, $this->getLocationId());
66 66
     }
67 67
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
      * @param int $qty
70 70
      * @return InventoryLevel
71 71
      */
72
-    public function setAvailable (int $qty) {
72
+    public function setAvailable(int $qty) {
73 73
         $remote = $this->api->post('inventory_levels', [
74 74
             'inventory_item_id' => $this->getInventoryItemId(),
75 75
             'location_id' => $this->getLocationId(),
Please login to merge, or discard this patch.