src/Service.php
protected function dispatchRouterRoute(
        ServerRequestInterface $request,
        RouterInterface $router
    ) : ServerRequestInterface {
        $routeInfo = $router->dispatch($request);
        if ($routeInfo[0] === Dispatcher::FOUND) {
            $routeArguments = [];
            foreach ($routeInfo[2] as $k => $v) {
                $routeArguments[$k] = urldecode($v);
            }

            $route = $router->getRouteByIdentifier($routeInfo[1]);
            $route->prepare($request, $routeArguments);
            /**
             * Add route to request to allow handler or other access route
             */
            $request = $request->withAttribute('route', $route);
        }

        $routeInfo['request'] = [$request->getMethod(), (string) $request->getUri()];
        return $request->withAttribute('routeInfo', $routeInfo);
    }
protected function dispatchRouterRoute(
        ServerRequestInterface $request,
        RouterInterface $router
    ) : ServerRequestInterface {
        $routeInfo = $router->dispatch($request);
        if ($routeInfo[0] === Dispatcher::FOUND) {
            $routeArguments = [];
            foreach ($routeInfo[2] as $k => $v) {
                $routeArguments[$k] = urldecode($v);
            }

            $route = $router->getRouteByIdentifier($routeInfo[1]);
            $route->prepare($request, $routeArguments);
            /**
             * Add route to request to allow handler or other access route
             */
            $request = $request->withAttribute('route', $route);
        }

        $routeInfo['request'] = [$request->getMethod(), (string) $request->getUri()];
        return $request->withAttribute('routeInfo', $routeInfo);
    }
protected function dispatchRouterRoute ( ServerRequestInterface $ request , RouterInterface $ router ) : ServerRequestInterface { $ routeInfo = $ router -> dispatch ( $ request ) ; if ( $ routeInfo [ 0 ] === Dispatcher :: FOUND ) { $ routeArguments = [ ] ; foreach ( $ routeInfo [ 2 ] as $ k => $ v ) { $ routeArguments [ $ k ] = urldecode ( $ v ) ; } $ route = $ router -> getRouteByIdentifier ( $ routeInfo [ 1 ] ) ; $ route -> prepare ( $ request , $ routeArguments ) ; /**
             * Add route to request to allow handler or other access route
             */ $ request = $ request -> withAttribute ( 'route' , $ route ) ; } $ routeInfo [ 'request' ] = [ $ request -> getMethod ( ) , ( string ) $ request -> getUri ( ) ] ; return $ request -> withAttribute ( 'routeInfo' , $ routeInfo ) ; }
Dispatch the router to find the route. Prepare the route for use.

@param ServerRequestInterface $request
@param RouterInterface        $router
@return ServerRequestInterface
Dispatch the router to find the route . Prepare the route for use .