<commit_before><?php
namespace Etu;

use Etu\Http\Context;
use Etu\Http\Request;
use Etu\Http\Response;
use Etu\Traits\Middleware;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Etu\Container;

class Application
{
    use Middleware;

    /**
     * handle exception if $this->start()
     *
     * @var callable
     */
    protected $exceptionHandler = null;

    protected $container;

    public function __construct($container = [])
    {
        if (is_array($container)) {
            $container = Container::getInstance([$container]);
        }

        if (!($container instanceof Container)) {
            throw new InvalidArgumentException('A container expected');
        }

        $this->container = Container::getInstance([$container]);
    }

    /**
     * run app handle request
     *
     * @return ResponseInterface
     */
    public function run()
    {
        $request = $this->container->get('request');
        $response = $this->container->get('response');

        $response = $this->process($request, $response);

        $this->response($response);
    }

    public function process(ServerRequestInterface $request, ResponseInterface $response)
    {
        try {
            $this->executeMiddleware($request, $response);
        } catch (\Throwable $error) {
            $response = $this->handlerError($error, $request, $response);<commit_msg>fix the bug that can not add setting service<commit_after><?php
namespace Etu;

use Etu\Http\Context;
use Etu\Http\Request;
use Etu\Http\Response;
use Etu\Traits\Middleware;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Etu\Container;

class Application
{
    use Middleware;

    /**
     * handle exception if $this->start()
     *
     * @var callable
     */
    protected $exceptionHandler = null;

    protected $container;

    public function __construct($container = [])
    {
        if (is_array($container)) {
            $container = Container::getInstance($container);
        }

        if (!($container instanceof Container)) {
            throw new InvalidArgumentException('A container expected');
        }

        $this->container = $container;
    }

    /**
     * run app handle request
     *
     * @return ResponseInterface
     */
    public function run()
    {
        $request = $this->container->get('request');
        $response = $this->container->get('response');

        $response = $this->process($request, $response);

        $this->response($response);
    }

    public function process(ServerRequestInterface $request, ResponseInterface $response)
    {
        try {
            $this->executeMiddleware($request, $response);
        } catch (\Throwable $error) {
            $response = $this->handlerError($error, $request, $response);
{'fraction_non_alphanumeric': 0.13005272407732865, 'fraction_numerical': 0.0, 'mean_word_length': 2.672258064516129, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, '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': '1833196', 'n_tokens_mistral': 770, 'n_tokens_neox': 755, 'n_words': 173}