<commit_before><?php

namespace ephFrame\core;

use ephFrame\HTTP\Request;
use ephFrame\HTTP\Response;
use ephFrame\view\View;

class Controller
{
	protected $request;
	
	protected $response;
	
	protected $view;
	
	protected $params = array();
	
	protected $action = 'index';
	
	protected $callbacks;
	
	public function __construct(Request $request, Array $params = array())
	{
		$this->request = $request;
		$this->response = new Response();
		$this->view = new View();
		$this->params = array_merge_recursive($this->params, $params);
		$this->name = preg_replace('@(.+)\\\(\w*)Controller$@', '\\2', get_class($this));
		$this->callbacks = new \ephFrame\core\CallbackHandler();
		$this->callbacks->add('beforeAction', array($this, 'beforeAction'));
		$this->callbacks->add('afterAction', array($this, 'afterAction'));
		$this->callbacks->add('beforeRender', array($this, 'beforeRender'));
		$this->callbacks->add('afterRender', array($this, 'afterRender'));
	}
	
	protected function index()
	{
		return true;
	}
	
	public function action($action, Array $params = array())
	{
		$this->action = $action;
		$this->callbacks->call('beforeAction');
		$this->callbacks->call($this->action, $params);
		if (method_exists($this, $this->action)) {
			$result = call_user_func_array(array($this, $this->action), $params);
		}
		$this->callbacks->call('afterAction');<commit_msg>result of controller is always set (undefined variable)<commit_after><?php

namespace ephFrame\core;

use ephFrame\HTTP\Request;
use ephFrame\HTTP\Response;
use ephFrame\view\View;

class Controller
{
	protected $request;
	
	protected $response;
	
	protected $view;
	
	protected $params = array();
	
	protected $action = 'index';
	
	protected $callbacks;
	
	public function __construct(Request $request, Array $params = array())
	{
		$this->request = $request;
		$this->response = new Response();
		$this->view = new View();
		$this->params = array_merge_recursive($this->params, $params);
		$this->name = preg_replace('@(.+)\\\(\w*)Controller$@', '\\2', get_class($this));
		$this->callbacks = new \ephFrame\core\CallbackHandler();
		$this->callbacks->add('beforeAction', array($this, 'beforeAction'));
		$this->callbacks->add('afterAction', array($this, 'afterAction'));
		$this->callbacks->add('beforeRender', array($this, 'beforeRender'));
		$this->callbacks->add('afterRender', array($this, 'afterRender'));
	}
	
	protected function index()
	{
		return true;
	}
	
	public function action($action, Array $params = array())
	{
		$this->action = $action;
		$this->callbacks->call('beforeAction');
		$this->callbacks->call($this->action, $params);
		if (method_exists($this, $this->action)) {
			$result = call_user_func_array(array($this, $this->action), $params);
		} else {
			$result = true;
		}
		$this->callbacks->call('afterAction');
{'fraction_non_alphanumeric': 0.1911032028469751, 'fraction_numerical': 0.0007117437722419929, 'mean_word_length': 5.2052980132450335, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 53, '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': '7292321', 'n_tokens_mistral': 973, 'n_tokens_neox': 898, 'n_words': 181}