public static function factory(array $middlewares = array())
    {
        $stack = new static;
        foreach ($middlewares as $middleware) {
            $stack = $stack->add($middleware);
        }
        return $stack;
    }
public static function factory(array $middlewares = array())
    {
        $stack = new static;
        foreach ($middlewares as $middleware) {
            $stack = $stack->add($middleware);
        }
        return $stack;
    }
public static function factory ( array $ middlewares = array ( ) ) { $ stack = new static ; foreach ( $ middlewares as $ middleware ) { $ stack = $ stack -> add ( $ middleware ) ; } return $ stack ; }
Creates a MiddlewareStack based on an array of middleware

@param Middleware[] $middlewares
@return MiddlewareStack
Creates a MiddlewareStack based on an array of middleware