<commit_before><?php

namespace GianArb\Penny;

use Zend\Diactoros\Response;
use GianArb\Penny\Event\HttpFlowEvent;
use DI\ContainerBuilder;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\RequestInterface;
use GianArb\Penny\Config\Loader;

class App
{
    private $container;
    private $request;
    private $response;

    public function __construct($router = null, $container = null)
    {
        $this->container = $container;

        $this->response = new \Zend\Diactoros\Response();

        $this->request = \Zend\Diactoros\ServerRequestFactory::fromGlobals(
            $_SERVER,
            $_GET,
            $_POST,
            $_COOKIE,
            $_FILES
        );

        if ($this->container == null) {
            $config = Loader::load();
            $container = $this->buildContainer($config);
        }

        if ($router == null && $container->has("router") == false) {
            throw new \Exception("Define router config");
            $container->set("router", $config['router']);
        } elseif ($container->has("router") == false) {
            $container->set("router", $router);
        }

        $container->set("http.flow", \DI\object('Zend\EventManager\EventManager'));
        $container->set('dispatcher', \DI\object('GianArb\Penny\Dispatcher')<commit_msg>Remove unused code<commit_after><?php

namespace GianArb\Penny;

use Zend\Diactoros\Response;
use GianArb\Penny\Event\HttpFlowEvent;
use DI\ContainerBuilder;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\RequestInterface;
use GianArb\Penny\Config\Loader;

class App
{
    private $container;
    private $request;
    private $response;

    public function __construct($router = null, $container = null)
    {
        $this->container = $container;

        $this->response = new \Zend\Diactoros\Response();

        $this->request = \Zend\Diactoros\ServerRequestFactory::fromGlobals(
            $_SERVER,
            $_GET,
            $_POST,
            $_COOKIE,
            $_FILES
        );

        if ($this->container == null) {
            $config = Loader::load();
            $container = $this->buildContainer($config);
        }

        if ($router == null && $container->has("router") == false) {
            throw new \Exception("Define router config");
        } elseif ($container->has("router") == false) {
            $container->set("router", $router);
        }

        $container->set("http.flow", \DI\object('Zend\EventManager\EventManager'));
        $container->set('dispatcher', \DI\object('GianArb\Penny\Dispatcher')
{'fraction_non_alphanumeric': 0.14877954281286324, 'fraction_numerical': 0.0, 'mean_word_length': 2.556473829201102, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 24, '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': '1814653', 'n_tokens_mistral': 763, 'n_tokens_neox': 740, 'n_words': 137}