/**
  * {@inheritdoc}
  */
 public function getPath()
 {
     $path = $this->name;
     if (null !== $this->parent) {
         $path = $this->parent->getPath() . '.' . $path;
     }
     return $path;
 }
Exemplo n.º 2
0
 /**
  * Append node.
  *
  * @param NodeInterface $child
  */
 public function append(NodeInterface $child)
 {
     $name = $child->getName();
     if (empty($name)) {
         throw new InvalidArgumentException('Child node name cannot be empty.');
     }
     if (isset($this->children[$name])) {
         throw new InvalidArgumentException(sprintf('Child node named "%s" already exists.', $name));
     }
     $this->children[$name] = $child;
 }