<commit_before><?php
require_once(__DIR__."/classes/Events.php");

use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;

$app->get('/events/{date}', function (Request $request, Response $response, $args) {
    $events = new Events($this->db, $this->logger);
    $evs = $events->getForDate($args['date']);
    $newResponse = $response->withJson(['events'=>$evs]);

    return $newResponse;
});

$app->get('/event_debug/{event_id}', function (Request $request, Response $response, $args) {
    $events = new Events($this->db, $this->logger);
    $ev = $events->getSingleByID($args['event_id']);
    $newResponse = $response->getBody()->write($ev['post_content']);

    return $newResponse;
});<commit_msg>Pass settings to the Events constructor.<commit_after><?php
require_once(__DIR__."/classes/Events.php");

use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;

$app->get('/events/{date}', function (Request $request, Response $response, $args) {
    $events = new Events($this->db, $this->logger, $this->get('settings'));
    $evs = $events->getForDate($args['date']);
    $newResponse = $response->withJson(['events'=>$evs]);

    return $newResponse;
});

$app->get('/event_debug/{event_id}', function (Request $request, Response $response, $args) {
    $events = new Events($this->db, $this->logger, $this->get('settings'));
    $ev = $events->getSingleByID($args['event_id']);
    $newResponse = $response->getBody()->write($ev['post_content']);

    return $newResponse;
});
{'fraction_non_alphanumeric': 0.20376175548589343, 'fraction_numerical': 0.0, 'mean_word_length': 5.514285714285714, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 29, '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': '106707', 'n_tokens_mistral': 496, 'n_tokens_neox': 497, 'n_words': 95}