public function compile($middleware)
    {
        if ($middleware instanceof MiddlewareFactory) {
            $subMiddlewares = $middleware->getSubMiddlewares();

            // Recursive compilation in sub-middlewares
            $subMiddlewares = array_map([$this, 'compile'], $subMiddlewares);

            $middleware = $middleware->create($this->container, $subMiddlewares);
        }

        return $middleware;
    }
public function compile($middleware)
    {
        if ($middleware instanceof MiddlewareFactory) {
            $subMiddlewares = $middleware->getSubMiddlewares();

            // Recursive compilation in sub-middlewares
            $subMiddlewares = array_map([$this, 'compile'], $subMiddlewares);

            $middleware = $middleware->create($this->container, $subMiddlewares);
        }

        return $middleware;
    }
public function compile ( $ middleware ) { if ( $ middleware instanceof MiddlewareFactory ) { $ subMiddlewares = $ middleware -> getSubMiddlewares ( ) ; // Recursive compilation in sub-middlewares $ subMiddlewares = array_map ( [ $ this , 'compile' ] , $ subMiddlewares ) ; $ middleware = $ middleware -> create ( $ this -> container , $ subMiddlewares ) ; } return $ middleware ; }
Compile a middleware tree.

@param MiddlewareInterface|callable|MiddlewareFactory $middleware Middleware tree/node.

@return MiddlewareInterface|callable
Compile a middleware tree .