private function modifyRequestAttributes(RouteMatchInterface $routeMatch, ServerRequestInterface $request): ServerRequestInterface
    {
        if ($routeMatch->isMethodFailure() === true) {
            return $request
                ->withAttribute('actionName', self::METHOD_NOT_ALLOWED_ACTION)
                ->withAttribute('allowedMethods', $routeMatch->getAllowedMethods());
        }

        if ($routeMatch->isFailure() === true) {
            return $request->withAttribute('actionName', self::ROUTE_NOT_FOUND_ACTION);
        }

        return $request
            ->withAttribute('actionName', $routeMatch->getAction())
            ->withAttribute('parameters', $routeMatch->getParameters());
    }
private function modifyRequestAttributes(RouteMatchInterface $routeMatch, ServerRequestInterface $request): ServerRequestInterface
    {
        if ($routeMatch->isMethodFailure() === true) {
            return $request
                ->withAttribute('actionName', self::METHOD_NOT_ALLOWED_ACTION)
                ->withAttribute('allowedMethods', $routeMatch->getAllowedMethods());
        }

        if ($routeMatch->isFailure() === true) {
            return $request->withAttribute('actionName', self::ROUTE_NOT_FOUND_ACTION);
        }

        return $request
            ->withAttribute('actionName', $routeMatch->getAction())
            ->withAttribute('parameters', $routeMatch->getParameters());
    }
private function modifyRequestAttributes ( RouteMatchInterface $ routeMatch , ServerRequestInterface $ request ) : ServerRequestInterface { if ( $ routeMatch -> isMethodFailure ( ) === true ) { return $ request -> withAttribute ( 'actionName' , self :: METHOD_NOT_ALLOWED_ACTION ) -> withAttribute ( 'allowedMethods' , $ routeMatch -> getAllowedMethods ( ) ) ; } if ( $ routeMatch -> isFailure ( ) === true ) { return $ request -> withAttribute ( 'actionName' , self :: ROUTE_NOT_FOUND_ACTION ) ; } return $ request -> withAttribute ( 'actionName' , $ routeMatch -> getAction ( ) ) -> withAttribute ( 'parameters' , $ routeMatch -> getParameters ( ) ) ; }
Modify the request and add information from the matched route to it.

@param RouteMatchInterface $routeMatch
@param ServerRequestInterface $request

@return ServerRequestInterface
Modify the request and add information from the matched route to it .