Numbers.php in GraphQL 8.3
File
tests/modules/graphql_enum_test/src/Plugin/GraphQL/Enums/Numbers.php
View source
<?php
namespace Drupal\graphql_enum_test\Plugin\GraphQL\Enums;
use Drupal\graphql\Plugin\GraphQL\Enums\EnumPluginBase;
use Drupal\graphql\Plugin\SchemaBuilder;
class Numbers extends EnumPluginBase {
public static $NUMBERS = [
'zero',
'one',
'two',
'three',
'four',
'five',
'six',
'seven',
'eight',
'nine',
];
public function buildEnumValues($definition) {
$values = [];
foreach (static::$NUMBERS as $num => $word) {
$values[strtoupper($word)] = [
'value' => $num,
'description' => ucfirst($word),
];
}
return $values;
}
}
Classes
Name |
Description |
Numbers |
Generates an enumeration of numbers. |