<commit_before><?php
 
/**
 * Configuration of SimpleSAMLphp
 *
 * @author <NAME>, UNINETT AS. <<EMAIL>>
 * @package simpleSAMLphp
 * @version $Id$
 */
class SimpleSAML_Configuration {

	private static $instance = array();

	private $configpath = null;	
	private $configfilename = null; 
	private $configuration = null;

	// private constructor restricts instantiaton to getInstance()
	private function __construct($configpath, $configfilename = 'config.php') {
		$this->configpath = $configpath;
		$this->configfilename = $configfilename;
	}
	
	public static function getInstance($instancename = 'simplesaml') {
		if (!array_key_exists($instancename, self::$instance)) 
			throw new Exception('Configuration with name ' . $instancename . ' is not initialized.');
		return self::$instance[$instancename];
	}
	
	public static function init($path, $instancename = 'simplesaml', $configfilename = 'config.php') {
		self::$instance[$instancename] = new SimpleSAML_Configuration($path, $configfilename);
	}<commit_msg>Adding support for getting a new config file from the same directory as the current one. Used in example in the login modules that hae their own cofig file in addition to config.php.<commit_after><?php
 
/**
 * Configuration of SimpleSAMLphp
 *
 * @author <NAME>, UNINETT AS. <<EMAIL>>
 * @package simpleSAMLphp
 * @version $Id$
 */
class SimpleSAML_Configuration {

	private static $instance = array();

	private $configpath = null;	
	private $configfilename = null; 
	private $configuration = null;

	// private constructor restricts instantiaton to getInstance()
	private function __construct($configpath, $configfilename = 'config.php') {
		$this->configpath = $configpath;
		$this->configfilename = $configfilename;
	}
	
	public static function getInstance($instancename = 'simplesaml') {
		if (!array_key_exists($instancename, self::$instance)) 
			throw new Exception('Configuration with name ' . $instancename . ' is not initialized.');
		return self::$instance[$instancename];
	}
	
	public static function init($path, $instancename = 'simplesaml', $configfilename = 'config.php') {
		self::$instance[$instancename] = new SimpleSAML_Configuration($path, $configfilename);
	}
	
	public function copyFromBase($instancename, $filename) {
		self::$instance[$instancename] = new SimpleSAML_Configuration($this->configpath, $filename);
		return self::$instance[$instancename];
	}
{'fraction_non_alphanumeric': 0.1261487050960735, 'fraction_numerical': 0.0, 'mean_word_length': 5.438172043010753, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 14, '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': '3606547', 'n_tokens_mistral': 718, 'n_tokens_neox': 680, 'n_words': 190}