protected function resolve($middleware): callable
    {
        if (null === $middleware) {
            return function (RequestInterface $request, ResponseInterface $response, callable $next) {
                return $response;
            };
        }

        return $this->resolveMiddleware($middleware);
    }