Automattic\WooCommerce\Vendor\GraphQL\Language
Parser::parseFragment
Method of the class: Parser{}
No Hooks.
Returns
FragmentSpreadNode|InlineFragmentNode.
Usage
// private - for code of main (parent) class only $result = $this->parseFragment(): SelectionNode;
Parser::parseFragment() Parser::parseFragment code WC 11.0.1
private function parseFragment(): SelectionNode
{
$start = $this->lexer->token;
$this->expect(Token::SPREAD);
$hasTypeCondition = $this->expectOptionalKeyword('on');
if (! $hasTypeCondition && $this->peek(Token::NAME)) {
return new FragmentSpreadNode([
'name' => $this->parseFragmentName(),
'directives' => $this->parseDirectives(false),
'loc' => $this->loc($start),
]);
}
return new InlineFragmentNode([
'typeCondition' => $hasTypeCondition ? $this->parseNamedType() : null,
'directives' => $this->parseDirectives(false),
'selectionSet' => $this->parseSelectionSet(),
'loc' => $this->loc($start),
]);
}