@@ -21,7 +21,9 @@ discard block |
||
21 | 21 | public static function create(Connector $connector, string $model, array $data = []): ?Model |
22 | 22 | { |
23 | 23 | $model = strtolower($model); |
24 | - if (!array_key_exists($model, ClassMap::MODELS)) return null; |
|
24 | + if (!array_key_exists($model, ClassMap::MODELS)) { |
|
25 | + return null; |
|
26 | + } |
|
25 | 27 | |
26 | 28 | $cls = ClassMap::MODELS[$model]; |
27 | 29 | return new $cls($connector, $data); |
@@ -35,7 +37,9 @@ discard block |
||
35 | 37 | public static function make(Connector $connector, array $data): ?ObjectResource |
36 | 38 | { |
37 | 39 | $model = $data['model'] ?? ''; |
38 | - if (!$model) return new ObjectResource($connector, $data); |
|
40 | + if (!$model) { |
|
41 | + return new ObjectResource($connector, $data); |
|
42 | + } |
|
39 | 43 | return self::create($connector, $model, $data); |
40 | 44 | } |
41 | 45 | } |
@@ -19,7 +19,9 @@ |
||
19 | 19 | public static function inst(Connector $connector, string $service): ?ApiService |
20 | 20 | { |
21 | 21 | $service = strtolower($service); |
22 | - if (!array_key_exists($service, ClassMap::SERVICES)) return null; |
|
22 | + if (!array_key_exists($service, ClassMap::SERVICES)) { |
|
23 | + return null; |
|
24 | + } |
|
23 | 25 | |
24 | 26 | $cls = ClassMap::SERVICES[$service]; |
25 | 27 | return new $cls($connector); |
@@ -98,7 +98,9 @@ |
||
98 | 98 | { |
99 | 99 | $curl = $this->getClient()->curl_api($url, 'DELETE', $params); |
100 | 100 | |
101 | - if ($curl->isValid()) return true; |
|
101 | + if ($curl->isValid()) { |
|
102 | + return true; |
|
103 | + } |
|
102 | 104 | |
103 | 105 | throw new ApiException($curl->getError()); |
104 | 106 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | public function fetch(int $id): ?Customer |
24 | 24 | { |
25 | 25 | /** @var Customer|null $fetch */ |
26 | - $fetch = $this->_get('api/customers/customer' . $id); |
|
26 | + $fetch = $this->_get('api/customers/customer'.$id); |
|
27 | 27 | return $fetch; |
28 | 28 | } |
29 | 29 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | public function update(int $id, array $data): ?Customer |
51 | 51 | { |
52 | 52 | /** @var Customer|null $post */ |
53 | - $post = $this->_post('api/customers/customer/' . $id, $data); |
|
53 | + $post = $this->_post('api/customers/customer/'.$id, $data); |
|
54 | 54 | return $post; |
55 | 55 | } |
56 | 56 |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | public function fetch(int $id): ?Address |
24 | 24 | { |
25 | 25 | /** @var Address|null $address */ |
26 | - $address = $this->_get('api/addresses/address' . $id); |
|
26 | + $address = $this->_get('api/addresses/address'.$id); |
|
27 | 27 | return $address; |
28 | 28 | } |
29 | 29 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | public function update(int $id, array $data): ?Address |
51 | 51 | { |
52 | 52 | /** @var Address|null $address */ |
53 | - $address = $this->_post('api/addresses/address/' . $id, $data); |
|
53 | + $address = $this->_post('api/addresses/address/'.$id, $data); |
|
54 | 54 | return $address; |
55 | 55 | } |
56 | 56 |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | public function fetch(int $id): ?Order |
44 | 44 | { |
45 | 45 | /** @var Order|null $fetch */ |
46 | - $fetch = $this->_get('api/orders/order' . $id); |
|
46 | + $fetch = $this->_get('api/orders/order'.$id); |
|
47 | 47 | return $fetch; |
48 | 48 | } |
49 | 49 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | public function update(int $id, array $data): ?Order |
71 | 71 | { |
72 | 72 | /** @var Order|null $post */ |
73 | - $post = $this->_post('api/orders/order/' . $id, $data); |
|
73 | + $post = $this->_post('api/orders/order/'.$id, $data); |
|
74 | 74 | return $post; |
75 | 75 | } |
76 | 76 |
@@ -59,7 +59,9 @@ |
||
59 | 59 | */ |
60 | 60 | public function Customer(): ?Customer |
61 | 61 | { |
62 | - if (!$this->CustomerID) return null; |
|
62 | + if (!$this->CustomerID) { |
|
63 | + return null; |
|
64 | + } |
|
63 | 65 | |
64 | 66 | /** @var Customer|null $customer */ |
65 | 67 | $customer = $this->getClient()->customers->fetch($this->CustomerID); |
@@ -35,19 +35,19 @@ discard block |
||
35 | 35 | // Model or Object |
36 | 36 | if (!array_key_exists('field_name', $value)) { |
37 | 37 | $this->$field = ObjectFactory::make($client, $value); |
38 | - } else { |
|
38 | + }else { |
|
39 | 39 | // Has One Relation - Deprecated |
40 | 40 | $name = $value['field_name']; |
41 | 41 | $this->$name = $value['field_value']; |
42 | 42 | $this->$field = ObjectFactory::make($client, $value['object_data']); |
43 | 43 | } |
44 | - } else { |
|
44 | + }else { |
|
45 | 45 | // HasMany / ManyMany Relation |
46 | 46 | $list = []; |
47 | 47 | foreach ($value as $item) { |
48 | 48 | if (ArrayLib::is_associative($item)) { |
49 | 49 | $list[] = ObjectFactory::make($client, $item); |
50 | - } else { |
|
50 | + }else { |
|
51 | 51 | $list[] = $item; |
52 | 52 | } |
53 | 53 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | { |
82 | 82 | if ($this->exists()) { |
83 | 83 | return $this->getService()->update($this->ID, $this->toArray()); |
84 | - } else { |
|
84 | + }else { |
|
85 | 85 | return $this->getService()->create($this->toArray()); |
86 | 86 | } |
87 | 87 | } |
@@ -7,7 +7,7 @@ |
||
7 | 7 | function lifeboat_date_formatter(string $date) |
8 | 8 | { |
9 | 9 | try { |
10 | - $date = new \DateTime($date . ' CET'); |
|
10 | + $date = new \DateTime($date.' CET'); |
|
11 | 11 | return $date; |
12 | 12 | } catch (Exception $e) { |
13 | 13 | error_log($e); |