| @@ 33-43 (lines=11) @@ | ||
| 30 | * @return $this |
|
| 31 | * @throws \Exception |
|
| 32 | */ |
|
| 33 | public function addToArrayNode(AbstractNode $node, $allowDefault = false) |
|
| 34 | { |
|
| 35 | if (!$this->node instanceof ArrayNode) { |
|
| 36 | throw new \Exception(sprintf('You cannot call %s on node type %s', __METHOD__, get_class($this->node))); |
|
| 37 | } |
|
| 38 | ||
| 39 | $this->node->add($node, $allowDefault); |
|
| 40 | $this->reassignParent($node); |
|
| 41 | ||
| 42 | return $this; |
|
| 43 | } |
|
| 44 | ||
| 45 | /** |
|
| 46 | * @param string $key |
|
| @@ 52-62 (lines=11) @@ | ||
| 49 | * @return $this |
|
| 50 | * @throws \Exception |
|
| 51 | */ |
|
| 52 | public function addToObjectNode($key, AbstractNode $node, $allowDefault = false) |
|
| 53 | { |
|
| 54 | if (!$this->node instanceof ObjectNode) { |
|
| 55 | throw new \Exception(sprintf('You cannot call %s on node type %s', __METHOD__, get_class($this->node))); |
|
| 56 | } |
|
| 57 | ||
| 58 | $this->node->add($key, $node, $allowDefault); |
|
| 59 | $this->reassignParent($node); |
|
| 60 | ||
| 61 | return $this; |
|
| 62 | } |
|
| 63 | ||
| 64 | /** |
|
| 65 | * @param AbstractNode $node |
|