@@ -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; |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | $data = json_decode($json, true); |
21 | 21 | |
22 | 22 | if (!is_array($data)) { |
23 | - $data = []; |
|
23 | + $data = [ ]; |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | return $this->makeFromArray($data); |
@@ -28,12 +28,12 @@ discard block |
||
28 | 28 | |
29 | 29 | public function makeFromArray(array $data): ObjectInterface |
30 | 30 | { |
31 | - if (!isset($data['object'])) { |
|
31 | + if (!isset($data[ 'object' ])) { |
|
32 | 32 | throw new InvalidArgumentException('Invalid data format'); |
33 | 33 | } |
34 | 34 | |
35 | 35 | // Load class name from map or generate one |
36 | - $type = self::CLASS_MAPPING[$data['object']] ?? __NAMESPACE__ . '\\' . ucfirst($data['object']); |
|
36 | + $type = self::CLASS_MAPPING[ $data[ 'object' ] ] ?? __NAMESPACE__ . '\\' . ucfirst($data[ 'object' ]); |
|
37 | 37 | |
38 | 38 | if (!class_exists($type) || !in_array(ObjectInterface::class, class_implements($type), true)) { |
39 | 39 | throw new UnexpectedValueException('Unsupported object'); |
@@ -49,7 +49,7 @@ |
||
49 | 49 | { |
50 | 50 | $data = json_decode($json, true); |
51 | 51 | |
52 | - if (!is_array($data) || !isset($data['object']) || $data['object'] !== $this->acceptsObject()) { |
|
52 | + if (!is_array($data) || !isset($data[ 'object' ]) || $data[ 'object' ] !== $this->acceptsObject()) { |
|
53 | 53 | throw new InvalidArgumentException('Invalid object'); |
54 | 54 | } |
55 | 55 |