Conditions | 4 |
Paths | 6 |
Total Lines | 14 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
34 | public static function fromNative($value) |
||
35 | { |
||
36 | if ($value instanceof ValueObjectInterface) { |
||
37 | $value = $value->toNative(); |
||
38 | } |
||
39 | if (!is_array($value)) { |
||
40 | throw new InvalidValueForValueObjectException($value, __CLASS__); |
||
41 | } |
||
42 | |||
43 | $literal = new StringLiteral('$ref'); |
||
44 | if (!isset($value['$ref'])) { |
||
45 | throw new MissingValueException('$ref'); |
||
46 | } |
||
47 | return new Reference($literal->toNative($value['$ref'])); |
||
48 | } |
||
68 |