<commit_before><?php

namespace Framework;

class Controller {

	private $app;
	private $api;

	function __construct($app){
		$this->app = $app;
	}

	protected function setHeader($header, $value)
	{
		$this->app->response->headers->set($header, $value);
	}

	protected function setLayout($layout) {
		$this->app->view->setLayout($layout);
	}

	protected function render($name, $data=array()) {
		return $this->app->render($name, $data);
	}

	protected function redirect($url, $params=null) {
		if ($params !== null) $url = $this->app->urlFor($url, $params);
		return $this->app->redirect($url);
	}

	protected function params($name = null) {
		return $this->app->request->params($name);
	}


	protected function urlFor($name, $params=array()) {
		return $this->app->router->urlFor($name, $params);<commit_msg>Add support for flash messages<commit_after><?php

namespace Framework;

class Controller {

	private $app;
	private $api;

	function __construct($app){
		$this->app = $app;
	}

	protected function setHeader($header, $value)
	{
		$this->app->response->headers->set($header, $value);
	}

	protected function setLayout($layout) {
		$this->app->view->setLayout($layout);
	}

	protected function render($name, $data=array()) {
		return $this->app->render($name, $data);
	}

	protected function flash($key, $value)
	{
		$this->app->flash($key, $value);
	}

	protected function redirect($url, $params=null) {
		if ($params !== null) $url = $this->app->urlFor($url, $params);
		return $this->app->redirect($url);
	}

	protected function params($name = null) {
		return $this->app->request->params($name);
	}


	protected function urlFor($name, $params=array()) {
		return $this->app->router->urlFor($name, $params);
{'fraction_non_alphanumeric': 0.19219569015725102, 'fraction_numerical': 0.0, 'mean_word_length': 4.944636678200692, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 45, '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': '7098340', 'n_tokens_mistral': 596, 'n_tokens_neox': 559, 'n_words': 119}