/** * Remove esse componente da lista de filhos de seu pai. * @return Component Uma referência ao próprio Component * @throws BadMethodCallException Se esse componente não possuir * um pai. */ public function setOrphan() { if ($this->parent !== null) { if ($this->parent->contains($this)) { $this->parent->removeChild($this); } $this->parent = null; return $this; } else { throw new BadMethodCallException('Esse componente não possui um pai.'); } }