public function addChild(DashboardItem $child) { $child->setGroup($this); $name = $child->getName(); if (!isset($this->children[$name])) { $this->children[$name] = $child; } else { if ($this->children[$name] !== $child) { throw new \Exception("duplicate child"); } } }