<commit_before><?php
namespace Simox;

class Response extends SimoxServiceBase
{
    private $_content;
    
    private $_headers;
    
	public function __construct() {}
    
    public function setContent( $content )
    {
        $this->_content = $content;
    }
    
    public function getContent()
    {
        return $this->_content;
    }
    
    public function setStatusCode( $code, $message )
    {
        $this->_headers[] = array("code" => $code, "message" => $message);
    }
    
    public function sendHeaders()
    {
        if ( is_array($this->_headers) )
        {
            foreach ( $this->_headers as $header )
            {
                header( "HTTP/1.1 " . $header["code"] . " " . $header["message"], true, $header["code"] );
            }
        }
    }
}<commit_msg>add a redirect function to response<commit_after><?php
namespace Simox;

class Response extends SimoxServiceBase
{
    private $_content;
    
    private $_headers;
    
	public function __construct() {}
    
    public function setContent( $content )
    {
        $this->_content = $content;
    }
    
    public function getContent()
    {
        return $this->_content;
    }
    
    public function setStatusCode( $code, $message )
    {
        $this->_headers[] = array("code" => $code, "message" => $message);
    }
    
    public function redirect( $params )
    {
        if ( is_array($params) )
        {
            $uri = $this->router->reverseRoute( $params["controller"], $params["action"] );
        }
        
        $this->setStatusCode( 302, "Location: http://" . $this->request->getServer("HTTP_HOST") . $this->url->get($uri) );
    }
    
    public function sendHeaders()
    {
        if ( is_array($this->_headers) )
        {
            foreach ( $this->_headers as $header )
            {
                header( $header["message"], true, $header["code"] );
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.14263485477178423, 'fraction_numerical': 0.0025933609958506223, 'mean_word_length': 1.9227272727272726, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 24, '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': '1152494', 'n_tokens_mistral': 558, 'n_tokens_neox': 556, 'n_words': 119}