/** * Replaces the component by the specified componentes in the parent's child list. * The component itself is discarded from the components tree. * * @param array $components * @throws ComponentException */ public function replaceBy(array $components = null) { $p = $this->getIndex(); if ($p !== false) { array_splice($this->parent->children, $p, 1, $components); $this->parent->attach($components); } else { $t = ComponentInspector::inspectSet($this->parent->children); throw new ComponentException($this, "The component was not found on the parent's children.<h3>The children are:</h3><fieldset>{$t}</fieldset>"); } }