<commit_before><?php

use Symfony\Component\HttpKernel\HttpKernelInterface;

require_once __DIR__.'/../vendor/autoload.php';

/* @var $injector \Auryn\Injector */
$injector = include(__DIR__.'/../src/dependency.php');

$request = $injector->make('Symfony\Component\HttpFoundation\Request');

/* @var $app Application */
//$app = $injector->make('Application'); // app without middleware

$injector->define('Middleware\PhpDebugBar', ['app' => 'Application']);
$app = $injector->make('Middleware\PhpDebugBar');

/* uncomment to enable JWT Auth middleware
$injector->define('Middleware\JwtAuthentication', ['app' => 'Application']);
$app = $injector->make('Middleware\JwtAuthentication');
 */

if ('prod' == $config['environment']) {
    $response = $app->handle($request);
} else {
    $response = $app->handle($request, HttpKernelInterface::MASTER_REQUEST, false);
}

$response->send();<commit_msg>front controller: middleware setting for each environment<commit_after><?php

use Symfony\Component\HttpKernel\HttpKernelInterface;

require_once __DIR__.'/../vendor/autoload.php';

/* @var $injector \Auryn\Injector */
$injector = include(__DIR__.'/../src/dependency.php');

$request = $injector->make('Symfony\Component\HttpFoundation\Request');

/* @var $app Application */

if ('prod' == $config['environment']) {
    $app = $injector->make('Application'); // app without middleware
    $response = $app->handle($request);
} elseif ('dev' == $config['environment']) {
    $injector->define('Middleware\PhpDebugBar', ['app' => 'Application']);
    $injector->define('Middleware\Whoops', ['app' => 'Middleware\PhpDebugBar']);
    $app = $injector->make('Middleware\Whoops');
    $response = $app->handle($request, HttpKernelInterface::MASTER_REQUEST, false);
} elseif ('test' == $config['environment']) {
    $app = $injector->make('Application'); // app without middleware
    $response = $app->handle($request);
}

$response->send();
{'fraction_non_alphanumeric': 0.2007242628039317, 'fraction_numerical': 0.0, 'mean_word_length': 5.555932203389831, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 26, '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': '182170', 'n_tokens_mistral': 587, 'n_tokens_neox': 598, 'n_words': 103}