/** * {@inheritdoc} */ public function reorderChildren($order) { if (count($order) != $this->count()) { throw new \InvalidArgumentException('Cannot reorder children, order does not contain all children.'); } $newChildren = array(); foreach ($order as $name) { if (!$this->children->containsKey($name)) { throw new \InvalidArgumentException('Cannot find children named ' . $name); } $child = $this->getChild($name); $newChildren[$name] = $child; } $this->setChildren($newChildren); return $this; }