<commit_before><?php

namespace Polus;

use Aura\Di\Container;
use Aura\Di\Factory;
use Aura\Router\Map;
use Aura\Router\RouterContainer;
use ReflectionMethod;
use Zend\Diactoros\Response;

class App extends Container
{
    /**
     * @var Sender
     */
    public $sender;

    /**
     * @var Server
     */
    protected $request;

    /**
     * @var RouterContainer
     *
     */
    protected $routerContainer;

    /**
     * @var Map
     */
    protected $map;

    /**
     * @var mixed
     */
    protected $errorHandler;

    /**
     * @var string
     */
    protected $config_dir = '';

    /**
     * @var array
     */
    protected $configs = [];

    /**
     * @var array
     */
    protected $modeMap = [];

    /**
     * Psr7 middleware queue
     * @var array
     */
    protected $middlewares = [];

    /**
     * @param string $vendorNs
     * @param string $mode
     */
    public function __construct($vendorNs, $mode = 'production')
    {
        parent::__construct(new Factory);
        if (isset($this->modeMap[$mode])) {
            $this->addConfig($this->modeMap[$mode]);
        } else {
            if ($mode == 'development') {
                $this->addConfig($vendorNs . '\_Config\Dev');
            } else {
                $this->addConfig($vendorNs . '\_Config\Production');
            }
        }
        $this->addConfig($vendorNs . '\_Config\Common');
        $this->addConfig('Polus\_Config\Common');

        $this->dispatcher = $this->get('dispatcher')($this);

        $this->routerContainer = $this->get('router_container');
        $this->request = $this->get('request');
        $this->map = $this->routerContainer->getMap();
        $this->middlewares = $this->get('middlewares');
    }

    public function addMiddleware(callable $middleware)
    {
        $this->middlewares[] = $middleware;
    }

    /**
     * @param string $class
     */
    public function addConfig($class)
    {
        $config = $this->newInstance($class);
        $config->define($this);
        $this->configs[] = $config;
    }<commit_msg>Make work on php 5.6<commit_after><?php

namespace Polus;

use Aura\Di\Container;
use Aura\Di\Factory;
use Aura\Router\Map;
use Aura\Router\RouterContainer;
use ReflectionMethod;
use Zend\Diactoros\Response;

class App extends Container
{
    /**
     * @var Sender
     */
    public $sender;

    /**
     * @var Server
     */
    protected $request;

    /**
     * @var RouterContainer
     *
     */
    protected $routerContainer;

    /**
     * @var Map
     */
    protected $map;

    /**
     * @var mixed
     */
    protected $errorHandler;

    /**
     * @var string
     */
    protected $config_dir = '';

    /**
     * @var array
     */
    protected $configs = [];

    /**
     * @var array
     */
    protected $modeMap = [];

    /**
     * Psr7 middleware queue
     * @var array
     */
    protected $middlewares = [];

    /**
     * @param string $vendorNs
     * @param string $mode
     */
    public function __construct($vendorNs, $mode = 'production')
    {
        parent::__construct(new Factory);
        if (isset($this->modeMap[$mode])) {
            $this->addConfig($this->modeMap[$mode]);
        } else {
            if ($mode == 'development') {
                $this->addConfig($vendorNs . '\_Config\Dev');
            } else {
                $this->addConfig($vendorNs . '\_Config\Production');
            }
        }
        $this->addConfig($vendorNs . '\_Config\Common');
        $this->addConfig('Polus\_Config\Common');

        $factory = $this->get('dispatcher');
        $this->dispatcher = $factory($this);

        $this->routerContainer = $this->get('router_container');
        $this->request = $this->get('request');
        $this->map = $this->routerContainer->getMap();
        $this->middlewares = $this->get('middlewares');
    }

    public function addMiddleware(callable $middleware)
    {
        $this->middlewares[] = $middleware;
    }

    /**
     * @param string $class
     */
    public function addConfig($class)
    {
        $config = $this->newInstance($class);
        $config->define($this);
        $this->configs[] = $config;
    }
{'fraction_non_alphanumeric': 0.1630952380952381, 'fraction_numerical': 0.0009523809523809524, 'mean_word_length': 1.939818054583625, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 47, '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': '167312', 'n_tokens_mistral': 1298, 'n_tokens_neox': 1261, 'n_words': 232}