<commit_before><?php
namespace Vigattin\Config;

class Config {
    
	const SAMPLE_CONFIG_FILE = '../../../config/sample.config.php';
    const DEFAULT_CONFIG_FILE = '../../../config/config.php';

    public $config;
    
    public function __construct(Array $config = NULL) {
        $this->config = array();
        if($config === NULL) $config = $this->getConfigFromFile();
        if(is_array($config)) $this->mergeConfigArray($config);
        elseif(is_file($config)) $this->mergeConfigFile($config);
    }
    
    public function mergeConfigArray($configArray) {
        if(is_array($configArray)) $this->config = array_merge($this->config, $configArray);
        return $this->config;
    }
    
    public function mergeConfigFile($configFile) {
        if(is_file($configFile)) {
            $config = include $configFile;
            $this->mergeConfigArray($config);
        }
        return $config;
    }
    
    public function getConfig($key = '') {
        if($key === '') return $this->config;
        if(!empty($this->config[$key])) return $this->config[$key];
        return FALSE;

    }
    
    static function getConfigFromFile($key = '') {
        if(!is_file(__DIR__.'/'.self::DEFAULT_CONFIG_FILE)) return FALSE;
        $config = include __DIR__.'/'.self::DEFAULT_CONFIG_FILE;
        if(!is_array($config)) return FALSE;
        if($key === '') return $config;
        if(!empty($config[$key])) return $config[$key];
        return FALSE;

    }
}
<commit_msg>update default config<commit_after><?php
namespace Vigattin\Config;

class Config {
    
	const SAMPLE_CONFIG_FILE = '../../../config/sample.config.php';
    const DEFAULT_CONFIG_FILE = '../../../config/config.php';

    public $config;
    
    public function __construct(Array $config = NULL) {
        $this->config = array();
        if($config === NULL) $config = $this->getConfigFromFile();
        if(is_array($config)) $this->mergeConfigArray($config);
        elseif(is_file($config)) $this->mergeConfigFile($config);
    }
    
    public function mergeConfigArray($configArray) {
        if(is_array($configArray)) $this->config = array_merge($this->config, $configArray);
        return $this->config;
    }
    
    public function mergeConfigFile($configFile) {
        if(is_file($configFile)) {
            $config = include $configFile;
            $this->mergeConfigArray($config);
        }
        return $config;
    }
    
    public function getConfig($key = '') {
        if($key === '') return $this->config;
        if(!empty($this->config[$key])) return $this->config[$key];
        return FALSE;
    }
    
    static function getConfigFromFile($key = '') {
        if(!is_file(__DIR__.'/'.self::DEFAULT_CONFIG_FILE)) {
			$config = include __DIR__.'/'.self::SAMPLE_CONFIG_FILE;
		} else {
			$config = include __DIR__.'/'.self::DEFAULT_CONFIG_FILE;
		}
        if(!is_array($config)) return FALSE;
        if($key === '') return $config;
        if(!empty($config[$key])) return $config[$key];
        return FALSE;
    }
}

{'fraction_non_alphanumeric': 0.16584564860426929, 'fraction_numerical': 0.0, 'mean_word_length': 2.7374233128834358, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 25, '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': '4209093', 'n_tokens_mistral': 900, 'n_tokens_neox': 895, 'n_words': 160}