Automattic\WooCommerce\Vendor\GraphQL\Type\Definition
QueryPlan::analyzeQueryPlan
Method of the class: QueryPlan{}
No Hooks.
Returns
null. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->analyzeQueryPlan( $parentType, $fieldNodes ): void;
- $parentType(ObjectType) (required)
- .
- $fieldNodes(iterable
) (required) - .
QueryPlan::analyzeQueryPlan() QueryPlan::analyzeQueryPlan code WC 10.9.4
private function analyzeQueryPlan(ObjectType $parentType, iterable $fieldNodes): void
{
$queryPlan = [];
$implementors = [];
foreach ($fieldNodes as $fieldNode) {
if ($fieldNode->selectionSet === null) {
continue;
}
$type = Type::getNamedType(
$parentType->getField($fieldNode->name->value)->getType()
);
$subfields = $this->analyzeSelectionSet($fieldNode->selectionSet, $type, $implementors);
$queryPlan = $this->arrayMergeDeep($queryPlan, $subfields);
}
if ($this->groupImplementorFields) {
$this->queryPlan = ['fields' => $queryPlan];
if ($implementors !== []) {
$this->queryPlan['implementors'] = $implementors;
}
} else {
$this->queryPlan = $queryPlan;
}
}