Conditions | 6 |
Paths | 8 |
Total Lines | 18 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
28 | public function createValue($data, ?PathInterface $path = null): NodeValueInterface |
||
29 | { |
||
30 | if (!isset($path)) { |
||
31 | $path = new Path; |
||
32 | } |
||
33 | if (null === $data || is_scalar($data)) { |
||
34 | return new NodeScalarValue($data, $path); |
||
35 | } |
||
36 | |||
37 | if (is_array($data)) { |
||
38 | return new NodeArrayValue($data, $path, $this); |
||
39 | } |
||
40 | |||
41 | if ($data instanceof stdClass) { |
||
|
|||
42 | return new NodeObjectValue($data, $path, $this); |
||
43 | } |
||
44 | |||
45 | throw new Exception\InvalidNodeDataException($data, $path); |
||
46 | } |
||
48 |