<commit_before><?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Recess extends CI_Driver_Library
{
	protected $valid_drivers = ['assign', 'format'];
	/**
	 * @var object
	 */
	private static $_instance;
	/**
	 * @var object
	 */
	private static $_ci_instance;
	/**
	 * @var object
	 */
	private static $_ci_hooks_instance;
	/**
	 * @var object
	 */
	private static $_ci_output_instance;
	/**
	 * @var boolean
	 */
	protected $_enable_xss = FALSE;
	/**
	 * @var string
	 */
	protected $_content_type = NULL;
	/**
	 * @var string
	 */
	protected $_directory = NULL;
	/**
	 * @var string
	 */
	protected $_class = NULL;
	/**
	 * @var string
	 */
	protected $_method = NULL;
	/**
	 * @var array
	 */
	protected $_arguments = array();

	function __construct()
	{
		log_message('debug', "Recess driver initialized");
		/*
		 * ------------------------------------------------------
		 *  Recess Class
		 * ------------------------------------------------------
		 * remap()
		 * input()
		 * input_stream()
		 * input_method()
		 * response()
		 */
		self::$_instance = &$this;
		/*
		 * ------------------------------------------------------
		 *  Codeigniter Controller Class
		 * ------------------------------------------------------
		 */
		self::$_ci_instance = &get_instance();
		self::$_ci_instance->benchmark->mark('recess_construct');
		self::$_ci_hooks_instance = &load_class('Hooks', 'core');
		self::$_ci_output_instance = &load_class('Output', 'core');

		$this->_directory = self::$_ci_instance->router->fetch_directory();
		$this->_class = self::$_ci_instance->router->fetch_class();

		$this->_enable_xss = (self::$_ci_instance->config->item('global_xss_filtering') === TRUE);

		$this->assign->put('recess_input_methods', ['GET', 'POST', 'PUT', 'PATCH', 'DELETE']);
		$this->assign->put('recess_authorized', TRUE);

		$this->_content_type = $this->_detected_content_type();
		$this->_detected_hook();

		self::$_ci_hooks_instance->call_hook('recess_construct');
	}

	//------------------------------------------------------

	public static function &get_instance()
	{
		return self::$_instance;
	}

	//------------------------------------------------------

	/**
	 *
	 * @param  [type] $method    [description]
	 * @param  [type] $arguments [description]
	 * @return [type]            [description]
	 */
	public function remap( $method, $arguments = NULL )
	{
		if( $this->_parse_route(array($method, 'index'), $arguments) === FALSE )
		{
			log_message('error', 'Not found');
			show_404();
		}

		if( preg_match('/\_index/i', $this->_method) )
		{
			array_unshift($this->_arguments, $method);
		}

		$this->_is_authorized() && self::$_ci_hooks_instance->call_hook('recess_authorized');

		try
		{
			call_user_func_array([self::$_ci_instance, $this->_method], $this->_arguments );
		}
		catch (Exception $e)
		{
			log_message('error', $e->getMessage());
		}
	}

	//------------------------------------------------------

	/**
	 *
	 * @param  [type]  $output           [description]
	 * @param  [type]  $http_status_code [description]
	 * @param  boolean $continue         [description]
	 * @return [type]                    [description]<commit_msg>recess_construct position changed<commit_after><?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Recess extends CI_Driver_Library
{
	protected $valid_drivers = ['assign', 'format'];
	/**
	 * @var object
	 */
	private static $_instance;
	/**
	 * @var object
	 */
	private static $_ci_instance;
	/**
	 * @var object
	 */
	private static $_ci_hooks_instance;
	/**
	 * @var object
	 */
	private static $_ci_output_instance;
	/**
	 * @var boolean
	 */
	protected $_enable_xss = FALSE;
	/**
	 * @var string
	 */
	protected $_content_type = NULL;
	/**
	 * @var string
	 */
	protected $_directory = NULL;
	/**
	 * @var string
	 */
	protected $_class = NULL;
	/**
	 * @var string
	 */
	protected $_method = NULL;
	/**
	 * @var array
	 */
	protected $_arguments = array();

	function __construct()
	{
		log_message('debug', "Recess driver initialized");
		/*
		 * ------------------------------------------------------
		 *  Recess Class
		 * ------------------------------------------------------
		 * remap()
		 * input()
		 * input_stream()
		 * input_method()
		 * response()
		 */
		self::$_instance = &$this;
		/*
		 * ------------------------------------------------------
		 *  Codeigniter Controller Class
		 * ------------------------------------------------------
		 */
		self::$_ci_instance = &get_instance();
		self::$_ci_instance->benchmark->mark('recess_construct');
		self::$_ci_hooks_instance = &load_class('Hooks', 'core');
		self::$_ci_output_instance = &load_class('Output', 'core');

		$this->_directory = self::$_ci_instance->router->fetch_directory();
		$this->_class = self::$_ci_instance->router->fetch_class();

		$this->_enable_xss = (self::$_ci_instance->config->item('global_xss_filtering') === TRUE);

		$this->assign->put('recess_input_methods', ['GET', 'POST', 'PUT', 'PATCH', 'DELETE']);
		$this->assign->put('recess_authorized', TRUE);

		$this->_content_type = $this->_detected_content_type();
		$this->_detected_hook();
	}

	//------------------------------------------------------

	public static function &get_instance()
	{
		return self::$_instance;
	}

	//------------------------------------------------------

	/**
	 *
	 * @param  [type] $method    [description]
	 * @param  [type] $arguments [description]
	 * @return [type]            [description]
	 */
	public function remap( $method, $arguments = NULL )
	{
		self::$_ci_hooks_instance->call_hook('recess_construct');

		if( $this->_parse_route(array($method, 'index'), $arguments) === FALSE )
		{
			log_message('error', 'Not found');
			show_404();
		}

		if( preg_match('/\_index/i', $this->_method) )
		{
			array_unshift($this->_arguments, $method);
		}

		$this->_is_authorized() && self::$_ci_hooks_instance->call_hook('recess_authorized');

		try
		{
			call_user_func_array([self::$_ci_instance, $this->_method], $this->_arguments );
		}
		catch (Exception $e)
		{
			log_message('error', $e->getMessage());
		}
	}

	//------------------------------------------------------

	/**
	 *
	 * @param  [type]  $output           [description]
	 * @param  [type]  $http_status_code [description]
	 * @param  boolean $continue         [description]
	 * @return [type]                    [description]
{'fraction_non_alphanumeric': 0.27817670933499844, 'fraction_numerical': 0.0009366219169528567, 'mean_word_length': 2.192326856003986, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 57, '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': '5229661', 'n_tokens_mistral': 2095, 'n_tokens_neox': 1870, 'n_words': 351}