public function execute($uri)
    {
        foreach ($this->routes as $pattern => $callback) {
            if (preg_match($pattern, $uri, $params) === 1) {
                call_user_func_array($this->beforeRouteCallback, $params);
                array_shift($params);

                return call_user_func_array($callback, array_values($params));
            } else {
                error_log("$pattern did not match $uri");
            }
        }
    }
public function execute($uri)
    {
        foreach ($this->routes as $pattern => $callback) {
            if (preg_match($pattern, $uri, $params) === 1) {
                call_user_func_array($this->beforeRouteCallback, $params);
                array_shift($params);

                return call_user_func_array($callback, array_values($params));
            } else {
                error_log("$pattern did not match $uri");
            }
        }
    }
public function execute ( $ uri ) { foreach ( $ this -> routes as $ pattern => $ callback ) { if ( preg_match ( $ pattern , $ uri , $ params ) === 1 ) { call_user_func_array ( $ this -> beforeRouteCallback , $ params ) ; array_shift ( $ params ) ; return call_user_func_array ( $ callback , array_values ( $ params ) ) ; } else { error_log ( "$pattern did not match $uri" ) ; } } }
Match URI to route definition and call it

@param string $uri
@return mixed
Match URI to route definition and call it