<commit_before><?php

namespace App\Composer;

use Composer\Script\Event;
use Composer\EventDispatcher\ScriptExecutionException;
use Symfony\Component\Dotenv\Dotenv;

/**
 * Check that required ENV variables are set on the system and print an error if they are not.
 * @package App\Composer
 */
class CheckRequiredENV
{
    const REQUIRED_ENV = [
        'ILIOS_DATABASE_URL',
        'ILIOS_DATABASE_MYSQL_VERSION',
        'ILIOS_MAILER_URL',
        'ILIOS_LOCALE',
        'ILIOS_SECRET'
    ];
    const INSTRUCTIONS_URL = 'https://github.com/ilios/ilios/blob/master/docs/env_vars_and_config.md';
    public static function check(Event $event)
    {
        $dotEnv = new Dotenv();
        $io = $event->getIO();
        $hasError = false;
        $data = [];
        $path = __DIR__ . '/../../../.env';
        if (is_readable($path)) {
            $data = $dotEnv->parse(file_get_contents($path), $path);
        }

        foreach (self::REQUIRED_ENV as $name) {
            if (!self::isEnvSet($data, $name)) {<commit_msg>Only use DotEnv in non-prod environments<commit_after><?php

namespace App\Composer;

use Composer\Script\Event;
use Composer\EventDispatcher\ScriptExecutionException;
use Symfony\Component\Dotenv\Dotenv;

/**
 * Check that required ENV variables are set on the system and print an error if they are not.
 * @package App\Composer
 */
class CheckRequiredENV
{
    const REQUIRED_ENV = [
        'ILIOS_DATABASE_URL',
        'ILIOS_DATABASE_MYSQL_VERSION',
        'ILIOS_MAILER_URL',
        'ILIOS_LOCALE',
        'ILIOS_SECRET'
    ];
    const INSTRUCTIONS_URL = 'https://github.com/ilios/ilios/blob/master/docs/env_vars_and_config.md';
    public static function check(Event $event)
    {
        $io = $event->getIO();
        $hasError = false;
        $data = [];
        if (!isset($_SERVER['APP_ENV']) || in_array($_SERVER['APP_ENV'], ['dev', 'test'])) {
            $dotEnv = new Dotenv();
            $path = __DIR__ . '/../../.env';
            if (is_readable($path)) {
                $data = $dotEnv->parse(file_get_contents($path), $path);
            }
        }

        foreach (self::REQUIRED_ENV as $name) {
            if (!self::isEnvSet($data, $name)) {
{'fraction_non_alphanumeric': 0.13897691263014939, 'fraction_numerical': 0.0, 'mean_word_length': 2.622950819672131, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '799527', 'n_tokens_mistral': 731, 'n_tokens_neox': 724, 'n_words': 148}