<commit_before><?php
/**
 * Navigation
 *
 * @category   SxBootstrap
 * @package    SxBootstrap_View
 * @subpackage Helper
 */
namespace SxBootstrap\View\Helper\Bootstrap;

use Zend\View\Helper\AbstractHtmlElement;
use Zend\Dom\Query;

class NavigationMenu extends AbstractHtmlElement
{
    /**
     * Render a default menu.
     *
     * @param  string|\SpiffyNavigation\Container|null $container
     * @param  array                                   $options
     * @return string
     */
    public function renderMenu($container = null, array $options = array())
    {
        return $this->getView()->navigationMenu()->renderMenu($container, $options);
    }

    /**
     * Render a dropdown menu
     *
     * @param  string|\SpiffyNavigation\Container|null $container
     * @param  array                                   $options
     * @return string
     */
    public function renderDropDownMenu($container = null, array $options = array())
    {
        $menu = $this->getView()->navigationMenu()->renderMenu($container, $options);
        $query = new Query($menu);
        $uls = $query->execute('li>ul');
        $caret = $uls->getDocument()->createDocumentFragment();
        $caret->appendXML('<b class="caret" />');

        /** @var \DOMElement $ul */
        foreach ($uls as $key => $ul) {
            $index = $key+1;

            $this->addCss('dropdown-menu', $ul);
            $ul->setAttribute('role', 'menu');
            $ul->setAttribute('aria-labelledby', "drop{$index}");

            $li = $ul->parentNode;
            $this->addCss('dropdown', $li);

            $a = $li->firstChild;
            $this->addCss('dropdown-toggle', $a);
            $a->setAttribute('role', 'button');
            $a->setAttribute('data-toggle', 'dropdown');
            $a->setAttribute('href', '#');
            $a->setAttribute('id', "drop{$index}");
            $a->appendChild($caret);<commit_msg>dropdown menu with more than one page having child pages is not rendered<commit_after><?php
/**
 * Navigation
 *
 * @category   SxBootstrap
 * @package    SxBootstrap_View
 * @subpackage Helper
 */
namespace SxBootstrap\View\Helper\Bootstrap;

use Zend\View\Helper\AbstractHtmlElement;
use Zend\Dom\Query;

class NavigationMenu extends AbstractHtmlElement
{
    /**
     * Render a default menu.
     *
     * @param  string|\SpiffyNavigation\Container|null $container
     * @param  array                                   $options
     * @return string
     */
    public function renderMenu($container = null, array $options = array())
    {
        return $this->getView()->navigationMenu()->renderMenu($container, $options);
    }

    /**
     * Render a dropdown menu
     *
     * @param  string|\SpiffyNavigation\Container|null $container
     * @param  array                                   $options
     * @return string
     */
    public function renderDropDownMenu($container = null, array $options = array())
    {
        $menu = $this->getView()->navigationMenu()->renderMenu($container, $options);
        $query = new Query($menu);
        $uls = $query->execute('li>ul');

        /** @var \DOMElement $ul */
        foreach ($uls as $key => $ul) {
            $caret = $uls->getDocument()->createDocumentFragment();
            $caret->appendXML('<b class="caret" />');
            $index = $key+1;

            $this->addCss('dropdown-menu', $ul);
            $ul->setAttribute('role', 'menu');
            $ul->setAttribute('aria-labelledby', "drop{$index}");

            $li = $ul->parentNode;
            $this->addCss('dropdown', $li);

            $a = $li->firstChild;
            $this->addCss('dropdown-toggle', $a);
            $a->setAttribute('role', 'button');
            $a->setAttribute('data-toggle', 'dropdown');
            $a->setAttribute('href', '#');
            $a->setAttribute('id', "drop{$index}");
            $a->appendChild($caret);
{'fraction_non_alphanumeric': 0.1618437900128041, 'fraction_numerical': 0.0005121638924455825, 'mean_word_length': 2.2468827930174564, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 53, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5277629', 'n_tokens_mistral': 1103, 'n_tokens_neox': 1094, 'n_words': 217}