@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $result = null; |
62 | 62 | |
63 | 63 | $type = \gettype($data); |
64 | - $result = $this->primitives[ $type ] ?? null; |
|
64 | + $result = $this->primitives[$type] ?? null; |
|
65 | 65 | if (!\is_array($result) && !empty($result)) { |
66 | 66 | throw new \RuntimeException(sprintf('No data conversion mapping config for "%s" primitive.', $type)); |
67 | 67 | } |
@@ -97,13 +97,13 @@ discard block |
||
97 | 97 | $cls = \get_class($data); |
98 | 98 | if (\is_string($cls)) { |
99 | 99 | if (\array_key_exists($cls, $this->classes)) { |
100 | - $result = $this->classes[ $cls ]; |
|
100 | + $result = $this->classes[$cls]; |
|
101 | 101 | $debug_result = 'exact config match'; |
102 | 102 | } else { |
103 | 103 | // no exact match, then lets try with `instanceof` |
104 | 104 | foreach (\array_keys($this->classes) as $class_name) { |
105 | 105 | if ($data instanceof $class_name) { |
106 | - $result = $this->classes[ $class_name ]; |
|
106 | + $result = $this->classes[$class_name]; |
|
107 | 107 | $debug_result = "subclass of {$class_name}"; |
108 | 108 | break; |
109 | 109 | } |
@@ -150,21 +150,21 @@ discard block |
||
150 | 150 | |
151 | 151 | if ($result === null && \is_object($data)) { |
152 | 152 | $cfg = $this->getClassMappingConfigOrThrow($data); |
153 | - $worker = new $cfg[ RB::KEY_HANDLER ](); |
|
154 | - $result = [$cfg[ RB::KEY_KEY ] => $worker->convert($data, $cfg)]; |
|
153 | + $worker = new $cfg[RB::KEY_HANDLER](); |
|
154 | + $result = [$cfg[RB::KEY_KEY] => $worker->convert($data, $cfg)]; |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | if ($result === null && \is_array($data)) { |
158 | 158 | $cfg = $this->getPrimitiveMappingConfigOrThrow($data); |
159 | 159 | |
160 | 160 | $result = $this->convertArray($data); |
161 | - if (!Util::isArrayWithNonNumericKeys($data)){ |
|
162 | - $result = [$cfg[ RB::KEY_KEY ] => $result]; |
|
161 | + if (!Util::isArrayWithNonNumericKeys($data)) { |
|
162 | + $result = [$cfg[RB::KEY_KEY] => $result]; |
|
163 | 163 | } |
164 | 164 | } |
165 | 165 | |
166 | - if ( \is_bool($data) || \is_float($data) || \is_int($data) || \is_string($data)) { |
|
167 | - $result = [$this->getPrimitiveMappingConfigOrThrow($data)[ RB::KEY_KEY ] => $data]; |
|
166 | + if (\is_bool($data) || \is_float($data) || \is_int($data) || \is_string($data)) { |
|
167 | + $result = [$this->getPrimitiveMappingConfigOrThrow($data)[RB::KEY_KEY] => $data]; |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | return $result; |
@@ -203,12 +203,12 @@ discard block |
||
203 | 203 | |
204 | 204 | foreach ($data as $key => $val) { |
205 | 205 | if (\is_array($val)) { |
206 | - $data[ $key ] = $this->convertArray($val); |
|
206 | + $data[$key] = $this->convertArray($val); |
|
207 | 207 | } elseif (\is_object($val)) { |
208 | 208 | $cfg = $this->getClassMappingConfigOrThrow($val); |
209 | - $worker = new $cfg[ RB::KEY_HANDLER ](); |
|
209 | + $worker = new $cfg[RB::KEY_HANDLER](); |
|
210 | 210 | $converted_data = $worker->convert($val, $cfg); |
211 | - $data[ $key ] = $converted_data; |
|
211 | + $data[$key] = $converted_data; |
|
212 | 212 | } |
213 | 213 | } |
214 | 214 |