<commit_before><?php
/*
* MyUCP
*/

class Load {
	private $registry;

	public function __construct($registry) {
		$this->registry = $registry;
	}
	
	public function model($name){
		$modelClass = $name . 'Model';
		$modelPath = APP_DIR . 'models/' . $name . '.php';
		
		if(is_readable($modelPath)){
			require_once($modelPath);
			if(class_exists($modelClass)){
				$this->registry->$modelClass = new $modelClass($this->registry);
				return true;
			}
		}
		exit('Ошибка: Не удалось загрузить модель ' . $name . '!');
	}
	
	public function library($name){
		$libClass = $name . 'Library';
		$libPath = ENGINE_DIR . 'lib/' . $name . '.php';
		
		if(is_readable($libPath)){
			require_once($libPath);
			return true;
		}
		exit('Ошибка: Не удалось загрузить библиотеку ' . $name . '!');
	}
}
?>
<commit_msg>Add new functions<commit_after><?php
/*
* MyUCP
*/

class Load {
	private $registry;

	public function __construct($registry) {
		$this->registry = $registry;
	}
	
	public function model($name){
		$modelClass = $name . 'Model';
		$modelPath = APP_DIR . 'models/' . $name . '.php';
		
		if(is_readable($modelPath)){
			require_once($modelPath);
			if(class_exists($modelClass)){
				$this->registry->$modelClass = new $modelClass($this->registry);
				return true;
			}
		}
		exit('Ошибка: Не удалось загрузить модель ' . $name . '!');
	}
	
	public function library($name){
		$libClass = $name . 'Library';
		$libPath = ENGINE_DIR . 'lib/' . $name . '.php';
		
		if(is_readable($libPath)){
			require_once($libPath);
			return true;
		}
		exit('Ошибка: Не удалось загрузить библиотеку ' . $name . '!');
	}
}


model($name){
	global $registry;
	return $registry->load->model($name);
}

library($name){
	global $registry;
	return $registry->load->library($name);
}
{'fraction_non_alphanumeric': 0.18222976796830787, 'fraction_numerical': 0.0, 'mean_word_length': 3.6526315789473682, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 16, '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': '2940910', 'n_tokens_mistral': 723, 'n_tokens_neox': 655, 'n_words': 126}