<commit_before><?php

require_once __DIR__ . '/../bootstrap.php';

$config = array(
    'database' => array(
        'dns' => sprintf('sqlite:%s%s02-It_your_way.sq3', sys_get_temp_dir(), DIRECTORY_SEPARATOR)
    )
);
$environment = 'demo';
$bootstrap   = new Arara\Boot\Bootstrap($config, $environment);
$bootstrap->run(function ($bootstrap) {
    $content = '';
    switch ($_SERVER['REQUEST_METHOD']) {
        case 'POST':
            $pdo = new PDO($bootstrap->getConfig()['database']['dns']);
            $pdo->exec(
                'CREATE TABLE IF NOT EXISTS emails (
                    id INTEGER PRIMARY KEY ASC,
                    created INTEGER NOT NULL,
                    email TEXT NOT NULL
                );'
            );
            $insert = $pdo->prepare('INSERT INTO "emails" ("created", "email") VALUES (?, ?)');
            if ($insert->execute(array(time(), $_POST['email']))) {
                $content = 'E-mail successfully saved';
            } else {
                $content = 'Failure when saving e-mail';
                if ($bootstrap->getEnvironment() != 'production') {
                    $content .= '<br />';
                    $content .= '<pre>' . print_r($pdo->errorInfo(), true) . '</pre>';
                }
            }
            break;

        case 'GET':
            $content = '<form action="" method="POST">
                            Type your e-mail here: <input type="text" name="email" />
                            <input type="submit" />
                        </form>';
            break;

        default:
            header('HTTP/1.1 405 Method Not Allowed');
            header('Allow: GET, POST');
            $content = 'Unable to process ' . $_SERVER['REQUEST_METHOD'];
    }

    echo $content;
});<commit_msg>Updated "It yout way" example<commit_after><?php

require_once __DIR__ . '/../bootstrap.php';

if (PHP_SAPI == 'cli') {
    $descriptorSpec = array(
        0 => array("pipe", "r"),
        1 => array("pipe", "w"),
        2 => array("pipe", "w"),
    );

    $host = 'localhost:8484';
    $command = PHP_BINARY . ' -S ' . escapeshellarg($host) . ' '  . escapeshellarg(__FILE__);
    $process = proc_open($command, $descriptorSpec, $pipes);
    if (!is_resource($process)) {
        fwrite(STDERR, 'Unable to run: ' . $command . PHP_EOL);
        exit(1);
    }
    fwrite(STDOUT, 'Running server on ' . $host . PHP_EOL);
    fwrite(STDOUT, 'Press Ctrl-C to quit' . PHP_EOL);
    exit(0);
}

$config = array(
    'database' => array(
        'dns' => sprintf('sqlite:%s%s02-It_your_way.sq3', sys_get_temp_dir(), DIRECTORY_SEPARATOR)
    )
);
$environment = 'demo';
$bootstrap   = new Arara\Boot\Bootstrap($config, $environment);
$bootstrap->run(function ($bootstrap) {
    $content = '';
    switch ($_SERVER['REQUEST_METHOD']) {
        case 'POST':
            $pdo = new PDO($bootstrap->getConfig()['database']['dns']);
            $pdo->exec(
                'CREATE TABLE IF NOT EXISTS emails (
                    id INTEGER PRIMARY KEY ASC,
                    created INTEGER NOT NULL,
                    email TEXT NOT NULL
                );'
            );
            $insert = $pdo->prepare('INSERT INTO "emails" ("created", "email") VALUES (?, ?)');
            if ($insert->execute(array(time(), $_POST['email']))) {
                $content = 'E-mail successfully saved';
            } else {
                $content = 'Failure when saving e-mail';
                if ($bootstrap->getEnvironment() != 'production') {
                    $content .= '<br />';
                    $content .= '<pre>' . print_r($pdo->errorInfo(), true) . '</pre>';
                }
            }
            break;

        case 'GET':
            $content = '<form action="" method="POST">
                            Type your e-mail here: <input type="text" name="email" />
                            <input type="submit" />
                        </form>';
            break;

        default:
            header('HTTP/1.1 405 Method Not Allowed');
            header('Allow: GET, POST');
            $content = 'Unable to process ' . $_SERVER['REQUEST_METHOD'];
    }

    echo $content;
});
{'fraction_non_alphanumeric': 0.16423619411905332, 'fraction_numerical': 0.005976571838393498, 'mean_word_length': 1.731070496083551, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 38, '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': '1524246', 'n_tokens_mistral': 1227, 'n_tokens_neox': 1162, 'n_words': 275}