GraphQL\Language\Parser::parseOperationDefinition PHP Method

parseOperationDefinition() public method

public parseOperationDefinition ( ) : OperationDefinitionNode
return GraphQL\Language\AST\OperationDefinitionNode
    function parseOperationDefinition()
    {
        $start = $this->lexer->token;
        if ($this->peek(Token::BRACE_L)) {
            return new OperationDefinitionNode(['operation' => 'query', 'name' => null, 'variableDefinitions' => null, 'directives' => [], 'selectionSet' => $this->parseSelectionSet(), 'loc' => $this->loc($start)]);
        }
        $operation = $this->parseOperationType();
        $name = null;
        if ($this->peek(Token::NAME)) {
            $name = $this->parseName();
        }
        return new OperationDefinitionNode(['operation' => $operation, 'name' => $name, 'variableDefinitions' => $this->parseVariableDefinitions(), 'directives' => $this->parseDirectives(), 'selectionSet' => $this->parseSelectionSet(), 'loc' => $this->loc($start)]);
    }