private static function getGraphqlEnum(GQL\Enum $enumAnnotation, array $classAnnotations, array $constants)
    {
        $enumValues = $enumAnnotation->values ? $enumAnnotation->values : [];

        $values = [];

        foreach ($constants as $name => $value) {
            $valueAnnotation = \current(\array_filter($enumValues, function ($enumValueAnnotation) use ($name) {
                return $enumValueAnnotation->name == $name;
            }));
            $valueConfig = [];
            $valueConfig['value'] = $value;

            if ($valueAnnotation && $valueAnnotation->description) {
                $valueConfig['description'] = $valueAnnotation->description;
            }

            if ($valueAnnotation && $valueAnnotation->deprecationReason) {
                $valueConfig['deprecationReason'] = $valueAnnotation->deprecationReason;
            }

            $values[$name] = $valueConfig;
        }

        $enumConfiguration = ['values' => $values];
        $enumConfiguration = self::getDescriptionConfiguration($classAnnotations) + $enumConfiguration;

        return ['type' => 'enum', 'config' => $enumConfiguration];
    }
private static function getGraphqlEnum(GQL\Enum $enumAnnotation, array $classAnnotations, array $constants)
    {
        $enumValues = $enumAnnotation->values ? $enumAnnotation->values : [];

        $values = [];

        foreach ($constants as $name => $value) {
            $valueAnnotation = \current(\array_filter($enumValues, function ($enumValueAnnotation) use ($name) {
                return $enumValueAnnotation->name == $name;
            }));
            $valueConfig = [];
            $valueConfig['value'] = $value;

            if ($valueAnnotation && $valueAnnotation->description) {
                $valueConfig['description'] = $valueAnnotation->description;
            }

            if ($valueAnnotation && $valueAnnotation->deprecationReason) {
                $valueConfig['deprecationReason'] = $valueAnnotation->deprecationReason;
            }

            $values[$name] = $valueConfig;
        }

        $enumConfiguration = ['values' => $values];
        $enumConfiguration = self::getDescriptionConfiguration($classAnnotations) + $enumConfiguration;

        return ['type' => 'enum', 'config' => $enumConfiguration];
    }
private static function getGraphqlEnum ( GQL \ Enum $ enumAnnotation , array $ classAnnotations , array $ constants ) { $ enumValues = $ enumAnnotation -> values ? $ enumAnnotation -> values : [ ] ; $ values = [ ] ; foreach ( $ constants as $ name => $ value ) { $ valueAnnotation = \ current ( \ array_filter ( $ enumValues , function ( $ enumValueAnnotation ) use ( $ name ) { return $ enumValueAnnotation -> name == $ name ; } ) ) ; $ valueConfig = [ ] ; $ valueConfig [ 'value' ] = $ value ; if ( $ valueAnnotation && $ valueAnnotation -> description ) { $ valueConfig [ 'description' ] = $ valueAnnotation -> description ; } if ( $ valueAnnotation && $ valueAnnotation -> deprecationReason ) { $ valueConfig [ 'deprecationReason' ] = $ valueAnnotation -> deprecationReason ; } $ values [ $ name ] = $ valueConfig ; } $ enumConfiguration = [ 'values' => $ values ] ; $ enumConfiguration = self :: getDescriptionConfiguration ( $ classAnnotations ) + $ enumConfiguration ; return [ 'type' => 'enum' , 'config' => $ enumConfiguration ] ; }
Get a Graphql Enum configuration from given enum annotation.

@param string   $shortClassName
@param GQL\Enum $enumAnnotation
@param array    $classAnnotations
@param array    $constants

@return array
Get a Graphql Enum configuration from given enum annotation .