<commit_before><?php

/*
 * This file is part of the Silex framework.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Silex;

use Symfony\Component\HttpKernel\HttpKernel;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\Controller\ControllerResolver;
use Symfony\Component\HttpKernel\Event\KernelEvent;
use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent;
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpKernel\Events as HttpKernelEvents;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\Matcher\UrlMatcher;
use Symfony\Component\Routing\Matcher\Exception\MethodNotAllowedException;
use Symfony\Component\Routing\Matcher\Exception\NotFoundException;
use Symfony\Component\ClassLoader\UniversalClassLoader;

/**
 * The Silex framework class.
 *
 * @author <NAME> <<EMAIL>>
 */
class Application extends \Pimple implements HttpKernelInterface, EventSubscriberInterface
{
    /**
     * Constructor.
     */
    public function __construct()
    {
        $sc = $this;

        $this['autoloader'] = $this->asShared(function () {
            $loader = new UniversalClassLoader();
            $loader->register();

            return $loader;
        });

        $this['routes'] = $this->asShared(function () {
            return new RouteCollection();
        });

        $this['controllers'] = $this->asShared(function () use ($sc) {
            return new ControllerCollection($sc['routes']);
        });

        $this['dispatcher'] = $this->asShared(function () use ($sc) {
            $dispatcher = new EventDispatcher();
            $dispatcher->addSubscriber($sc);
            $dispatcher->addListener(HttpKernelEvents::onCoreView, $sc, -10);

            return $dispatcher;
        });

        $this['resolver'] = $this->asShared(function () {
            return new ControllerResolver();
        });

        $this['kernel'] = $this->asShared(function () use ($sc) {
            return new HttpKernel($sc['dispatcher'], $sc['resolver']);
        });
    }

    public function register(ExtensionInterface $extension, array $values)
    {
        foreach ($values as $key => $value) {
            $this[$key] = $value;
        }
<commit_msg>renamed $sc to $app<commit_after><?php

/*
 * This file is part of the Silex framework.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Silex;

use Symfony\Component\HttpKernel\HttpKernel;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\Controller\ControllerResolver;
use Symfony\Component\HttpKernel\Event\KernelEvent;
use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent;
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpKernel\Events as HttpKernelEvents;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\Matcher\UrlMatcher;
use Symfony\Component\Routing\Matcher\Exception\MethodNotAllowedException;
use Symfony\Component\Routing\Matcher\Exception\NotFoundException;
use Symfony\Component\ClassLoader\UniversalClassLoader;

/**
 * The Silex framework class.
 *
 * @author <NAME> <<EMAIL>>
 */
class Application extends \Pimple implements HttpKernelInterface, EventSubscriberInterface
{
    /**
     * Constructor.
     */
    public function __construct()
    {
        $app = $this;

        $this['autoloader'] = $this->asShared(function () {
            $loader = new UniversalClassLoader();
            $loader->register();

            return $loader;
        });

        $this['routes'] = $this->asShared(function () {
            return new RouteCollection();
        });

        $this['controllers'] = $this->asShared(function () use ($app) {
            return new ControllerCollection($app['routes']);
        });

        $this['dispatcher'] = $this->asShared(function () use ($app) {
            $dispatcher = new EventDispatcher();
            $dispatcher->addSubscriber($app);
            $dispatcher->addListener(HttpKernelEvents::onCoreView, $app, -10);

            return $dispatcher;
        });

        $this['resolver'] = $this->asShared(function () {
            return new ControllerResolver();
        });

        $this['kernel'] = $this->asShared(function () use ($app) {
            return new HttpKernel($app['dispatcher'], $app['resolver']);
        });
    }

    public function register(ExtensionInterface $extension, array $values)
    {
        foreach ($values as $key => $value) {
            $this[$key] = $value;
        }

{'fraction_non_alphanumeric': 0.1213498863437664, 'fraction_numerical': 0.000699422976044763, 'mean_word_length': 3.605475040257649, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 35, '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': '1847428', 'n_tokens_mistral': 1541, 'n_tokens_neox': 1526, 'n_words': 311}