<commit_before><?php

namespace App;

use Dotenv\Dotenv;

require "vendor/autoload.php";

$client       = new \Goutte\Client();
$guzzleClient = new \GuzzleHttp\Client(['curl' => [CURLOPT_TIMEOUT => 60]]);
$client->setClient($guzzleClient);

$dotenv       = new Dotenv(__DIR__ . '/../');
$dotenv->load();
$email    = getenv('EMAIL');
$password = getenv('PASSWORD');

$scraper  = new Scraper($client);

$r = $scraper->getStats($email, $password);

exec("osascript -e 'display notification \"£{$r['current_balance']}\" with title \"Canteen Balance\"'");

echo json_encode($r, JSON_PRETTY_PRINT) . "\n";

<commit_msg>Catch missing .env file error<commit_after><?php

namespace App;

use Dotenv\Dotenv;
use Dotenv\Exception\InvalidPathException;

require "vendor/autoload.php";

$client       = new \Goutte\Client();
$guzzleClient = new \GuzzleHttp\Client(['curl' => [CURLOPT_TIMEOUT => 60]]);
$client->setClient($guzzleClient);

$dotenv = new Dotenv(__DIR__ . '/../');

try {
    $dotenv->load();
} catch (InvalidPathException $e) {

    echo "Please create a .env file (look at .env.example)";
    exit(1);
}

$email    = getenv('EMAIL');
$password = getenv('PASSWORD');

$scraper = new Scraper($client);

$r = $scraper->getStats($email, $password);

exec("osascript -e 'display notification \"£{$r['current_balance']}\" with title \"Canteen Balance\"'");

echo json_encode($r, JSON_PRETTY_PRINT) . "\n";


{'fraction_non_alphanumeric': 0.19529579472558803, 'fraction_numerical': 0.003563791874554526, 'mean_word_length': 4.7306122448979595, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '5407197', 'n_tokens_mistral': 520, 'n_tokens_neox': 504, 'n_words': 106}