<commit_before><?php
/**
 * Controller
 */

namespace Orpheus\InputController;

use Orpheus\Exception\UserException;

/**
 * The Controller class
 *
 * @author <NAME> <<EMAIL>>
 *
 */
abstract class Controller {

	/**
	 * The request calling this controller
	 *
	 * @var \Orpheus\InputController\InputRequest
	 */
	protected $request;
	
	/**
	 * The route calling this controller
	 * A controller could be called without any route and any request
	 * This variable comes to get the route without any request
	 *
	 * @var \Orpheus\InputController\ControllerRoute
	 */
	protected $route;
	
	/**
	 * Running options for this controller
	 *
	 * @var array
	 */
	protected $options = array();
	
	/**
	 * Catch controller output when running it
	 *
	 * @var boolean
	 */
	protected $catchControllerOuput = false;
	
	/**
	 * Get this controller as string
	 *
	 * @return string
	 */
	public function __toString() {
		return get_called_class();
	}

	/**
	 * Process the $request
	 *
	 * @param InputRequest $request
	 * @return OutputResponse
	 * @uses ControllerRoute::run()
	 * @see Controller::preRun()
	 * @see Controller::run()
	 * @see Controller::postRun()
	 *
	 * preRun() and postRun() are not declared in this class because PHP does not handle inheritance of parameters
	 * if preRun() is declared getting a InputRequest, we could not declare a preRun() using a HTTPRequest
	 */
	public function process(InputRequest $request) {
		// run, preRun and postRun take parameter depending on Controller, request may be of a child class of InputRequest
		$this->request = $request;
		
		if( $this->catchControllerOuput ) {
			ob_start();
		}
		$result	= null;
//		$values = array();
//		// Require initialization
//		$this->fillValues($values);
		try {
			// Could prevent Run & PostRun
			// We recommend that PreRun only return Redirects and Exceptions
			$result	= $this->preRun($request);
		} catch( UserException $e ) {<commit_msg>Clean sources<commit_after><?php
/**
 * Controller
 */

namespace Orpheus\InputController;

use Orpheus\Exception\UserException;

/**
 * The Controller class
 *
 * @author <NAME> <<EMAIL>>
 *
 */
abstract class Controller {

	/**
	 * The request calling this controller
	 *
	 * @var \Orpheus\InputController\InputRequest
	 */
	protected $request;
	
	/**
	 * The route calling this controller
	 * A controller could be called without any route and any request
	 * This variable comes to get the route without any request
	 *
	 * @var \Orpheus\InputController\ControllerRoute
	 */
	protected $route;
	
	/**
	 * Running options for this controller
	 *
	 * @var array
	 */
	protected $options = array();
	
	/**
	 * Catch controller output when running it
	 *
	 * @var boolean
	 */
	protected $catchControllerOuput = false;
	
	/**
	 * Get this controller as string
	 *
	 * @return string
	 */
	public function __toString() {
		return get_called_class();
	}

	/**
	 * Process the $request
	 *
	 * @param InputRequest $request
	 * @return OutputResponse
	 * @uses ControllerRoute::run()
	 * @see Controller::preRun()
	 * @see Controller::run()
	 * @see Controller::postRun()
	 *
	 * preRun() and postRun() are not declared in this class because PHP does not handle inheritance of parameters
	 * if preRun() is declared getting a InputRequest, we could not declare a preRun() using a HTTPRequest
	 */
	public function process(InputRequest $request) {
		// run, preRun and postRun take parameter depending on Controller, request may be of a child class of InputRequest
		$this->request = $request;
		
		if( $this->catchControllerOuput ) {
			ob_start();
		}
		$result	= null;
		try {
			// Could prevent Run & PostRun
			// We recommend that PreRun only return Redirects and Exceptions
			$result	= $this->preRun($request);
		} catch( UserException $e ) {
{'fraction_non_alphanumeric': 0.11172888535875033, 'fraction_numerical': 0.0, 'mean_word_length': 3.3930232558139535, 'pattern_counts': {'":': 0, '<': 11, '<?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': '7538468', 'n_tokens_mistral': 1177, 'n_tokens_neox': 1041, 'n_words': 374}