You are here

public static function StringHelper::formatPropertyNameList in GraphQL 8

Same name and namespace in other branches
  1. 8.2 src/Utility/StringHelper.php \Drupal\graphql\Utility\StringHelper::formatPropertyNameList()

Formats a list of property names and ensures unambiguousness.

Returns the list in its original order.

Parameters

array $strings: Array of strings to format.

array $others: An array of strings that should be taken into consideration.

Return value

array The list of formatted strings. The list of formatted strings.

4 calls to StringHelper::formatPropertyNameList()
ContentEntityTypeResolver::getEntityTypeFieldMap in src/TypeResolver/ContentEntityTypeResolver.php
Helper function to retrieve the field schema definitions for an entity.
EntitySchemaProvider::getQuerySchema in src/SchemaProvider/EntitySchemaProvider.php
TypedDataTypeResolver::resolveRecursiveComplex in src/TypeResolver/TypedDataTypeResolver.php
Resolves complex data definitions.
ViewsSchemaProvider::getQuerySchema in src/SchemaProvider/ViewsSchemaProvider.php

File

src/Utility/StringHelper.php, line 40

Class

StringHelper
String utilities to help in generting a GraphQL schema.

Namespace

Drupal\graphql\Utility

Code

public static function formatPropertyNameList(array $strings, array $others = []) {
  return array_reduce($strings, function (array $names, $input) use ($others) {
    $formatted = static::formatPropertyName($input);
    $formatted = static::ensureUnambiguousness($formatted, $names + $others);
    return $names + [
      $input => $formatted,
    ];
  }, []);
}