<commit_before><?php
namespace GMO\Common\Config;

use GMO\Common\Collections\ArrayCollection;
use GMO\Common\Exception\ConfigException;
use GMO\Common\String;

/**
 * This config groups values by environment.
 * A "default" environment is required.
 * By default the selected environment is based on the environment variable "PHP_ENV".
 * If the config does not contain the selected environment the default is used.
 *
 * Example:
 *     default:
 *       section:
 *         test: hello
 *
 *     staging:
 *       section:
 *         test: world
 *
 *     development:
 *       section:
 *         test: %staging%
 *
 *     The result for "section > test" for all environments
 *       production: hello
 *       staging: world
 *       development: world
 */
abstract class EnvironmentAwareConfig extends AbstractConfig {

	public static function getEnvironment() { return getenv('PHP_ENV'); }

	/** @inheritdoc */
	public static function getValue($section, $key, $default = null) {
		$value = parent::getValue($section, $key, $default);

		if (!String::startsWith($value, '%') || !String::endsWith($value, '%')) {<commit_msg>Fix bug not checking if it is a string.<commit_after><?php
namespace GMO\Common\Config;

use GMO\Common\Collections\ArrayCollection;
use GMO\Common\Exception\ConfigException;
use GMO\Common\String;

/**
 * This config groups values by environment.
 * A "default" environment is required.
 * By default the selected environment is based on the environment variable "PHP_ENV".
 * If the config does not contain the selected environment the default is used.
 *
 * Example:
 *     default:
 *       section:
 *         test: hello
 *
 *     staging:
 *       section:
 *         test: world
 *
 *     development:
 *       section:
 *         test: %staging%
 *
 *     The result for "section > test" for all environments
 *       production: hello
 *       staging: world
 *       development: world
 */
abstract class EnvironmentAwareConfig extends AbstractConfig {

	public static function getEnvironment() { return getenv('PHP_ENV'); }

	/** @inheritdoc */
	public static function getValue($section, $key, $default = null) {
		$value = parent::getValue($section, $key, $default);

		if (!is_string($value) || !String::startsWith($value, '%') || !String::endsWith($value, '%')) {
{'fraction_non_alphanumeric': 0.11915077989601386, 'fraction_numerical': 0.0, 'mean_word_length': 3.29182156133829, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5613162', 'n_tokens_mistral': 639, 'n_tokens_neox': 628, 'n_words': 205}