PHP Class GraphQL\Executor\Values

显示文件 Open project: webonyx/graphql-php Class Usage Examples

Public Methods

Method Description
getArgumentValues ( FieldDefinition | Directive $def, FieldNode | DirectiveNode $node, $variableValues ) : array Prepares an object map of argument values given a list of argument definitions and list of argument AST nodes.
getVariableValues ( Schema $schema, VariableDefinitionNode[] $definitionNodes, array $inputs ) : array Prepares an object map of variables of the correct type based on the provided variable definitions and arbitrary input. If the input cannot be coerced to match the variable definitions, a Error will be thrown.
valueFromAST ( $valueNode, GraphQL\Type\Definition\InputType $type, null $variables = null ) : array | null | stdClass

Private Methods

Method Description
coerceValue ( Type $type, $value ) Given a type and any value, return a runtime value coerced to match the type.
isValidPHPValue ( $value, GraphQL\Type\Definition\InputType $type ) : array Given a PHP value and a GraphQL type, determine if the value will be accepted for that type. This is primarily useful for validating the runtime values of query variables.

Method Details

getArgumentValues() public static method

Prepares an object map of argument values given a list of argument definitions and list of argument AST nodes.
public static getArgumentValues ( FieldDefinition | Directive $def, FieldNode | DirectiveNode $node, $variableValues ) : array
$def GraphQL\Type\Definition\FieldDefinition | GraphQL\Type\Definition\Directive
$node GraphQL\Language\AST\FieldNode | GraphQL\Language\AST\DirectiveNode
$variableValues
return array

getVariableValues() public static method

Prepares an object map of variables of the correct type based on the provided variable definitions and arbitrary input. If the input cannot be coerced to match the variable definitions, a Error will be thrown.
public static getVariableValues ( Schema $schema, VariableDefinitionNode[] $definitionNodes, array $inputs ) : array
$schema GraphQL\Schema
$definitionNodes GraphQL\Language\AST\VariableDefinitionNode[]
$inputs array
return array

valueFromAST() public static method

Deprecation: as of 8.0 (Moved to Utils\AST::valueFromAST)
public static valueFromAST ( $valueNode, GraphQL\Type\Definition\InputType $type, null $variables = null ) : array | null | stdClass
$valueNode
$type GraphQL\Type\Definition\InputType
$variables null
return array | null | stdClass