src/Label305/Auja/Menu/Menu.php
public function addMenuItem(MenuItem $menuItem, $position = -1) {
        if (!is_int($position)) {
            throw new InvalidArgumentException('position should be of type int.');
        }

        if ($position < 0) {
            $position = count($this->menuItems);
        }

        $menuItem->setOrder($position);

        Utils::array_insert($this->menuItems, $menuItem, $position);

        return $this;
    }
public function addMenuItem(MenuItem $menuItem, $position = -1) {
        if (!is_int($position)) {
            throw new InvalidArgumentException('position should be of type int.');
        }

        if ($position < 0) {
            $position = count($this->menuItems);
        }

        $menuItem->setOrder($position);

        Utils::array_insert($this->menuItems, $menuItem, $position);

        return $this;
    }
public function addMenuItem ( MenuItem $ menuItem , $ position = - 1 ) { if ( ! is_int ( $ position ) ) { throw new InvalidArgumentException ( 'position should be of type int.' ) ; } if ( $ position < 0 ) { $ position = count ( $ this -> menuItems ) ; } $ menuItem -> setOrder ( $ position ) ; Utils :: array_insert ( $ this -> menuItems , $ menuItem , $ position ) ; return $ this ; }
Adds a MenuItem to this Menu.

@param MenuItem $menuItem The MenuItem to add.
@param int $position The position in the menu the MenuItem should have.
If not set, it is appended to the end.
@return $this
Adds a MenuItem to this Menu .