<commit_before><?php
/*
 * Created by <NAME> on 2011-03-06.
 * Copyright (c) 2011 <NAME>.
 * All rights reserved.
 */

namespace Inject\Web\Router\Route;

/**
 * A compiled route pointing to an Application or Engine.
 */
class ApplicationRoute extends AbstractRoute
{
	protected $app_name;
	
	// ------------------------------------------------------------------------
	
	/**
	 * @param  string  The regular expression pattern
	 * @param  array(string => string)  List of options to return if this route matches
	 * @param  array(string => int)  List of keys to intersect to get the options from
	 *                               the regex captures
	 * @param  array(string)  List of accepted HTTP request methods
	 * @param  string    Fully qualified Application/Engine class name
	 */
	public function __construct($pattern, array $options, array $capture_intersect, array $accepted_request_methods, $app_name)
	{
		parent::__construct($pattern, $options, $capture_intersect, $accepted_request_methods);
		
		$this->app_name = $app_name;
	}
	
	// ------------------------------------------------------------------------
	
	/**
	 * Returns a callback which is to be run by the application, this
	 * method is called after matches() has returned true.
	 * 
	 * @param  mixed
	 * @return callback
	 */
	public function dispatch($env)
	{
		$app_class = $this->app_name;
		
		$uri  = isset($this->parsed_options['uri']) ? $this->parsed_options['uri'] : '';
		$path = substr($env['web.uri'], - strlen($uri));
		
		$env['web.front_controller'] = $env['web.front_controller'].$path;
		$env['web.base_uri']         = $env['web.base_uri'].$path;
		$env['web.uri']              = $uri;
		$env['REQUEST_URI']          = $uri;
		$env['PATH_INFO']            = $uri;
		$env['web.path_params_old']  = $env['web.path_params_old'];
		
		return $app_class::instance()->stack()->run($env);
	}<commit_msg>Web\Router: Fixed typo in Route\ApplicationRoute<commit_after><?php
/*
 * Created by <NAME> on 2011-03-06.
 * Copyright (c) 2011 <NAME>.
 * All rights reserved.
 */

namespace Inject\Web\Router\Route;

/**
 * A compiled route pointing to an Application or Engine.
 */
class ApplicationRoute extends AbstractRoute
{
	protected $app_name;
	
	// ------------------------------------------------------------------------
	
	/**
	 * @param  string  The regular expression pattern
	 * @param  array(string => string)  List of options to return if this route matches
	 * @param  array(string => int)  List of keys to intersect to get the options from
	 *                               the regex captures
	 * @param  array(string)  List of accepted HTTP request methods
	 * @param  string    Fully qualified Application/Engine class name
	 */
	public function __construct($pattern, array $options, array $capture_intersect, array $accepted_request_methods, $app_name)
	{
		parent::__construct($pattern, $options, $capture_intersect, $accepted_request_methods);
		
		$this->app_name = $app_name;
	}
	
	// ------------------------------------------------------------------------
	
	/**
	 * Returns a callback which is to be run by the application, this
	 * method is called after matches() has returned true.
	 * 
	 * @param  mixed
	 * @return callback
	 */
	public function dispatch($env)
	{
		$app_class = $this->app_name;
		
		$uri  = isset($this->parsed_options['uri']) ? $this->parsed_options['uri'] : '';
		$path = substr($env['web.uri'], - strlen($uri));
		
		$env['web.front_controller'] = $env['web.front_controller'].$path;
		$env['web.base_uri']         = $env['web.base_uri'].$path;
		$env['web.uri']              = $uri;
		$env['REQUEST_URI']          = $uri;
		$env['PATH_INFO']            = $uri;
		$env['web.path_params_old']  = $env['web.path_parameters'];
		
		return $app_class::instance()->stack()->run($env);
	}
{'fraction_non_alphanumeric': 0.20830049908064094, 'fraction_numerical': 0.006304176516942475, 'mean_word_length': 2.4337240757439136, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2008713', 'n_tokens_mistral': 1179, 'n_tokens_neox': 1068, 'n_words': 292}