<commit_before><?php
namespace Sonic;

/**
 * Config
 *
 * @category Sonic
 * @package Config
 * @author <NAME>
 */
class Config
{
    /**
     * @var string
     */
    const PHP = 'array';

    /**
     * @var string
     */
    const INI = 'ini';

    /**
     * key value pair of combined sections
     *
     * @var array
     */
    protected $_combined;

    /**
     * array of Yoshi_Config_Section objects
     *
     * @var array
     */
    protected $_sections = array();

    /**
     * array of valid environments
     *
     * @var
     */
    protected $_environments = array();

    /**
     * mapping of environment to parent environment
     *
     * @var
     */
    protected $_parents = array();

    /**
     * constructor
     *
     * @param string $path path to config file
     * @param string $environment section of config file to load
     */
    public function __construct($path, $environment, $type = self::INI)
    {
        if (!file_exists($path)) {
            throw new Exception('configuration file does not exist at ' . $path);
        }

        // parse the file
        switch ($type) {
            case self::PHP:
                include $path;
                $parsed_file = $config;
                break;
            default:
                $parsed_file = parse_ini_file($path, true);
                break;
        }

        // find all the environments
        $sections = array_keys($parsed_file);

        // make sure environment exists
        $map = $this->_getEnvironmentMap($sections);
        if (!isset($map[$environment])) {
            throw new Exception('environment : ' . $environment . 'not found in config at : ' . $path);
        }

        $parents = $this->getParents($sections, $environment);
        $to_merge = array_reverse($parents);
        $to_merge[] = $environment;

        $start = array_shift($to_merge);
        $this->_combined = $parsed_file[$start];

        foreach ($to_merge as $environment) {
            $full_section = $map[$environment];
            $this->_combined = array_merge($this->_combined, $parsed_file[$full_section]);
        }
    }
<commit_msg>exception message typo<commit_after><?php
namespace Sonic;

/**
 * Config
 *
 * @category Sonic
 * @package Config
 * @author <NAME>
 */
class Config
{
    /**
     * @var string
     */
    const PHP = 'array';

    /**
     * @var string
     */
    const INI = 'ini';

    /**
     * key value pair of combined sections
     *
     * @var array
     */
    protected $_combined;

    /**
     * array of Yoshi_Config_Section objects
     *
     * @var array
     */
    protected $_sections = array();

    /**
     * array of valid environments
     *
     * @var
     */
    protected $_environments = array();

    /**
     * mapping of environment to parent environment
     *
     * @var
     */
    protected $_parents = array();

    /**
     * constructor
     *
     * @param string $path path to config file
     * @param string $environment section of config file to load
     */
    public function __construct($path, $environment, $type = self::INI)
    {
        if (!file_exists($path)) {
            throw new Exception('configuration file does not exist at ' . $path);
        }

        // parse the file
        switch ($type) {
            case self::PHP:
                include $path;
                $parsed_file = $config;
                break;
            default:
                $parsed_file = parse_ini_file($path, true);
                break;
        }

        // find all the environments
        $sections = array_keys($parsed_file);

        // make sure environment exists
        $map = $this->_getEnvironmentMap($sections);
        if (!isset($map[$environment])) {
            throw new Exception('environment: ' . $environment . ' not found in config at : ' . $path);
        }

        $parents = $this->getParents($sections, $environment);
        $to_merge = array_reverse($parents);
        $to_merge[] = $environment;

        $start = array_shift($to_merge);
        $this->_combined = $parsed_file[$start];

        foreach ($to_merge as $environment) {
            $full_section = $map[$environment];
            $this->_combined = array_merge($this->_combined, $parsed_file[$full_section]);
        }
    }

{'fraction_non_alphanumeric': 0.12671153399860757, 'fraction_numerical': 0.0, 'mean_word_length': 1.8005198180636777, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, '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': '3472894', 'n_tokens_mistral': 1202, 'n_tokens_neox': 1179, 'n_words': 310}