<commit_before><?php

/*
 * This file is part of the Blueprint Framwork package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Blueprint\Router;

/**
 * Router class.
 *
 * Routes URLs to the correct controller class.
 *
 * @package blueprint
 * @author Christopher <<EMAIL>>
 */
class Router {

    /**
     * app
     * 
     * (default value: null)
     * 
     * @var mixed
     * @access protected
     */
    protected $app = null;
    
    /**
     * url
     * 
     * (default value: '')
     * 
     * @var string
     * @access protected
     */
    protected $url = '';
    
    /**
     * route_maps
     * 
     * (default value: array())
     * 
     * @var array
     * @access protected
     */
    protected $route_maps = array();
    
    /**
     * controller
     * 
     * @var mixed
     * @access protected
     */
    protected $controller_name = 'Index';
    
    /**
     * action
     * 
     * @var mixed
     * @access protected
     */
    protected $action_name = 'index';
    
    /**
     * contoller
     * 
     * @var mixed
     * @access protected
     */
    protected $contoller;
    
    /**
     * params
     * 
     * (default value: array())
     * 
     * @var array
     * @access protected
     */
    protected $params = array();

    /**
     * __construct function.
     *
     * Loads dependencies, determines URL to use to match routes
     * routes the URL.
     * 
     * @access public
     * @param mixed $app
     * @return void
     */
    public function __construct($app) {
        
        $this->app = $app;
        
        $cfg = $this->app->get('config');
        
        if (strpos($_SERVER['REQUEST_URI'], $cfg->base) === 0)
            $this->url = substr($_SERVER['REQUEST_URI'], strlen($cfg->base));
            
    }
    
    /**
     * registerRouteMap function.
     *
     * Registers a set of options to define what URL pattern matches 
     * a route to a contoller/action pair
     * 
     * @access public
     * @param mixed $namespace
     * @param array $routes (default: array())
     * @return void
     */
    public function registerRouteMap($namespace, $routes=array()) {

        $this->route_maps[] = array(
            'namespace'     => $namespace,
            'routes'        => $routes
        );
    
    }
<commit_msg>Fixed a problem with the router where GET parameters where being passed at the routed action when the URL didnt end with a slash<commit_after><?php

/*
 * This file is part of the Blueprint Framwork package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Blueprint\Router;

/**
 * Router class.
 *
 * Routes URLs to the correct controller class.
 *
 * @package blueprint
 * @author Christopher <<EMAIL>>
 */
class Router {

    /**
     * app
     * 
     * (default value: null)
     * 
     * @var mixed
     * @access protected
     */
    protected $app = null;
    
    /**
     * url
     * 
     * (default value: '')
     * 
     * @var string
     * @access protected
     */
    protected $url = '';
    
    /**
     * route_maps
     * 
     * (default value: array())
     * 
     * @var array
     * @access protected
     */
    protected $route_maps = array();
    
    /**
     * controller
     * 
     * @var mixed
     * @access protected
     */
    protected $controller_name = 'Index';
    
    /**
     * action
     * 
     * @var mixed
     * @access protected
     */
    protected $action_name = 'index';
    
    /**
     * contoller
     * 
     * @var mixed
     * @access protected
     */
    protected $contoller;
    
    /**
     * params
     * 
     * (default value: array())
     * 
     * @var array
     * @access protected
     */
    protected $params = array();

    /**
     * __construct function.
     *
     * Loads dependencies, determines URL to use to match routes
     * routes the URL.
     * 
     * @access public
     * @param mixed $app
     * @return void
     */
    public function __construct($app) {
        
        $this->app = $app;
        
        $cfg = $this->app->get('config');
        
        if (strpos($_SERVER['REQUEST_URI'], $cfg->base) === 0)
            $this->url = substr($_SERVER['REQUEST_URI'], strlen($cfg->base));

        $this->url = preg_replace('/\?.*$/', '', $this->url);
            
    }
    
    /**
     * registerRouteMap function.
     *
     * Registers a set of options to define what URL pattern matches 
     * a route to a contoller/action pair
     * 
     * @access public
     * @param mixed $namespace
     * @param array $routes (default: array())
     * @return void
     */
    public function registerRouteMap($namespace, $routes=array()) {

        $this->route_maps[] = array(
            'namespace'     => $namespace,
            'routes'        => $routes
        );
    
    }

{'fraction_non_alphanumeric': 0.1290513833992095, 'fraction_numerical': 0.0003952569169960474, 'mean_word_length': 1.6636842105263159, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 33, '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': '1760861', 'n_tokens_mistral': 1511, 'n_tokens_neox': 1477, 'n_words': 408}