public function findByName($name)
    {
        $this->loadMenus();

        $rootId = 0;
        if (0 < strpos($name, ':')) {
            list($rootName, $name) = explode(':', $name);
            if (null === $root = $this->findByName($rootName)) {
                throw new \InvalidArgumentException(sprintf('Root menu "%s" not found.', $rootName));
            }
            $rootId = intval($root['id']);
        }

        foreach ($this->menus as $menu) {
            if ($menu['name'] === $name && !(0 < $rootId && intval($menu['root']) != $rootId)) {
                return $menu;
            }
        }

        return null;
    }
public function findByName($name)
    {
        $this->loadMenus();

        $rootId = 0;
        if (0 < strpos($name, ':')) {
            list($rootName, $name) = explode(':', $name);
            if (null === $root = $this->findByName($rootName)) {
                throw new \InvalidArgumentException(sprintf('Root menu "%s" not found.', $rootName));
            }
            $rootId = intval($root['id']);
        }

        foreach ($this->menus as $menu) {
            if ($menu['name'] === $name && !(0 < $rootId && intval($menu['root']) != $rootId)) {
                return $menu;
            }
        }

        return null;
    }
public function findByName ( $ name ) { $ this -> loadMenus ( ) ; $ rootId = 0 ; if ( 0 < strpos ( $ name , ':' ) ) { list ( $ rootName , $ name ) = explode ( ':' , $ name ) ; if ( null === $ root = $ this -> findByName ( $ rootName ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Root menu "%s" not found.' , $ rootName ) ) ; } $ rootId = intval ( $ root [ 'id' ] ) ; } foreach ( $ this -> menus as $ menu ) { if ( $ menu [ 'name' ] === $ name && ! ( 0 < $ rootId && intval ( $ menu [ 'root' ] ) != $ rootId ) ) { return $ menu ; } } return null ; }
Finds the menu by his name.

@param string $name

@return null
Finds the menu by his name .