final protected function getPathImpl()

in src/uri-patterns/UriBuilderBase.php [30:62]


  final protected function getPathImpl(): string {
    $uri = '';
    foreach ($this->parts as $part) {
      if ($part is UriPatternLiteral) {
        $uri .= $part->getValue();
        continue;
      }

      invariant(
        $part is RequestParameter,
        'expecting all UriPatternParts to be literals or parameters, got %s',
        \get_class($part),
      );

      if ($uri === '') {
        $uri = '/';
      }

      $name = $part->getName();
      invariant(
        $this->values->containsKey($name),
        'Parameter "%s" must be set',
        $name,
      );
      $uri .= $this->values->at($name);
    }
    invariant(
      \substr($uri, 0, 1) === '/',
      "Path '%s' does not start with '/'",
      $uri,
    );
    return $uri;
  }