src/WorkerF/Http/Middleware.php
public static function run(array $middlewares, Requests $request)
    {
        // if middlewares empty, return request as is
        if (empty($middlewares)) {
            return $request;
        }

        $pipes = [];

        foreach ($middlewares as $middleware) {
            // get instance with singleton
            $middleware_instance = IOCContainer::getInstanceWithSingleton($middleware);
            // create pipes array    
            $pipes[] = [$middleware_instance, 'handle'];
        }

        $pipeline = new Pipeline($pipes);
        // run pipes flow
        return $pipeline->flow($request);
    }
public static function run(array $middlewares, Requests $request)
    {
        // if middlewares empty, return request as is
        if (empty($middlewares)) {
            return $request;
        }

        $pipes = [];

        foreach ($middlewares as $middleware) {
            // get instance with singleton
            $middleware_instance = IOCContainer::getInstanceWithSingleton($middleware);
            // create pipes array    
            $pipes[] = [$middleware_instance, 'handle'];
        }

        $pipeline = new Pipeline($pipes);
        // run pipes flow
        return $pipeline->flow($request);
    }
dispatch route.

@param array $middlewares
@param WorkerF\Http\Requests $request
@return mixed