/**
  * Add Item
  *
  * @param SolidStateMenuItem New menu item child
  */
 public function addItem(SolidStateMenuItem $item)
 {
     $item->setParentID($this->id);
     $this->children[] = $item;
 }
 /**
  * Add Item
  *
  * @param SolidStateMenuItem Menu item to add
  * @param string $parentName The name of the parent item or null
  */
 public function addItem(SolidStateMenuItem $item, $parentName = null)
 {
     if (null != ($result = $this->getItem($item->getName()))) {
         throw new SWException("A menu item by that name already exists: " . $item->getName());
     }
     $item->setID($this->nextItemID++);
     $parentItem = isset($parentName) ? $this->getItem($parentName) : $this->rootItem;
     if (!isset($parentItem)) {
         throw new SWException("Parent item not found: " . $parentName);
     }
     $parentItem->addItem($item);
 }