Total Complexity | 9 |
Total Lines | 46 |
Duplicated Lines | 0 % |
Coverage | 95.24% |
Changes | 0 |
1 | <?php |
||
14 | class Root extends NodeGeneric |
||
15 | { |
||
16 | /** @var null|YamlObject */ |
||
17 | private $_yamlObject; |
||
18 | /** @var NodeList */ |
||
19 | public $value; |
||
20 | |||
21 | 7 | public function __construct() |
|
22 | { |
||
23 | 7 | $this->value = new NodeList(); |
|
24 | 7 | } |
|
25 | |||
26 | 1 | public function getParent(int $indent = null, $type = 0):NodeGeneric |
|
27 | { |
||
28 | 1 | if ($this->_parent !== null) { |
|
29 | 1 | throw new \ParseError(__CLASS__." can NOT have a parent, something's wrong", 1); |
|
30 | } |
||
31 | 1 | return $this; |
|
32 | } |
||
33 | |||
34 | 1 | public function getRoot():Root |
|
35 | { |
||
36 | 1 | return $this; |
|
37 | } |
||
38 | |||
39 | 2 | public function getYamlObject():YamlObject |
|
40 | { |
||
41 | 2 | if ($this->_yamlObject) { |
|
42 | 1 | return $this->_yamlObject; |
|
43 | } |
||
44 | 1 | throw new \Exception("YamlObject has not been set yet", 1); |
|
45 | } |
||
46 | |||
47 | 1 | public function build(&$parent = null) |
|
48 | { |
||
49 | 1 | return $this->buildFinal($parent); |
|
50 | } |
||
51 | |||
52 | 3 | private function buildFinal(YamlObject $yamlObject):YamlObject |
|
60 | } |
||
61 | } |