private function parseAttribute(Input $definition, TypeCollection $types, array $attributes): AttributePath
    {
        $definition->expect("{");

        $name = $this->parseAttributeName($definition);
        $type = $this->parseAttributeType($definition) ?? "";

        $definition->expect("}");

        if (in_array($name, $attributes)) {
            throw InvalidRoute::ambiguousAttribute($definition, $name);
        }

        if (!$types->hasNamed($type)) {
            throw InvalidRoute::unknownAttributeType($definition, $name, $type);
        }

        $type = $types->getNamed($type);

        $attributes[] = $name;

        $next = $this->parseRoute($definition, $types, $attributes);

        return new AttributePath($name, $type, $next);
    }
private function parseAttribute(Input $definition, TypeCollection $types, array $attributes): AttributePath
    {
        $definition->expect("{");

        $name = $this->parseAttributeName($definition);
        $type = $this->parseAttributeType($definition) ?? "";

        $definition->expect("}");

        if (in_array($name, $attributes)) {
            throw InvalidRoute::ambiguousAttribute($definition, $name);
        }

        if (!$types->hasNamed($type)) {
            throw InvalidRoute::unknownAttributeType($definition, $name, $type);
        }

        $type = $types->getNamed($type);

        $attributes[] = $name;

        $next = $this->parseRoute($definition, $types, $attributes);

        return new AttributePath($name, $type, $next);
    }
private function parseAttribute ( Input $ definition , TypeCollection $ types , array $ attributes ) : AttributePath { $ definition -> expect ( "{" ) ; $ name = $ this -> parseAttributeName ( $ definition ) ; $ type = $ this -> parseAttributeType ( $ definition ) ?? "" ; $ definition -> expect ( "}" ) ; if ( in_array ( $ name , $ attributes ) ) { throw InvalidRoute :: ambiguousAttribute ( $ definition , $ name ) ; } if ( ! $ types -> hasNamed ( $ type ) ) { throw InvalidRoute :: unknownAttributeType ( $ definition , $ name , $ type ) ; } $ type = $ types -> getNamed ( $ type ) ; $ attributes [ ] = $ name ; $ next = $ this -> parseRoute ( $ definition , $ types , $ attributes ) ; return new AttributePath ( $ name , $ type , $ next ) ; }
Parse a single attribute of the route definition.

@param Input $definition
@param TypeCollection $types
@param string[] $attributes
@return AttributePath
@throws InvalidRoute
@throws UnexpectedChar
Parse a single attribute of the route definition .