/** * @param Element $element элемент родитель * @throws Exception */ public function setParent(Element $element) { if (!$element->getChild($this) instanceof Element) { throw new Exception('Элемент должен являться потомком'); } $this->parent = $element; }