@@ -61,7 +61,7 @@ |
||
| 61 | 61 | { |
| 62 | 62 | $data = json_decode($json, true); |
| 63 | 63 | |
| 64 | - if (!isset($data['object']) || $data['object'] !== $this->acceptsObject()) { |
|
| 64 | + if (!isset($data[ 'object' ]) || $data[ 'object' ] !== $this->acceptsObject()) { |
|
| 65 | 65 | throw new InvalidArgumentException('Invalid object'); |
| 66 | 66 | } |
| 67 | 67 | |
@@ -46,10 +46,10 @@ |
||
| 46 | 46 | { |
| 47 | 47 | $objectFactory = new ObjectFactory(); |
| 48 | 48 | |
| 49 | - $objects = []; |
|
| 49 | + $objects = [ ]; |
|
| 50 | 50 | |
| 51 | 51 | foreach ($this->data as $data) { |
| 52 | - $objects[] = $objectFactory->makeFromArray($data); |
|
| 52 | + $objects[ ] = $objectFactory->makeFromArray($data); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | return $objects; |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | $data = json_decode($json, true); |
| 26 | 26 | |
| 27 | 27 | if (!is_array($data)) { |
| 28 | - $data = []; |
|
| 28 | + $data = [ ]; |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | return $this->makeFromArray($data); |
@@ -38,12 +38,12 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | public function makeFromArray(array $data): ObjectInterface |
| 40 | 40 | { |
| 41 | - if (!isset($data['object'])) { |
|
| 41 | + if (!isset($data[ 'object' ])) { |
|
| 42 | 42 | throw new InvalidArgumentException('Invalid data format'); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | // Load class name from map or generate one |
| 46 | - $type = self::CLASS_MAPPING[$data['object']] ?? __NAMESPACE__ . '\\' . ucfirst($data['object']); |
|
| 46 | + $type = self::CLASS_MAPPING[ $data[ 'object' ] ] ?? __NAMESPACE__ . '\\' . ucfirst($data[ 'object' ]); |
|
| 47 | 47 | |
| 48 | 48 | if (!class_exists($type) || !in_array(ObjectInterface::class, class_implements($type), true)) { |
| 49 | 49 | throw new UnexpectedValueException('Unsupported object'); |