<commit_before><?php
/**
 * @author <NAME> <<EMAIL>>
 */

namespace BuggymanModule;


use Buggyman\Buggyman;
use Exception;
use Zend\EventManager\EventInterface;
use Zend\ModuleManager\Feature\BootstrapListenerInterface;
use Zend\ModuleManager\Feature\ConfigProviderInterface;
use Zend\ModuleManager\Feature\ServiceProviderInterface;
use Zend\Mvc\ApplicationInterface;
use Zend\Mvc\MvcEvent;
use Zend\ServiceManager\ServiceManager;
use Zend\View\Helper\InlineScript;
use Zend\View\HelperPluginManager;

class Module implements BootstrapListenerInterface, ConfigProviderInterface, ServiceProviderInterface
{
    /**
     * {@inheritdoc}
     */
    public function onBootstrap(EventInterface $e)
    {
        /** @var ApplicationInterface $app */
        $app = $e->getTarget();
        $serviceManager = $app->getServiceManager();
        /** @var Options $options */
        $options = $serviceManager->get('BuggymanOptions');
        if ($options->getEnabled() && $options->getToken()) {
            Buggyman::setToken($options->getToken());
            Buggyman::setErrorLevel($options->getErrorLevel());
            Buggyman::init();

            $app->getEventManager()->attach(
                [MvcEvent::EVENT_DISPATCH_ERROR],
                function (MvcEvent $event) use ($serviceManager) {
                    if ($event->getParam('exception') instanceof Exception) {
                        Buggyman::reportException($event->getParam('exception'));
                    }
                }
            );

            /** @var HelperPluginManager $pluginManager */
            $pluginManager = $serviceManager->get('ViewHelperManager');
            /** @var InlineScript $inline */
            $inline = $pluginManager->get('InlineScript');
            $inline($inline::FILE, 'http://api.buggyman.io/v1/js/' . $options->getToken() . '/collector.js');
        }
    }

    /**
     * {@inheritdoc}
     */
    public function getConfig()
    {
        return include __DIR__ . "/../../config/module.config.php";
    }

    /**
     * {@inheritdoc}
     */
    public function getServiceConfig()
    {
        return array(
            'factories' => array(
                'BuggymanOptions' => function (ServiceManager $sm) {
                    $config = $sm->get('Config');<commit_msg>change js api. to cdn.<commit_after><?php
/**
 * @author <NAME> <<EMAIL>>
 */

namespace BuggymanModule;


use Buggyman\Buggyman;
use Exception;
use Zend\EventManager\EventInterface;
use Zend\ModuleManager\Feature\BootstrapListenerInterface;
use Zend\ModuleManager\Feature\ConfigProviderInterface;
use Zend\ModuleManager\Feature\ServiceProviderInterface;
use Zend\Mvc\ApplicationInterface;
use Zend\Mvc\MvcEvent;
use Zend\ServiceManager\ServiceManager;
use Zend\View\Helper\InlineScript;
use Zend\View\HelperPluginManager;

class Module implements BootstrapListenerInterface, ConfigProviderInterface, ServiceProviderInterface
{
    /**
     * {@inheritdoc}
     */
    public function onBootstrap(EventInterface $e)
    {
        /** @var ApplicationInterface $app */
        $app = $e->getTarget();
        $serviceManager = $app->getServiceManager();
        /** @var Options $options */
        $options = $serviceManager->get('BuggymanOptions');
        if ($options->getEnabled() && $options->getToken()) {
            Buggyman::setToken($options->getToken());
            Buggyman::setErrorLevel($options->getErrorLevel());
            Buggyman::init();

            $app->getEventManager()->attach(
                [MvcEvent::EVENT_DISPATCH_ERROR],
                function (MvcEvent $event) use ($serviceManager) {
                    if ($event->getParam('exception') instanceof Exception) {
                        Buggyman::reportException($event->getParam('exception'));
                    }
                }
            );

            /** @var HelperPluginManager $pluginManager */
            $pluginManager = $serviceManager->get('ViewHelperManager');
            /** @var InlineScript $inline */
            $inline = $pluginManager->get('InlineScript');
            $inline($inline::FILE, 'http://cdn.buggyman.io/v1/js/' . $options->getToken() . '/collector.js');
        }
    }

    /**
     * {@inheritdoc}
     */
    public function getConfig()
    {
        return include __DIR__ . "/../../config/module.config.php";
    }

    /**
     * {@inheritdoc}
     */
    public function getServiceConfig()
    {
        return array(
            'factories' => array(
                'BuggymanOptions' => function (ServiceManager $sm) {
                    $config = $sm->get('Config');
{'fraction_non_alphanumeric': 0.14071661237785016, 'fraction_numerical': 0.00043431053203040176, 'mean_word_length': 2.460555972952667, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 43, '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': '1855765', 'n_tokens_mistral': 1248, 'n_tokens_neox': 1216, 'n_words': 213}