Automattic\WooCommerce\Internal\Api
QueryCache::parse
Parse a query and return the DocumentNode, or a GraphQL-shaped error array if the query has a syntax error.
Метод класса: QueryCache{}
Хуков нет.
Возвращает
DocumentNode|Массив.
Использование
// private - только в коде основоного (родительского) класса $result = $this->parse( $query );
- $query(строка) (обязательный)
- The GraphQL query string.
Код QueryCache::parse() QueryCache::parse WC 11.0.1
private function parse( string $query ) {
try {
return Parser::parse( $query, array( 'noLocation' => true ) );
} catch ( \Automattic\WooCommerce\Vendor\GraphQL\Error\SyntaxError $e ) {
return $this->error_response( 'GraphQL syntax error: ' . $e->getMessage(), 'GRAPHQL_PARSE_ERROR' );
}
}