code: private function addNamedRoute($name, $httpMethod, $route, $handler)
      {
          if (! ($this->dataGenerator instanceof NamedDataGeneratorInterface)) {
              throw new \RuntimeException('The injected generator does not support named routes');
          }
  
          $routeData = $this->routeParser->parse($route);
  
          foreach ($routeData as $routeDatum) {
              $this->dataGenerator->addNamedRoute($name, $httpMethod, $routeDatum, $handler);
          }
      }
docs: Add a named route to the collection
  
  @param string $name
  @param string $httpMethod
  @param string $route
  @param mixed  $handler
  
  @throws \RuntimeException