@param RequestHandlerInterface $requestHandler

@return CallbackRequestHandler
423998
private function decorateRequestHandler(RequestHandlerInterface $requestHandler)
    {
        return new CallbackRequestHandler(
            function (RequestInterface $request) use ($requestHandler) {

                $ex = null;
                try {
                    $response = $requestHandler->handle($request);
                } catch (\Exception $ex) {
                    $response = $this->handleException($ex);
                }

                return isset($response) ? $response : $this->exceptionHandler->createErrorResponseByException($ex);
            },
            function (RequestInterface $request, ResponseInterface $response) use ($requestHandler) {

                try {
                    $requestHandler->finish($request, $response);
                } catch (\Exception $ex) {
                    $this->handleException($ex);
                }
            }
        );
    }
1083525
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $request = $request->withAttribute(self::ORIGINAL_REQUEST, $request);

        set_error_handler($this->createErrorHandler());

        try {
            $response = $handler->handle($request);
        } catch (Throwable $exception) {
            $response = $this->handleThrowable($exception, $request);
        }

        restore_error_handler();

        return $response;
    }
1005490
protected function handleRequest(Closure $handler, ?RequestInterface $request): ResponseInterface
    {
        $response = call_user_func($handler, $request);

        return $response;
    }
22190
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $middlewares = $this->module_service->findByInterface(MiddlewareInterface::class);

        $pipeline = $handler;

        foreach ($middlewares as $middleware) {
            $pipeline = new class($pipeline, $middleware) implements RequestHandlerInterface {
                /** @var RequestHandlerInterface */
                private $handler;

                /** @var MiddlewareInterface */
                private $middleware;

                public function __construct(RequestHandlerInterface $handler, MiddlewareInterface $middleware)
                {
                    $this->handler    = $handler;
                    $this->middleware = $middleware;
                }

                public function handle(ServerRequestInterface $request): ResponseInterface
                {
                    return $this->middleware->process($request, $this->handler);
                }
            };
        }

        return $pipeline->handle($request);
    }
904370
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $requestPath = $this->getNormalizedPath($request);

        foreach ($this->middlewares as $pathPrefix => $middleware) {
            if (strpos($requestPath, $pathPrefix) === 0) {
                return $handler->handle(
                    $this->unprefixedRequest($request, $pathPrefix)
                        ->withAttribute($this->attribute, $middleware)
                );
            }
        }

        if ($this->continueOnError) {
            return $handler->handle($request);
        }

        return $this->responseFactory->createResponse(404);
    }
424909
public function handleRequest($requestUri = null, $requestMethod = null)
    {
        if (!$this->isConfigConsistent() && false) {
            throw new \LogicException('The client configuration is not consistent');
        }

        $pathInfo = $requestUri;

        if (false !== $pos = strpos($pathInfo, '?')) {
            $pathInfo = substr($pathInfo, 0, $pos);
        }

        $pathInfo = rawurldecode($pathInfo);

        $info = $this->getDispatcher()->dispatch($requestMethod, $pathInfo);

        if ($info[0] == Dispatcher::FOUND) {
            try {
                $response = $info[1]($this);

                if ($response instanceof ResponseInterface) {
                    $this->setResponse($response);
                }
            } catch (ResponseExceptionInterface $e) {
                $this->setResponse($e->getResponse());
            }
        } elseif (!$this->isAuthenticated()) {
            if (strtoupper($requestMethod) == 'GET') {
                $_SESSION[self::class][$this->getConfig()->getEntityID()]['targeted_path'] = $requestUri;
            }

            $request = $this->getSaml()->buildAuthnRequest();
            $_SESSION[self::class][$this->getConfig()->getEntityID()]['SAML_RelayState'] = $request->getRelayState();

            $this->setResponse($this->getSaml()->getHttpRedirectBindingResponse($request));
        }

        return $this;
    }
1358975
public function withHandler(RequestHandlerInterface $handler): self
    {
        $pipeline = clone $this;
        $pipeline->handler = $handler;
        $pipeline->position = 0;

        return $pipeline;
    }
297246
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $response = $handler->handle($request);
        if ($this->onlyPreflight) {
            if ($this->cors->isPreflightRequest('psr-7', $request)) {
                return $this
                    ->handle($request, $response)
                    ->withStatus(204);
            }

            return $response;
        }

        return $this->handle($request, $response);
    }
1005090
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        if (class_exists(StandardDebugBar::class)) {
            DebugBar::enable();

            DebugBar::initPDO(DB::connection()->getPdo());

            $response = $handler->handle($request);

            if ($this->shouldSendDataOnNextPage($response)) {
                DebugBar::stackData();
            } elseif ($this->shouldSendDataInHeaders($request)) {
                DebugBar::sendDataInHeaders();
            }

            return $response;
        }

        return $handler->handle($request);
    }
517429
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        return $this->execute([$request, $handler]);
    }
897487
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $request = $this->withDecryptedCookies($request);
        $response = $handler->handle($request);

        return $this->withEncryptedCookies($response);
    }
799789
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $router         = $serviceLocator->get('Router');
        $requestContext = $serviceLocator->get('RouterRequestContext');
        $logger         = $serviceLocator->has('Logger') ? $serviceLocator->get('Logger') : null;
        $requestStack   = $serviceLocator->get('RequestStack');

        return new RouterListener($router, $requestContext, $logger, $requestStack);
    }
838615
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $result = $this->router->dispatch(
            $request->getMethod(),
            $request->getUri()->getPath()
        );

        return $handler->handle(
            $request->withAttribute('routing', $result)
        );
    }
648332
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface
    {
        $this->startTransaction();
        $response = $handler->handle($request);
        $this->endTransaction();

        return $response;
    }
829811
public function addHandler(string $type, RequestHandlerInterface $handler): void
    {
        $this->handlers[$type] = $handler;
    }
1139404
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $method = $this->getOverrideMethod($request);

        if (!empty($method) && $method !== $request->getMethod()) {
            $allowed = $this->getAllowedOverrideMethods($request);

            if (!empty($allowed)) {
                if (in_array($method, $allowed)) {
                    $request = $request->withMethod($method);
                } else {
                    return $this->createResponse(405);
                }
            }
        }

        return $handler->handle($request);
    }
309267
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        try {
            return $this->route($request, $handler);
        } catch (BadRequestException $e) {
            if ($this->http400Handler !== null) {
                return $this->http400Handler->badRequest($e, $request);
            } else {
                throw $e;
            }
        } catch (PageNotFoundException $e) {
            return $handler->handle($request);
        }
    }