<commit_before><?php

namespace SNicholson\SlimFileCache;

use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Slim\App;

/**
 * Class Cache
 * @package SNicholson\SlimFileCache
 */
class Cache
{
    const HOUR = 3600;
    const DAY = 86400;
    const WEEK = 604800;
    const NEVER = -1;

    private $directory;
    private $app;

    /**
     * Takes the slim app and then the directory where the cache is to be saved
     * @param App    $app
     * @param string $cacheDirectory
     */
    public function __construct(App $app, $cacheDirectory = __DIR__ . '/../cache/')
    {
        $this->directory = $cacheDirectory;
        $this->fileHandler = new FileHandler($cacheDirectory);
        $this->app = $app;
    }

    /**
     * Slim required __invoke magic method for middleware
     *
     * @param  \Psr\Http\Message\ServerRequestInterface $request  PSR7 request
     * @param  \Psr\Http\Message\ResponseInterface      $response PSR7 response
     * @param  callable                                 $next     Next middleware
     *
     * @return \Psr\Http\Message\ResponseInterface
     */<commit_msg>fix default parameter syntax error<commit_after><?php

namespace SNicholson\SlimFileCache;

use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Slim\App;

/**
 * Class Cache
 * @package SNicholson\SlimFileCache
 */
class Cache
{
    const HOUR = 3600;
    const DAY = 86400;
    const WEEK = 604800;
    const NEVER = -1;

    private $directory;
    private $app;

    /**
     * Takes the slim app and then the directory where the cache is to be saved
     * @param App    $app
     * @param string $cacheDirectory
     */
    public function __construct(App $app, $cacheDirectory = null)
    {
        if(is_null($cacheDirectory)) {
            $cacheDirectory = __DIR__ . '/../cache/';
        }
        $this->directory = $cacheDirectory;
        $this->fileHandler = new FileHandler($cacheDirectory);
        $this->app = $app;
    }

    /**
     * Slim required __invoke magic method for middleware
     *
     * @param  \Psr\Http\Message\ServerRequestInterface $request  PSR7 request
     * @param  \Psr\Http\Message\ResponseInterface      $response PSR7 response
     * @param  callable                                 $next     Next middleware
     *
     * @return \Psr\Http\Message\ResponseInterface
     */
{'fraction_non_alphanumeric': 0.10299003322259136, 'fraction_numerical': 0.014950166112956811, 'mean_word_length': 2.3411927877947294, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4841485', 'n_tokens_mistral': 744, 'n_tokens_neox': 707, 'n_words': 187}