<commit_before><?php

namespace ZendDeveloperTools;

use Zend\Module\Manager,
    Zend\EventManager\StaticEventManager,
    Zend\Loader\AutoloaderFactory;

class Module
{
    protected $viewListener;
    protected $view;

    public function init(Manager $moduleManager)
    {
        $this->initAutoloader();
        Service\DeveloperTools::$startTime = microtime(true);
        $events = StaticEventManager::getInstance();
        $events->attach('bootstrap', 'bootstrap', array($this, 'initializeView'), 1000);
        $events->attach('Zend\Mvc\Application', 'finish', function($e) {
            Service\DeveloperTools::$stopTime = microtime(true);
            $devToolService = new Service\DeveloperTools;
            return $devToolService->appendResponse($e);
        });
    }

    protected function initAutoloader()
    {
        AutoloaderFactory::factory(array(
            'Zend\Loader\ClassMapAutoloader' => array(
                __DIR__ . '/autoload_classmap.php',
            ),
            'Zend\Loader\StandardAutoloader' => array(
                'namespaces' => array(
                    __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
                ),
            ),
        ));
    }

    public function getConfig($env = null)
    {
        return include __DIR__ . '/config/module.config.php';
    }

    public function initializeView($e)
    {
        $app          = $e->getParam('application');
        $locator      = $app->getLocator();
        $config       = $e->getParam('modules')->getMergedConfig();
        $view         = $this->getView($app);
        $viewListener = $this->getViewListener($view, $config);
        $events       = StaticEventManager::getInstance();
        $viewListener->registerStaticListeners($events, $locator);
    }

    protected function getViewListener($view, $config)
    {
        if ($this->viewListener instanceof View\Listener) {
            return $this->viewListener;
        }
        $viewListener       = new View\Listener($view, $config->zend_developer_tools->layout);
        $this->viewListener = $viewListener;
        return $viewListener;
    }

    protected function getView($app)<commit_msg>Update Module.php for latest module manager changes<commit_after><?php

namespace ZendDeveloperTools;

use Zend\Module\Manager,
    Zend\Module\Consumer\AutoloaderProvider,
    Zend\EventManager\StaticEventManager;

class Module implements AutoloaderProvider
{
    protected $viewListener;
    protected $view;

    public function init(Manager $moduleManager)
    {
        Service\DeveloperTools::$startTime = microtime(true);
        $events = StaticEventManager::getInstance();
        $events->attach('bootstrap', 'bootstrap', array($this, 'initializeView'), 1000);
        $events->attach('Zend\Mvc\Application', 'finish', function($e) {
            Service\DeveloperTools::$stopTime = microtime(true);
            $devToolService = new Service\DeveloperTools;
            return $devToolService->appendResponse($e);
        });
    }

    public function getAutoloaderConfig()
    {
        return array(
            'Zend\Loader\ClassMapAutoloader' => array(
                __DIR__ . '/autoload_classmap.php',
            ),
            'Zend\Loader\StandardAutoloader' => array(
                'namespaces' => array(
                    __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
                ),
            ),
        );
    }

    public function getConfig($env = null)
    {
        return include __DIR__ . '/config/module.config.php';
    }

    public function initializeView($e)
    {
        $app          = $e->getParam('application');
        $locator      = $app->getLocator();
        $config       = $e->getParam('config');
        $view         = $this->getView($app);
        $viewListener = $this->getViewListener($view, $config);
        $events       = StaticEventManager::getInstance();
        $viewListener->registerStaticListeners($events, $locator);
    }

    protected function getViewListener($view, $config)
    {
        if ($this->viewListener instanceof View\Listener) {
            return $this->viewListener;
        }
        $viewListener       = new View\Listener($view, $config->zend_developer_tools->layout);
        $this->viewListener = $viewListener;
        return $viewListener;
    }

    protected function getView($app)
{'fraction_non_alphanumeric': 0.12728937728937728, 'fraction_numerical': 0.0018315018315018315, 'mean_word_length': 2.3841982958946555, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3538416', 'n_tokens_mistral': 1219, 'n_tokens_neox': 1178, 'n_words': 207}