src/Router/RouterMiddleware.php
public function process(ServerRequestInterface $request, RequestHandlerInterface $requestHandler): ResponseInterface
    {
        $route = $this->router->match($request);

        if (null === $route) {
            return $requestHandler->handle($request);
        }

        $request = $request->withAttribute(Route::class, $route);

        foreach ($route->getParams() as $label => $value) {
            $request = $request->withAttribute($label, $value);
        }

        return $requestHandler->handle($request);
    }
public function process(ServerRequestInterface $request, RequestHandlerInterface $requestHandler): ResponseInterface
    {
        $route = $this->router->match($request);

        if (null === $route) {
            return $requestHandler->handle($request);
        }

        $request = $request->withAttribute(Route::class, $route);

        foreach ($route->getParams() as $label => $value) {
            $request = $request->withAttribute($label, $value);
        }

        return $requestHandler->handle($request);
    }
Process an incoming server request and return a response, optionally delegating
to the next middleware component to create the response.

@param ServerRequestInterface  $request
@param RequestHandlerInterface $requestHandler

@return ResponseInterface