<commit_before><?php

// PSR-4 autoloader

require MICROAPI_PATH . DIRECTORY_SEPARATOR . 'Autoloader.php';
$autoloader = new \MicroAPI\Autoloader();
$autoloader->addNamespace('App', APP_PATH);
$autoloader->addNamespace('MicroAPI', MICROAPI_PATH);

// Create the dependency injector

$injector = new \MicroAPI\Injector();
$config = new \MicroAPI\Config();
$injector->addDependency('injector', $injector);
$injector->addDependency('config', $config);

// Run the app defined config function

$injector->inject(require(APP_PATH . DIRECTORY_SEPARATOR . 'config.php'));

// Add all required dependencies

$injector->addDependency('database', '\MicroAPI\Database', $config->get('microapi.database'));
$injector->addDependency('request', '\MicroAPI\Request', ['subDirectory' => $config->get('microapi.subDirectory')]);
$injector->addDependency('response', '\MicroAPI\Response', $config->get('microapi.response'));
$injector->addDependency('router', '\MicroAPI\Router', ['injector' => $injector]);

// Run the app defined setup function

$injector->inject(require(APP_PATH . DIRECTORY_SEPARATOR . 'run.php'));

// Create the router and load the App routes file

$injector->inject(require(APP_PATH . DIRECTORY_SEPARATOR . 'routes.php'));<commit_msg>Remove router as service, add autoloader<commit_after><?php

// PSR-4 autoloader

require MICROAPI_PATH . DIRECTORY_SEPARATOR . 'Autoloader.php';
$autoloader = new \MicroAPI\Autoloader();
$autoloader->addNamespace('App', APP_PATH);
$autoloader->addNamespace('MicroAPI', MICROAPI_PATH);

// Create the dependency injector

$injector = new \MicroAPI\Injector();
$config = new \MicroAPI\Config();
$injector->addDependency('injector', $injector);
$injector->addDependency('config', $config);
$injector->addDependency('autoloader', $autoloader);

// Run the app defined config function

$injector->inject(require(APP_PATH . DIRECTORY_SEPARATOR . 'config.php'));

// Add all required dependencies

$injector->addDependency('database', '\MicroAPI\Database', $config->get('microapi.database'));
$injector->addDependency('request', '\MicroAPI\Request', ['subDirectory' => $config->get('microapi.subDirectory')]);
$injector->addDependency('response', '\MicroAPI\Response', $config->get('microapi.response'));

// Run the app defined setup function

$injector->inject(require(APP_PATH . DIRECTORY_SEPARATOR . 'run.php'));

// Create the router and load the App routes file

$router = new \MicroAPI\Router($injector);
$routeFunction = require(APP_PATH . DIRECTORY_SEPARATOR . 'routes.php');
$routeFunction($router);
{'fraction_non_alphanumeric': 0.1690916240660637, 'fraction_numerical': 0.0007864726700747149, 'mean_word_length': 6.63963963963964, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 33, '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': '3914330', 'n_tokens_mistral': 825, 'n_tokens_neox': 794, 'n_words': 159}