public function withoutItem (MenuItem $item)
    {
        $cloned = clone $this;
        
        foreach ($cloned->items as $storedIndex => $storedItem) {
            if ($storedItem === $item) {
                unset($cloned->items[$storedIndex]);
                break;
            }
        }
        
        return $cloned;
    }
public function withoutItem (MenuItem $item)
    {
        $cloned = clone $this;
        
        foreach ($cloned->items as $storedIndex => $storedItem) {
            if ($storedItem === $item) {
                unset($cloned->items[$storedIndex]);
                break;
            }
        }
        
        return $cloned;
    }
public function withoutItem ( MenuItem $ item ) { $ cloned = clone $ this ; foreach ( $ cloned -> items as $ storedIndex => $ storedItem ) { if ( $ storedItem === $ item ) { unset ( $ cloned -> items [ $ storedIndex ] ) ; break ; } } return $ cloned ; }
Removes the specified item from the menu. Ensures the menu item remains immutable.

@param MenuItem $item

@return MenuItem
Removes the specified item from the menu . Ensures the menu item remains immutable .