<commit_before><?php

namespace DI\Bridge\Silex;

use DI\Bridge\Silex\Container\CompositeContainer;
use DI\Bridge\Silex\Controller\ControllerResolver;
use DI\Container;
use DI\ContainerBuilder;
use Interop\Container\ContainerInterface;
use Interop\Container\Pimple\PimpleInterop;
use Pimple;

/**
 * Replacement for the Silex Application class to use PHP-DI instead of Pimple.
 *
 * @author <NAME> <<EMAIL>>
 */
class Application extends \Silex\Application
{
    /**
     * @var CompositeContainer
     */
    private $rootContainer;

    /**
     * @var Container
     */
    private $phpdi;

    /**
     * @var Pimple
     */
    private $pimple;

    /**
     * @param ContainerBuilder|null $containerBuilder You can optionally provide your preconfigured container builder.
     * @param array                 $values
     */
    public function __construct(ContainerBuilder $containerBuilder = null, array $values = [])
    {
        // The composite container "merges" PHP-DI and Pimple into one container
        $this->rootContainer = new CompositeContainer();

        $this->pimple = new PimpleInterop();
        $this->rootContainer->setPimple($this->pimple);

        $containerBuilder = $containerBuilder ?: new ContainerBuilder();
        $containerBuilder->wrapContainer($this->rootContainer);
        $this->phpdi = $containerBuilder->build();
        $this->rootContainer->setPhpdi($this->phpdi);

        parent::__construct($values);

        // Override the controller resolver with ours
        $this->pimple['resolver'] = function () {
            return new ControllerResolver($this->phpdi);
        };
    }

    public function offsetGet($id)
    {
        return $this->rootContainer->get($id);
    }

    public function offsetExists($id)
    {
        return $this->rootContainer->has($id);
    }

    public function offsetSet($id, $value)
    {
        $this->pimple[$id] = $value;
    }

    public function offsetUnset($id)
    {
        unset($this->pimple[$id]);
    }

    public function raw($id)
    {
        return $this->pimple->raw($id);
    }

    public function extend($id, $callable)
    {
        $this->pimple->extend($id, $callable);
    }

    public function keys()<commit_msg>Fix #2<commit_after><?php

namespace DI\Bridge\Silex;

use DI\Bridge\Silex\Container\CompositeContainer;
use DI\Bridge\Silex\Controller\ControllerResolver;
use DI\Container;
use DI\ContainerBuilder;
use Interop\Container\ContainerInterface;
use Interop\Container\Pimple\PimpleInterop;
use Pimple;

/**
 * Replacement for the Silex Application class to use PHP-DI instead of Pimple.
 *
 * @author <NAME> <<EMAIL>>
 */
class Application extends \Silex\Application
{
    /**
     * @var CompositeContainer
     */
    private $rootContainer;

    /**
     * @var Container
     */
    private $phpdi;

    /**
     * @var Pimple
     */
    private $pimple;

    /**
     * @param ContainerBuilder|null $containerBuilder You can optionally provide your preconfigured container builder.
     * @param array                 $values
     */
    public function __construct(ContainerBuilder $containerBuilder = null, array $values = [])
    {
        // The composite container "merges" PHP-DI and Pimple into one container
        $this->rootContainer = new CompositeContainer();

        $this->pimple = new PimpleInterop();
        $this->rootContainer->setPimple($this->pimple);

        $containerBuilder = $containerBuilder ?: new ContainerBuilder();
        $containerBuilder->wrapContainer($this->rootContainer);
        $this->phpdi = $containerBuilder->build();
        $this->rootContainer->setPhpdi($this->phpdi);

        parent::__construct($values);

        // Override the controller resolver with ours
        $this->pimple['resolver'] = function () {
            return new ControllerResolver($this->phpdi);
        };
    }

    public function offsetGet($id)
    {
        return $this->rootContainer->get($id);
    }

    public function offsetExists($id)
    {
        return $this->rootContainer->has($id);
    }

    public function offsetSet($id, $value)
    {
        $this->pimple[$id] = $value;
    }

    public function offsetUnset($id)
    {
        unset($this->pimple[$id]);
    }

    public function raw($id)
    {
        return $this->pimple->raw($id);
    }

    public function extend($id, $callable)
    {
        return $this->pimple->extend($id, $callable);
    }

    public function keys()
{'fraction_non_alphanumeric': 0.12954647507858105, 'fraction_numerical': 0.000224517287831163, 'mean_word_length': 2.690969345484673, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 57, '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': '4359627', 'n_tokens_mistral': 1326, 'n_tokens_neox': 1261, 'n_words': 281}