Conditions | 6 |
Paths | 6 |
Total Lines | 28 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 42 |
Changes | 0 |
1 | <?php |
||
23 | { |
||
24 | if ($value instanceof ScalarValueInterface) { |
||
25 | return $value->getData(); |
||
26 | } |
||
27 | |||
28 | if ($value instanceof ArrayValueInterface) { |
||
29 | $result = []; |
||
30 | foreach ($value->createChildIterator() as $index => $element) { |
||
31 | $result[$index] = $this->exportValue($element); |
||
32 | } |
||
33 | |||
34 | return $result; |
||
35 | } |
||
36 | |||
37 | if ($value instanceof ObjectValueInterface) { |
||
38 | $result = (object) []; |
||
39 | foreach ($value->createChildIterator() as $name => $property) { |
||
40 | $result->{$name} = $this->exportValue($property); |
||
41 | } |
||
42 | |||
43 | return $result; |
||
44 | } |
||
45 | |||
46 | throw new Exception\UnexpectedValueException($value); |
||
47 | } |
||
48 | } |
||
49 |