You are here

public static function DocumentSerializer::sanitizeRecursive in GraphQL 8.4

Recursively turn AST items into a serializable array.

Parameters

array $item:

Return value

array

1 call to DocumentSerializer::sanitizeRecursive()
DocumentSerializer::serializeDocument in src/GraphQL/Utility/DocumentSerializer.php
Turn the AST document to a serializable array.

File

src/GraphQL/Utility/DocumentSerializer.php, line 31

Class

DocumentSerializer
Cleans up AST recursively for serialization.

Namespace

Drupal\graphql\GraphQL\Utility

Code

public static function sanitizeRecursive(array $item) {
  unset($item['loc']);
  foreach ($item as &$value) {
    if (is_array($value)) {
      $value = static::sanitizeRecursive($value);
    }
  }
  return $item;
}