Conditions | 4 |
Paths | 4 |
Total Lines | 13 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 4.1755 |
Changes | 0 |
1 | <?php |
||
16 | 1 | public function &build(&$parent = null) |
|
17 | { |
||
18 | 1 | $name = substr((string) $this->anchor, 1); |
|
19 | 1 | $yamlObject = $this->getRoot()->getYamlObject(); |
|
20 | 1 | if (str_starts_with((string) $this->anchor, "*")) { |
|
21 | try { |
||
22 | 1 | return $yamlObject->getReference($name); |
|
23 | } catch (\Throwable $e) { |
||
24 | throw new \ParseError("Unknown anchor : '$name' this:" . $this->anchor, 1, $e); |
||
25 | } |
||
26 | } else { |
||
27 | 1 | $built = is_null($this->value) ? null : $this->value->build($parent); |
|
28 | 1 | return $yamlObject->addReference($name, $built); |
|
29 | } |
||
37 |