public function setParent(ConfigEntity $ancestor)
{
if ($this->isAdjacency($ancestor->name, $this->name)) {
$this->parent = $ancestor;
} else {
if (is_null($this->parent)) {
throw new NoParentException();
}
$this->parent->setParent($ancestor);
}
}
/** * make hierarchy to upper * * @param ConfigEntity $ancestor config object * @return void * @throws NotHasParentException */ public function setParent(ConfigEntity $ancestor) { if ($this->isAdjacency($ancestor->name, $this->name)) { $this->parent = $ancestor; } else { if (is_null($this->parent)) { throw new NotHasParentException('Parent is not exists'); } $this->parent->setParent($ancestor); } }