private function compileVariableNode(AstNode $astNode): RouteVariable
    {
        $rules = [];

        foreach ($astNode->children as $childAstNode) {
            if ($childAstNode->type !== AstNodeTypes::VARIABLE_RULE) {
                throw new InvalidArgumentException("Unexpected node type {$childAstNode->type}");
            }

            $ruleParams = $childAstNode->hasChildren() ? $childAstNode->children[0]->value : [];
            $rules[] = $this->ruleFactory->createRule($childAstNode->value, $ruleParams);
        }

        return new RouteVariable($astNode->value, $rules);
    }
private function compileVariableNode(AstNode $astNode): RouteVariable
    {
        $rules = [];

        foreach ($astNode->children as $childAstNode) {
            if ($childAstNode->type !== AstNodeTypes::VARIABLE_RULE) {
                throw new InvalidArgumentException("Unexpected node type {$childAstNode->type}");
            }

            $ruleParams = $childAstNode->hasChildren() ? $childAstNode->children[0]->value : [];
            $rules[] = $this->ruleFactory->createRule($childAstNode->value, $ruleParams);
        }

        return new RouteVariable($astNode->value, $rules);
    }
private function compileVariableNode ( AstNode $ astNode ) : RouteVariable { $ rules = [ ] ; foreach ( $ astNode -> children as $ childAstNode ) { if ( $ childAstNode -> type !== AstNodeTypes :: VARIABLE_RULE ) { throw new InvalidArgumentException ( "Unexpected node type {$childAstNode->type}" ) ; } $ ruleParams = $ childAstNode -> hasChildren ( ) ? $ childAstNode -> children [ 0 ] -> value : [ ] ; $ rules [ ] = $ this -> ruleFactory -> createRule ( $ childAstNode -> value , $ ruleParams ) ; } return new RouteVariable ( $ astNode -> value , $ rules ) ; }
Compiles a variable node

@param AstNode $astNode The variable node to compile
@return RouteVariable The created route variable
Compiles a variable node