You are here

public static function StringHelper::decorateType in GraphQL 8.3

Decorates a type as non-null and/or as a list.

Parameters

string $type: The type to declare as non-null.

bool $list: Whether to mark the type as a list.

bool $required: Whether to mark the type as required.

Return value

string The decorated type.

File

src/Utility/StringHelper.php, line 94

Class

StringHelper

Namespace

Drupal\graphql\Utility

Code

public static function decorateType($type, $list = FALSE, $required = FALSE) {
  if (!empty($list)) {
    $type = static::listType($type);
  }
  if (!empty($required)) {
    $type = static::nonNullType($type);
  }
  return $type;
}