<commit_before><?php
/**
 * @author <NAME> (http://stefanotorresi.it)
 * @license See the file LICENSE.txt for copying permission.
 * ************************************************
 */

namespace MyBackend\Navigation;

use MyBackend\Options\ModuleOptions;
use Zend\Mvc\Application;
use Zend\Navigation\Navigation;
use Zend\Navigation\Page\Mvc as MvcPage;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;

class BackendBreadcrumbsFactory implements FactoryInterface
{
    /**
     * Create service
     *
     * @param ServiceLocatorInterface $serviceLocator
     * @return mixed
     */
    public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /** @var ModuleOptions $options */
        $options = $serviceLocator->get('MyBackend\Options\ModuleOptions');

        /** @var Navigation $navBackend */
        $navBackend = $serviceLocator->get('MyBackend\Navigation\BackendNavigation');

        /** @var Application $application */
        $application = $serviceLocator->get('Application');
        $routeMatch  = $application->getMvcEvent()->getRouteMatch();
        $router      = $application->getMvcEvent()->getRouter();

        $home = new MvcPage([
            'label'         => 'Backend',
            'route'         => $options->getBackendRoute(),
            'router'        => $router,
            'routeMatch'    => $routeMatch
        ]);

        foreach ($navBackend->getPages() as $page) {
            $home->addPage(clone $page);
        }

        $pages = [$home];

        return new Navigation($pages);
    }
}<commit_msg>use toArray instead of clone<commit_after><?php
/**
 * @author <NAME> (http://stefanotorresi.it)
 * @license See the file LICENSE.txt for copying permission.
 * ************************************************
 */

namespace MyBackend\Navigation;

use MyBackend\Options\ModuleOptions;
use Zend\Mvc\Application;
use Zend\Navigation\Navigation;
use Zend\Navigation\Page\Mvc as MvcPage;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;

class BackendBreadcrumbsFactory implements FactoryInterface
{
    /**
     * Create service
     *
     * @param ServiceLocatorInterface $serviceLocator
     * @return mixed
     */
    public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /** @var ModuleOptions $options */
        $options = $serviceLocator->get('MyBackend\Options\ModuleOptions');

        /** @var Navigation $navBackend */
        $navBackend = $serviceLocator->get('MyBackend\Navigation\BackendNavigation');

        /** @var Application $application */
        $application = $serviceLocator->get('Application');
        $routeMatch  = $application->getMvcEvent()->getRouteMatch();
        $router      = $application->getMvcEvent()->getRouter();

        $home = new MvcPage([
            'label'         => 'Backend',
            'route'         => $options->getBackendRoute(),
            'router'        => $router,
            'routeMatch'    => $routeMatch
        ]);

        foreach ($navBackend->getPages() as $page) {
            $home->addPage($page->toArray());
        }

        $pages = [$home];

        return new Navigation($pages);
    }
}
{'fraction_non_alphanumeric': 0.1570552147239264, 'fraction_numerical': 0.0, 'mean_word_length': 2.859171597633136, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 34, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4551159', 'n_tokens_mistral': 873, 'n_tokens_neox': 869, 'n_words': 171}