Automattic\WooCommerce\Vendor\GraphQL\Language\AST
Node::recursiveToArray
Method of the class: Node{}
No Hooks.
Returns
Array
Usage
$result = Node::recursiveToArray( $node ): array;
- $node(Node) (required)
- .
Node::recursiveToArray() Node::recursiveToArray code WC 10.9.4
private static function recursiveToArray(Node $node): array
{
$result = [];
foreach (get_object_vars($node) as $prop => $propValue) {
if ($propValue === null) {
continue;
}
if ($propValue instanceof NodeList) {
$converted = [];
foreach ($propValue as $item) {
$converted[] = self::recursiveToArray($item);
}
} elseif ($propValue instanceof Node) {
$converted = self::recursiveToArray($propValue);
} elseif ($propValue instanceof Location) {
$converted = $propValue->toArray();
} else {
$converted = $propValue;
}
$result[$prop] = $converted;
}
return $result;
}