<commit_before><?php
/** @namespace */
namespace Core;

use \Spark\App;
use \Spark\Controller\HttpRequest;
use \Spark\Controller\HttpResponse;

const ENV_DEVELOPMENT = "development";
const ENV_PRODUCTION  = "production";

const APPROOT = __DIR__;

define("LIBRARIES", APPROOT . DIRECTORY_SEPARATOR . "library");
define("PLUGINS",   APPROOT . DIRECTORY_SEPARATOR . "plugins");

//require_once('../Spark2/lib/Spark.php');
require_once(LIBRARIES . '/Spark2/lib/Spark.php');
require_once(LIBRARIES . '/Mustache/library/Phly/Mustache/_autoload.php');
require_once(LIBRARIES . '/Textile.php');
require_once(LIBRARIES . '/Core.php');

$config = parse_ini_file('config.ini', true);
$env    = isset($config["env"]) ? $config["env"] : ENV_PRODUCTION;

define("ENVIRONMENT", $env);

// Force error reporting in development environment
if (ENVIRONMENT === "development") {
    ini_set("display_errors", true);
    error_reporting(E_ALL | E_STRICT);
}

$request  = new HttpRequest;
$response = new HttpResponse;

$app = new App;

$resolver = $app->getResolver();
$resolver->setNamingSpec("\\Plugin\\{{module}}\\Controller\\{{controller}}Controller");

$pluginEnv = new Plugin\Environment;

$pluginEnv->export("App",    $app)
          ->export("Routes", $app->routes)
          ->export("Config", $config);

$pluginLoader = new Plugin\StandardLoader(array(
    "path" => PLUGINS,
    "environment" => $pluginEnv
));

Plugin\Controller::setEnvironment($pluginEnv);

$pluginLoader->loadAll();

$app($request, $response);
<commit_msg>Automated lookup of Spark<commit_after><?php
/** @namespace */
namespace Core;

use \Spark\App;
use \Spark\Controller\HttpRequest;
use \Spark\Controller\HttpResponse;

const ENV_DEVELOPMENT = "development";
const ENV_PRODUCTION  = "production";

const APPROOT = __DIR__;

define("LIBRARIES", APPROOT . DIRECTORY_SEPARATOR . "library");
define("PLUGINS",   APPROOT . DIRECTORY_SEPARATOR . "plugins");

// Look for a checkout of Spark in the parent folder, otherwise take the bundled version
if (file_exists("../Spark2/lib/Spark.php")) {
    require_once('../Spark2/lib/Spark.php');
} else {
    require_once(LIBRARIES . '/Spark2/lib/Spark.php');
}
require_once(LIBRARIES . '/Mustache/library/Phly/Mustache/_autoload.php');
require_once(LIBRARIES . '/Textile.php');
require_once(LIBRARIES . '/Core.php');

$config = parse_ini_file('config.ini', true);
$env    = isset($config["env"]) ? $config["env"] : ENV_PRODUCTION;

define("ENVIRONMENT", $env);

// Force error reporting in development environment
if (ENVIRONMENT === "development") {
    ini_set("display_errors", true);
    error_reporting(E_ALL | E_STRICT);
}

$request  = new HttpRequest;
$response = new HttpResponse;

$app = new App;

$resolver = $app->getResolver();
$resolver->setNamingSpec("\\Plugin\\{{module}}\\Controller\\{{controller}}Controller");

$pluginEnv = new Plugin\Environment;

$pluginEnv->export("App",    $app)
          ->export("Routes", $app->routes)
          ->export("Config", $config);

$pluginLoader = new Plugin\StandardLoader(array(
    "path" => PLUGINS,
    "environment" => $pluginEnv
));

Plugin\Controller::setEnvironment($pluginEnv);

$pluginLoader->loadAll();

$app($request, $response);

{'fraction_non_alphanumeric': 0.1734375, 'fraction_numerical': 0.0015625, 'mean_word_length': 5.028248587570621, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, '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': '4058195', 'n_tokens_mistral': 1098, 'n_tokens_neox': 1065, 'n_words': 201}