@@ -190,20 +190,20 @@ |
||
190 | 190 | $t = $this->getItems(1); |
191 | 191 | $c = $this->count(); |
192 | 192 | |
193 | - return (function () use ($t, $c) { |
|
193 | + return (function() use ($t, $c) { |
|
194 | 194 | $i = 0; |
195 | 195 | $x = 0; |
196 | 196 | |
197 | 197 | while ($i < $c) { |
198 | 198 | if ($x === 0) { |
199 | 199 | $x = $this->_page_length; |
200 | - $t = $this->getItems(floor($i / $this->_page_length) + 1); |
|
200 | + $t = $this->getItems(floor($i / $this->_page_length)+1); |
|
201 | 201 | } |
202 | 202 | |
203 | - yield $i => $t[$this->_page_length - $x]; |
|
203 | + yield $i => $t[$this->_page_length-$x]; |
|
204 | 204 | |
205 | 205 | $x -= 1; |
206 | - $i ++; |
|
206 | + $i++; |
|
207 | 207 | } |
208 | 208 | })(); |
209 | 209 | } |
@@ -107,11 +107,15 @@ discard block |
||
107 | 107 | |
108 | 108 | $this->_max_items = (int) $data['available_items']; |
109 | 109 | |
110 | - if (empty($data['items'])) return $this->_items[$page] = []; |
|
110 | + if (empty($data['items'])) { |
|
111 | + return $this->_items[$page] = []; |
|
112 | + } |
|
111 | 113 | |
112 | 114 | foreach ($data['items'] as $item) { |
113 | 115 | $obj = ObjectFactory::make($this->getClient(), $item); |
114 | - if (!$obj) continue; |
|
116 | + if (!$obj) { |
|
117 | + continue; |
|
118 | + } |
|
115 | 119 | |
116 | 120 | $this->_items[$page][] = $obj; |
117 | 121 | } |
@@ -126,7 +130,9 @@ discard block |
||
126 | 130 | */ |
127 | 131 | public function offsetGet($offset): ?ObjectResource |
128 | 132 | { |
129 | - foreach ($this as $i => $obj) if ($i === $offset) return $obj; |
|
133 | + foreach ($this as $i => $obj) { |
|
134 | + if ($i === $offset) return $obj; |
|
135 | + } |
|
130 | 136 | return null; |
131 | 137 | } |
132 | 138 | |
@@ -157,7 +163,9 @@ discard block |
||
157 | 163 | */ |
158 | 164 | public function offsetExists($offset): bool |
159 | 165 | { |
160 | - foreach ($this as $i => $obj) if ($offset === $i) return true; |
|
166 | + foreach ($this as $i => $obj) { |
|
167 | + if ($offset === $i) return true; |
|
168 | + } |
|
161 | 169 | return false; |
162 | 170 | } |
163 | 171 | |
@@ -213,6 +221,8 @@ discard block |
||
213 | 221 | */ |
214 | 222 | public function first(): ?Model |
215 | 223 | { |
216 | - foreach ($this as $obj) return $obj; |
|
224 | + foreach ($this as $obj) { |
|
225 | + return $obj; |
|
226 | + } |
|
217 | 227 | } |
218 | 228 | } |
@@ -43,7 +43,7 @@ |
||
43 | 43 | */ |
44 | 44 | public function save(): ?Model |
45 | 45 | { |
46 | - return $this->curl_for_model($this->getSaveURL(),'POST', $this->toArray()); |
|
46 | + return $this->curl_for_model($this->getSaveURL(), 'POST', $this->toArray()); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | throw new InvalidArgumentException("Address::fetch() expects parameter 1 to be a positive integer"); |
45 | 45 | } |
46 | 46 | |
47 | - return $this->curl_for_model('api/addresses/address/' . $id); |
|
47 | + return $this->curl_for_model('api/addresses/address/'.$id); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
@@ -70,6 +70,6 @@ discard block |
||
70 | 70 | */ |
71 | 71 | protected function getSaveURL(): string |
72 | 72 | { |
73 | - return 'api/addresses/address/' . $this->ID; |
|
73 | + return 'api/addresses/address/'.$this->ID; |
|
74 | 74 | } |
75 | 75 | } |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | public function curl_api(string $url, string $method = 'GET', array $data = [], array $headers = []): CurlResponse |
108 | 108 | { |
109 | 109 | $url = URL::is_absolute_url($url) ? $url |
110 | - : 'https://' . rtrim($this->_host, '/') . '/' . ltrim($url, '/'); |
|
110 | + : 'https://'.rtrim($this->_host, '/').'/'.ltrim($url, '/'); |
|
111 | 111 | |
112 | 112 | $curl = new Curl($url, $data, $headers); |
113 | 113 | |
@@ -126,6 +126,6 @@ discard block |
||
126 | 126 | */ |
127 | 127 | protected function auth_url(string $path): string |
128 | 128 | { |
129 | - return $this->_auth_domain . '/' . ltrim($path, '/'); |
|
129 | + return $this->_auth_domain.'/'.ltrim($path, '/'); |
|
130 | 130 | } |
131 | 131 | } |