public function createItem($itemRouteName, array $itemOptions)
    {
        if (isset($itemOptions['item_class']))
        {
            $class = $itemOptions['item_class'];
        }
        else
        {
            $class = $this->getDefaultItemClass();
        }

        if (isset($this->itemClassAliases[$class]))
        {
            $class = $this->itemClassAliases[$class];
        }

        if (!$this->isValidMenuItemClass($class))
        {
            throw new NoMenuItemClassException(sprintf('Item class %s does not extend \C33s\MenuBundle\Item\MenuItem', $itemOptions['item_class']));
        }

        $item = new $class($itemRouteName, $itemOptions, $this);

        return $item;
    }
public function createItem($itemRouteName, array $itemOptions)
    {
        if (isset($itemOptions['item_class']))
        {
            $class = $itemOptions['item_class'];
        }
        else
        {
            $class = $this->getDefaultItemClass();
        }

        if (isset($this->itemClassAliases[$class]))
        {
            $class = $this->itemClassAliases[$class];
        }

        if (!$this->isValidMenuItemClass($class))
        {
            throw new NoMenuItemClassException(sprintf('Item class %s does not extend \C33s\MenuBundle\Item\MenuItem', $itemOptions['item_class']));
        }

        $item = new $class($itemRouteName, $itemOptions, $this);

        return $item;
    }
public function createItem ( $ itemRouteName , array $ itemOptions ) { if ( isset ( $ itemOptions [ 'item_class' ] ) ) { $ class = $ itemOptions [ 'item_class' ] ; } else { $ class = $ this -> getDefaultItemClass ( ) ; } if ( isset ( $ this -> itemClassAliases [ $ class ] ) ) { $ class = $ this -> itemClassAliases [ $ class ] ; } if ( ! $ this -> isValidMenuItemClass ( $ class ) ) { throw new NoMenuItemClassException ( sprintf ( 'Item class %s does not extend \C33s\MenuBundle\Item\MenuItem' , $ itemOptions [ 'item_class' ] ) ) ; } $ item = new $ class ( $ itemRouteName , $ itemOptions , $ this ) ; return $ item ; }
MenuItem factory method.

@param string $itemRouteName
@param array $itemOptions
@throws NoMenuItemClassException

@return MenuItem
MenuItem factory method .