/**
  * @inheritDoc
  */
 public function add($element) : bool
 {
     if ($this->contains($element)) {
         throw new RuntimeException("Given element already exists in collection");
     }
     return parent::add($element);
 }
Exemple #2
0
 /**
  * Append new child node
  * @param Node $node
  * @return bool
  */
 public function append(Node $node) : bool
 {
     $node->parent = $this;
     return $this->childNodes->add($node);
 }