@param RequestHandlerInterface $requestHandler

@return callable
431292
private function createRequestHandler(RequestHandlerInterface $requestHandler)
    {
        return function (ReactRequest $reactRequest,  ReactResponse $reactResponse) use ($requestHandler) {
            $request = $this->messageTransformer->transform($reactRequest);
            $response = $requestHandler->handle($request);
            $this->messageTransformer->reverseTransform($response, $reactResponse);

            $requestHandler->finish($request, $response);

        };
    }
1099452
public function pushHandler($handler)
    {
        if (is_callable($handler)) {
            $handler = new CallbackHandler($handler);
        }

        if (!$handler instanceof HandlerInterface) {
            throw new InvalidArgumentException(
                  "Argument to " . __METHOD__ . " must be a callable, or instance of "
                . "Whoops\\Handler\\HandlerInterface"
            );
        }

        $this->handlerStack[] = $handler;
        return $this;
    }
253031
public function getRequestHandler()
    {
        if (isset($this->requestHandler))
            return $this->requestHandler;

        // now instantiating handler from config
        $handlerClass = "\\" . ltrim($this->handlerClass, "\\");
        if (!class_exists($handlerClass))
            throw new RuntimeException("Unable to create HTTP Handler instance with class: " . var_export($handlerClass, true));

        $this->requestHandler = new $handlerClass();
        return $this->requestHandler;
    }
177965
public function to($messageHandler): SingleHandlerRouter
    {
        if (! \is_string($messageHandler) && ! \is_object($messageHandler) && ! \is_callable($messageHandler)) {
            throw new Exception\InvalidArgumentException(\sprintf(
                'Invalid message handler provided. Expected type is string, object or callable but type of %s given.',
                \gettype($messageHandler)
            ));
        }

        if (null === $this->tmpMessageName) {
            throw new Exception\RuntimeException(\sprintf(
                'Cannot map handler %s to a message. Please use method route before calling method to',
                \is_object($messageHandler)
                    ? \get_class($messageHandler)
                    : (\is_string($messageHandler) ? $messageHandler : \gettype($messageHandler))
            ));
        }

        $this->messageMap[$this->tmpMessageName] = $messageHandler;

        $this->tmpMessageName = null;

        return $this;
    }
198527
public function createExecutor($requestHandler)
    {
        if (is_callable($requestHandler)) {
            $requestHandler = new CallbackRequestHandler($requestHandler);
        } elseif (!$requestHandler instanceof RequestHandlerInterface) {
            throw new \InvalidArgumentException(sprintf(
                'Expected argument of type "RequestHandlerInterface" or "callable", "%s" given',
                is_object($requestHandler) ? get_class($requestHandler) : gettype($requestHandler))
            );
        }

        $executor = new Executor($this->getServer(), $requestHandler, $this->getExceptionHandler());
        $executor->setLogger($this->getLogger());

        return $executor;
    }
8534
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
       if($this->detector->isMobile()){
           $request->withAttribute('client-isMobile', TRUE);
       }
       if($this->detector->isTablet()){
           $request->withAttribute('client-isTablet', TRUE);
       }
       if($this->detector->isiOS()){
           $request->withAttribute('client-isiOS', TRUE);
       }
       if($this->detector->isiAndroidOS()){
           $request->withAttribute('client-isAndroidOS', TRUE);
       }

        return($handler->handle($request));
        
    }
330665
protected function getHandler(ServletRequestInterface $servletRequest)
    {
        foreach ($this->handlerMappings as $handlerMapping) {
            $handler = $handlerMapping->getHandler($servletRequest);
            if ($handler != null) {
                return $handler;
            }
        }
        return null;
    }
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)
        );
    }
1012298
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        try {
            try {
                return $handler->handle($request);
            } catch (HttpException $exception) {
                $original_exception = $exception;

                return $this->httpExceptionResponse($request, $exception);
            } catch (Throwable $exception) {
                $original_exception = $exception;

                return $this->unhandledExceptionResponse($request, $exception);
            }
        } catch (Throwable $exception) {
            // If we can't handle the exception, rethrow it.
            throw $original_exception;
        }
    }
1016481
public function process(RequestInterface $request, HandlerInterface $handler)
    {
        $this->stack[] = new LastMiddleware($handler);

        $response = $this->dispatch($request);

        unset($this->stack[count($this->stack) - 1]);

        return $response;
    }
264229
public static function requestBuilder(callable $serializer)
    {
        return function (callable $handler) use ($serializer) {
            return function (CommandInterface $command) use ($serializer, $handler) {
                return $handler($command, $serializer($command));
            };
        };
    }
233054
public function process(RequestInterface $request, RequestHandlerInterface $handler)
    {
        $response = $handler->handle($request);

        $response->body()->write('World!');

        return $response;
    }
813177
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $route = $request->getAttribute('_route');
        if( ! $route || ! ($handler instanceof \Sherpa\Kernel\RequestHandler\RequestHandler) ) {
            return $handler->handle($request);
        }
        foreach($route->getMiddlewares() as $m) {
            $handler->getMiddlewareGroup()->addMiddleware($m['middleware'], $m['priority'], $m['before']);
        }

        return $handler->handle($request);
    }
384662
public function createQueryHandler(
        QueryHandlerConfigurationInterface $queryHandlerConfiguration
    ): QueryHandlerInterface {
        return new DoctrineQueryHandler($this->filterTypeRegistry, $queryHandlerConfiguration, $this->doctrine);
    }
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;
    }
712379
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        return $this->pipeline->withRequest($request, function () use ($request, $handler): ResponseInterface {
            return $handler->handle($request);
        });
    }
810773
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $uri = $request->getUri();
        $language = $this->detectFromPath($uri->getPath());

        if ($language === null) {
            $accept = $request->getHeaderLine('Accept-Language');
            $language = $this->getBest($accept, $this->languages);

            if (empty($language)) {
                $language = $this->languages[0] ?? '';
            }

            if ($this->redirect && $this->usePath) {
                $location = $uri->withPath(str_replace('//', '/', $language.'/'.$uri->getPath()));

                return Factory::response(302, null, [
                    'Location' => (string) $location
                ]);
            }
        }

        $response = $handler->handle($request->withHeader('Accept-Language', $language));

        if (!$response->hasHeader('Content-Language')) {
            return $response->withHeader('Content-Language', $language);
        }

        return $response;
    }