<commit_before><?php

namespace slc\MVC;

class Application_Controller {
	private $FRAMEWORK = null;
	private $RENDER_ENGINE = null;
	private $ASSIGNMENTS = array();
	public final function __construct(Router_Driver $Router) {
		$this->FRAMEWORK = (object)array(
			'Router' => $Router
		);

	}
	public final function Render() {
		$cls = $this->RENDER_ENGINE;
		if(is_null($cls))
			$cls = Base::Factory()->getConfig('Framework', 'DefaultRenderEngine');

		$obj = null;
		if(class_exists($cls)) {
			/**
			 * @var RenderEngine
			 */
			$obj = new $cls($this->FRAMEWORK->Router, $this);
			if(is_a($obj, '\slc\MVC\RenderEngine')) {
				$obj->setTemplateValues($this->ASSIGNMENTS);
				return $obj;
			}
			else
				throw new Application_Controller_Exception(Application_Controller_Exception::INVALID_RENDER_ENGINE, array('RenderEngine' => $cls));
		}
		throw new Application_Controller_Exception(Application_Controller_Exception::INVALID_RENDER_ENGINE_NOT_FOUND, array('RenderEngine' => $cls));
	}
	protected final function setRenderEngine($class) {
		$this->RENDER_ENGINE = $class;
	}

	public function useHTTPRequestMethodInViewName() {
		return false;
	}

	protected function assign($key, $value) {
		$this->ASSIGNMENTS[$key] = $value;
	}
	protected function assignArray(array $array = array()) {
		$this->ASSIGNMENTS = array_merge($this->ASSIGNMENTS, $array);
	}
	protected function getFrameworkVars() {
		return $this->FRAMEWORK;
	}

}

class Application_Controller_Exception extends Application_Exception {
	const INVALID_RENDER_ENGINE = 'Invalid render engine (class RenderEngine not inherited)';
	const INVALID_RENDER_ENGINE_NOT_FOUND = 'Invalid render engine (not found)';
}

?><commit_msg>added cleanAssignments() method to controller<commit_after><?php

namespace slc\MVC;

class Application_Controller {
	private $FRAMEWORK = null;
	private $RENDER_ENGINE = null;
	private $ASSIGNMENTS = array();
	public final function __construct(Router_Driver $Router) {
		$this->FRAMEWORK = (object)array(
			'Router' => $Router
		);

	}
	public final function Render() {
		$cls = $this->RENDER_ENGINE;
		if(is_null($cls))
			$cls = Base::Factory()->getConfig('Framework', 'DefaultRenderEngine');

		$obj = null;
		if(class_exists($cls)) {
			/**
			 * @var RenderEngine
			 */
			$obj = new $cls($this->FRAMEWORK->Router, $this);
			if(is_a($obj, '\slc\MVC\RenderEngine')) {
				$obj->setTemplateValues($this->ASSIGNMENTS);
				return $obj;
			}
			else
				throw new Application_Controller_Exception(Application_Controller_Exception::INVALID_RENDER_ENGINE, array('RenderEngine' => $cls));
		}
		throw new Application_Controller_Exception(Application_Controller_Exception::INVALID_RENDER_ENGINE_NOT_FOUND, array('RenderEngine' => $cls));
	}
	protected final function setRenderEngine($class) {
		$this->RENDER_ENGINE = $class;
	}

	public function useHTTPRequestMethodInViewName() {
		return false;
	}

    protected function cleanAssignments() {
        $this->ASSIGNMENTS = array();
    }

	protected function assign($key, $value) {
		$this->ASSIGNMENTS[$key] = $value;
	}
	protected function assignArray(array $array = array()) {
		$this->ASSIGNMENTS = array_merge($this->ASSIGNMENTS, $array);
	}
	protected function getFrameworkVars() {
		return $this->FRAMEWORK;
	}

}

class Application_Controller_Exception extends Application_Exception {
	const INVALID_RENDER_ENGINE = 'Invalid render engine (class RenderEngine not inherited)';
	const INVALID_RENDER_ENGINE_NOT_FOUND = 'Invalid render engine (not found)';
}

?>
{'fraction_non_alphanumeric': 0.13213981244671782, 'fraction_numerical': 0.0, 'mean_word_length': 5.29695885509839, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 36, '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': '3603680', 'n_tokens_mistral': 1229, 'n_tokens_neox': 1120, 'n_words': 225}