public function allow(string $route, $control)
    {
        // make an array of the route
        $routeUri = $this->getUriArray($route);
        // Is this route not the same size as the current URI?
        if ($this->uriCount !== count($routeUri)) {
            return; // Do not add route
        }
        // Single Question Mark denotes a variable routing
        if (in_array('?', $routeUri)) {
            $this->routesVariable[$route] = ['c' => $control, 'u' => $routeUri]; // add variable route

            return; // Variable route found
        }
        $this->routesExact[$route] = ['c' => $control, 'u' => $routeUri]; // add exact route
    }
public function allow(string $route, $control)
    {
        // make an array of the route
        $routeUri = $this->getUriArray($route);
        // Is this route not the same size as the current URI?
        if ($this->uriCount !== count($routeUri)) {
            return; // Do not add route
        }
        // Single Question Mark denotes a variable routing
        if (in_array('?', $routeUri)) {
            $this->routesVariable[$route] = ['c' => $control, 'u' => $routeUri]; // add variable route

            return; // Variable route found
        }
        $this->routesExact[$route] = ['c' => $control, 'u' => $routeUri]; // add exact route
    }
public function allow ( string $ route , $ control ) { // make an array of the route $ routeUri = $ this -> getUriArray ( $ route ) ; // Is this route not the same size as the current URI? if ( $ this -> uriCount !== count ( $ routeUri ) ) { return ; // Do not add route } // Single Question Mark denotes a variable routing if ( in_array ( '?' , $ routeUri ) ) { $ this -> routesVariable [ $ route ] = [ 'c' => $ control , 'u' => $ routeUri ] ; // add variable route return ; // Variable route found } $ this -> routesExact [ $ route ] = [ 'c' => $ control , 'u' => $ routeUri ] ; // add exact route }
Allow a route

$router->allow($route, $control);

route = a string with the URI list, forward-slash delimited

Exact routing:
Home:  '/'
Page:  '/foo/bar'
- preceding and trailing slashes are optional, except for top level '/'

Variable routing:
- use a question mark to denote a URI segment as a variable
- variables are retrieved via: $router->getVar(int $index)
- Examples:
'/id/?'             - retrieve with getVar(0)
'/book/?/chapter/?' - retrieve with getVar(0) and getVar(1)
'/foo/?/?/?'        - retrieve with getVar(0), getVar(1) and getVar(2)

control = anything you want, a string, a closure, an array, an object, an int, a float, whatever!

@param string $route
@param mixed $control
Allow a route