<commit_before><?php

/**
 * @package         Billing
 * @copyright       Copyright (C) 2012 S.D.O.C. LTD. All rights reserved.
 * @license         GNU General Public License version 2 or later; see LICENSE.txt
 */
$env = null;

$envParamsNames = array('env:', 'environment:');
$cliArgs = getopt('', array_merge($envParamsNames, array('tenant:')));
	
if (!defined('APPLICATION_ENV')) {
	$env = getenv('APPLICATION_ENV');
	
	// if APPLICATION_ENV not defined and the getenv not find it (not through web server), let's take it by cli opt
	if (empty($env)) {
		foreach ($envParamsNames as $envParamsName) {
			$key = str_replace(':', '', $envParamsName);
			if (isset($cliArgs[$key])) {
				$env = $cliArgs[$key];
				break;
			}
		}
	}

	if (empty($env)) {
		error_log('Environment did not setup!');
		die('Environment did not setup!' . PHP_EOL);
	}
	
	define('APPLICATION_ENV', $env);
}

define('BILLRUN_CONFIG_PATH', APPLICATION_PATH . "/conf/" . APPLICATION_ENV . ".ini");

if (!file_exists(BILLRUN_CONFIG_PATH)) {
	error_log('Configuration file did not found');
	die('Configuration file did not found');
}

if (!defined('APPLICATION_TENANT')) {
	$tenant = $cliArgs['tenant'];
	if (empty($tenant)) {
		error_log('Tenant was not setup!');
		die('Tenant was not setup!' . PHP_EOL);
	}
	
	define('APPLICATION_TEANANT', $tenant);<commit_msg>set APPLICATION_TENANT on load<commit_after><?php

/**
 * @package         Billing
 * @copyright       Copyright (C) 2012 S.D.O.C. LTD. All rights reserved.
 * @license         GNU General Public License version 2 or later; see LICENSE.txt
 */
$env = null;

$cliArgs = getopt('', array('env:', 'environment:', 'tenant:'));
	
if (!defined('APPLICATION_ENV')) {
	$env = getenv('APPLICATION_ENV');
	
	// if APPLICATION_ENV not defined and the getenv not find it (not through web server), let's take it by cli opt
	if (empty($env)) {
		if (isset($cliArgs['env'])) {
			$env = $cliArgs['env'];
		} else if (isset($cliArgs['environment'])) {
			$env = $cliArgs['environment'];
		}
	}

	if (empty($env)) {
		error_log('Environment did not setup!');
		die('Environment did not setup!' . PHP_EOL);
	}
	
	define('APPLICATION_ENV', $env);
}

define('BILLRUN_CONFIG_PATH', APPLICATION_PATH . "/conf/" . APPLICATION_ENV . ".ini");

if (!file_exists(BILLRUN_CONFIG_PATH)) {
	error_log('Configuration file did not found');
	die('Configuration file did not found');
}

if (!defined('APPLICATION_TENANT')) {
	$tenant = $cliArgs['tenant'];
	if (empty($tenant)) {
		error_log('Tenant was not setup!');
		die('Tenant was not setup!' . PHP_EOL);
	}
	
	define('APPLICATION_TEANANT', $tenant);
{'fraction_non_alphanumeric': 0.1713957055214724, 'fraction_numerical': 0.003834355828220859, 'mean_word_length': 4.3244897959183675, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '754909', 'n_tokens_mistral': 941, 'n_tokens_neox': 877, 'n_words': 231}