@@ -212,20 +212,20 @@ |
||
212 | 212 | $t = $this->getItems(1); |
213 | 213 | $c = $this->count(); |
214 | 214 | |
215 | - return (function () use ($t, $c) { |
|
215 | + return (function() use ($t, $c) { |
|
216 | 216 | $i = 0; |
217 | 217 | $x = 0; |
218 | 218 | |
219 | 219 | while ($i < $c) { |
220 | 220 | if ($x === 0) { |
221 | 221 | $x = $this->_page_length; |
222 | - $t = $this->getItems((int) floor($i / $this->_page_length) + 1); |
|
222 | + $t = $this->getItems((int) floor($i / $this->_page_length)+1); |
|
223 | 223 | } |
224 | 224 | |
225 | - yield $i => $t[$this->_page_length - $x]; |
|
225 | + yield $i => $t[$this->_page_length-$x]; |
|
226 | 226 | |
227 | 227 | $x -= 1; |
228 | - $i ++; |
|
228 | + $i++; |
|
229 | 229 | } |
230 | 230 | })(); |
231 | 231 | } |
@@ -34,19 +34,19 @@ discard block |
||
34 | 34 | // Model or Object |
35 | 35 | if (!array_key_exists('field_name', $value)) { |
36 | 36 | $this->$field = ObjectFactory::make($client, $value); |
37 | - } else { |
|
37 | + }else { |
|
38 | 38 | // Has One Relation - Deprecated |
39 | 39 | $name = $value['field_name']; |
40 | 40 | $this->$name = $value['field_value']; |
41 | 41 | $this->$field = ObjectFactory::make($client, $value['object_data']); |
42 | 42 | } |
43 | - } else { |
|
43 | + }else { |
|
44 | 44 | // HasMany / ManyMany Relation |
45 | 45 | $list = []; |
46 | 46 | foreach ($value as $item) { |
47 | 47 | if (ArrayLib::is_associative($item)) { |
48 | 48 | $list[] = ObjectFactory::make($client, $item); |
49 | - } else { |
|
49 | + }else { |
|
50 | 50 | $list[] = $item; |
51 | 51 | } |
52 | 52 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | if ($this->exists()) { |
84 | 84 | if (!method_exists($service, 'update')) return $this; |
85 | 85 | return $service->update($this->ID, $this->toArray()); |
86 | - } else { |
|
86 | + }else { |
|
87 | 87 | if (!method_exists($service, 'create')) return $this; |
88 | 88 | return $service->create($this->toArray()); |
89 | 89 | } |
@@ -81,10 +81,14 @@ |
||
81 | 81 | $service = $this->getService(); |
82 | 82 | |
83 | 83 | if ($this->exists()) { |
84 | - if (!method_exists($service, 'update')) return $this; |
|
84 | + if (!method_exists($service, 'update')) { |
|
85 | + return $this; |
|
86 | + } |
|
85 | 87 | return $service->update($this->ID, $this->toArray()); |
86 | 88 | } else { |
87 | - if (!method_exists($service, 'create')) return $this; |
|
89 | + if (!method_exists($service, 'create')) { |
|
90 | + return $this; |
|
91 | + } |
|
88 | 92 | return $service->create($this->toArray()); |
89 | 93 | } |
90 | 94 | } |