src/WorkerF/Http/Route.php
public static function dispatch(Requests $request)
    {
        // get request param
        $path   = self::_pathParse($request->path());
        $method = $request->method();

        // router exist or not
        if (array_key_exists($path, self::$_map_tree) &&
           array_key_exists($method, self::$_map_tree[$path])
        ) {
            // get current request route middleware symbols
            $middleware_symbols = self::$_middleware_map_tree[$path][$method];
            // get callback info
            $callback = self::$_map_tree[$path][$method];
            
            return self::_runDispatch($request, $callback, $middleware_symbols);
        }

        // route in variable route cache or not
        if (array_key_exists($path, self::$_variable_route_cache) &&
           array_key_exists($method, self::$_variable_route_cache[$path])
        ) {
            // get variable route info
            $callback           = self::$_variable_route_cache[$path][$method]['callback'];
            $params             = self::$_variable_route_cache[$path][$method]['params'];
            $middleware_symbols = self::$_variable_route_cache[$path][$method]['middleware'];
            // dispatch variable route
            return self::_runDispatch($request, $callback, $middleware_symbols, $params);
        }

        // router is variable router or not
        if (NULL !== ($path_info = self::_variablePathParse($path, $method))) {
            // get variable route info
            $callback           = $path_info['callback'];
            $params             = $path_info['params'];
            $middleware_symbols = $path_info['middleware'];
            // clear route cache with LRU if data out of range
            self::_variableRouteCacheControl($path);
            // save variable route to cache
            self::$_variable_route_cache[$path][$method]['callback']   = $callback;
            self::$_variable_route_cache[$path][$method]['params']     = $params;
            self::$_variable_route_cache[$path][$method]['middleware'] = $middleware_symbols;
            // dispatch variable route
            return self::_runDispatch($request, $callback, $middleware_symbols, $params);
        } 

        // route is not found
        $e = new \LogicException("route rule path: $path <==> method : $method is not set!");
        $e->httpCode = 404;
        throw $e; 
    }
public static function dispatch(Requests $request)
    {
        // get request param
        $path   = self::_pathParse($request->path());
        $method = $request->method();

        // router exist or not
        if (array_key_exists($path, self::$_map_tree) &&
           array_key_exists($method, self::$_map_tree[$path])
        ) {
            // get current request route middleware symbols
            $middleware_symbols = self::$_middleware_map_tree[$path][$method];
            // get callback info
            $callback = self::$_map_tree[$path][$method];
            
            return self::_runDispatch($request, $callback, $middleware_symbols);
        }

        // route in variable route cache or not
        if (array_key_exists($path, self::$_variable_route_cache) &&
           array_key_exists($method, self::$_variable_route_cache[$path])
        ) {
            // get variable route info
            $callback           = self::$_variable_route_cache[$path][$method]['callback'];
            $params             = self::$_variable_route_cache[$path][$method]['params'];
            $middleware_symbols = self::$_variable_route_cache[$path][$method]['middleware'];
            // dispatch variable route
            return self::_runDispatch($request, $callback, $middleware_symbols, $params);
        }

        // router is variable router or not
        if (NULL !== ($path_info = self::_variablePathParse($path, $method))) {
            // get variable route info
            $callback           = $path_info['callback'];
            $params             = $path_info['params'];
            $middleware_symbols = $path_info['middleware'];
            // clear route cache with LRU if data out of range
            self::_variableRouteCacheControl($path);
            // save variable route to cache
            self::$_variable_route_cache[$path][$method]['callback']   = $callback;
            self::$_variable_route_cache[$path][$method]['params']     = $params;
            self::$_variable_route_cache[$path][$method]['middleware'] = $middleware_symbols;
            // dispatch variable route
            return self::_runDispatch($request, $callback, $middleware_symbols, $params);
        } 

        // route is not found
        $e = new \LogicException("route rule path: $path <==> method : $method is not set!");
        $e->httpCode = 404;
        throw $e; 
    }
dispatch route.

@param WorkerF\Http\Requests $request
@return mixed
@throws \LogicException
@throws \BadMethodCallException
@throws \InvalidArgumentException