src/Domain/DefaultMenu.php
public function add(Menu $menu)
    {
        foreach ($menu->getGroups() as $group) {
            if ($this->groups->has($group->getName())) {
                $existingGroup = $this->groups->get($group->getName());

                $group->hideHeading(!$group->shouldShowHeading());

                foreach ($group->getItems() as $item) {
                    $existingGroup->addItem($item);
                }
            } else {
                $this->addGroup($group);
            }
        }

        return $this;
    }
public function add(Menu $menu)
    {
        foreach ($menu->getGroups() as $group) {
            if ($this->groups->has($group->getName())) {
                $existingGroup = $this->groups->get($group->getName());

                $group->hideHeading(!$group->shouldShowHeading());

                foreach ($group->getItems() as $item) {
                    $existingGroup->addItem($item);
                }
            } else {
                $this->addGroup($group);
            }
        }

        return $this;
    }
public function add ( Menu $ menu ) { foreach ( $ menu -> getGroups ( ) as $ group ) { if ( $ this -> groups -> has ( $ group -> getName ( ) ) ) { $ existingGroup = $ this -> groups -> get ( $ group -> getName ( ) ) ; $ group -> hideHeading ( ! $ group -> shouldShowHeading ( ) ) ; foreach ( $ group -> getItems ( ) as $ item ) { $ existingGroup -> addItem ( $ item ) ; } } else { $ this -> addGroup ( $ group ) ; } } return $ this ; }
Add another Menu instance and combined the two
Groups with the same name get combined, but
inherit each other's items

@param Menu $menu

@return Menu $menu
Add another Menu instance and combined the two Groups with the same name get combined but inherit each other s items