Automattic\WooCommerce\Vendor\GraphQL\Language
Parser::parseOperationDefinition
Method of the class: Parser{}
No Hooks.
Returns
null. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->parseOperationDefinition(): OperationDefinitionNode;
Parser::parseOperationDefinition() Parser::parseOperationDefinition code WC 11.0.1
private function parseOperationDefinition(): OperationDefinitionNode
{
$start = $this->lexer->token;
if ($this->peek(Token::BRACE_L)) {
return new OperationDefinitionNode([
'name' => null,
'operation' => 'query',
'variableDefinitions' => new NodeList([]),
'directives' => new NodeList([]),
'selectionSet' => $this->parseSelectionSet(),
'loc' => $this->loc($start),
]);
}
$operation = $this->parseOperationType();
$name = null;
if ($this->peek(Token::NAME)) {
$name = $this->parseName();
}
return new OperationDefinitionNode([
'name' => $name,
'operation' => $operation,
'variableDefinitions' => $this->parseVariableDefinitions(),
'directives' => $this->parseDirectives(false),
'selectionSet' => $this->parseSelectionSet(),
'loc' => $this->loc($start),
]);
}