ASTDefinitionBuilder
in package
Tags
Table of Contents
- $cache : array<string|int, mixed>
- $fieldConfigDecorator : callable|null
- $resolveType : callable
- $typeConfigDecorator : callable|null
- $typeDefinitionsMap : array<string|int, mixed>
- $typeExtensionsMap : array<string|int, mixed>
- __construct() : mixed
- buildDirective() : Directive
- buildEnumValue() : array<string, mixed>
- buildField() : UnnamedFieldDefinitionConfig
- buildInputField() : InputObjectFieldConfig
- buildType() : Type|NamedType
- maybeBuildType() : (\Automattic\WooCommerce\Vendor\GraphQL\Type\Definition\Type&\Automattic\WooCommerce\Vendor\GraphQL\Type\Definition\NamedType)|null
- Calling this method is an equivalent of `typeMap[typeName]` in `graphql-js`.
- buildWrappedType() : Type
- getDeprecationReason() : string|null
- Given a collection of directives, returns the string value for the deprecation reason.
- internalBuildType() : Type|NamedType
- makeEnumDef() : EnumType
- makeFieldDefMap() : array<string|int, mixed>
- makeImplementedInterfaces() : array<int, InterfaceType>
- makeInputFields() : array<string, UnnamedInputObjectFieldConfig>
- makeInputObjectDef() : InputObjectType
- makeInputValues() : array<string, UnnamedInputObjectFieldConfig>
- makeInterfaceDef() : InterfaceType
- makeScalarDef() : CustomScalarType
- makeSchemaDef() : CustomScalarType|EnumType|InputObjectType|InterfaceType|ObjectType|UnionType
- makeSchemaDefFromConfig() : CustomScalarType|EnumType|InputObjectType|InterfaceType|ObjectType|UnionType
- makeTypeDef() : ObjectType
- makeUnionDef() : UnionType
Properties
$cache
private
array<string|int, mixed>
$cache
$fieldConfigDecorator
private
callable|null
$fieldConfigDecorator
Tags
$resolveType
private
callable
$resolveType
Tags
$typeConfigDecorator
private
callable|null
$typeConfigDecorator
Tags
$typeDefinitionsMap
private
array<string|int, mixed>
$typeDefinitionsMap
$typeExtensionsMap
private
array<string|int, mixed>
$typeExtensionsMap
Methods
__construct()
public
__construct(array<string, \Automattic\WooCommerce\Vendor\GraphQL\Language\AST\Node&\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\TypeDefinitionNode> $typeDefinitionsMap, array<string, array<int, \Automattic\WooCommerce\Vendor\GraphQL\Language\AST\Node&\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\TypeExtensionNode>> $typeExtensionsMap, callable $resolveType[, callable|null $typeConfigDecorator = null ][, callable|null $fieldConfigDecorator = null ]) : mixed
Parameters
- $typeDefinitionsMap : array<string, \Automattic\WooCommerce\Vendor\GraphQL\Language\AST\Node&\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\TypeDefinitionNode>
- $typeExtensionsMap : array<string, array<int, \Automattic\WooCommerce\Vendor\GraphQL\Language\AST\Node&\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\TypeExtensionNode>>
- $resolveType : callable
- $typeConfigDecorator : callable|null = null
- $fieldConfigDecorator : callable|null = null
Tags
Return values
mixed —buildDirective()
public
buildDirective(DirectiveDefinitionNode $directiveNode) : Directive
Parameters
- $directiveNode : DirectiveDefinitionNode
Tags
Return values
Directive —buildEnumValue()
public
buildEnumValue(EnumValueDefinitionNode $value) : array<string, mixed>
Parameters
- $value : EnumValueDefinitionNode
Tags
Return values
array<string, mixed> —buildField()
public
buildField(FieldDefinitionNode $field, ObjectTypeDefinitionNode|ObjectTypeExtensionNode|InterfaceTypeDefinitionNode|InterfaceTypeExtensionNode $node) : UnnamedFieldDefinitionConfig
Parameters
- $field : FieldDefinitionNode
- $node : ObjectTypeDefinitionNode|ObjectTypeExtensionNode|InterfaceTypeDefinitionNode|InterfaceTypeExtensionNode
Tags
Return values
UnnamedFieldDefinitionConfig —buildInputField()
public
buildInputField(InputValueDefinitionNode $value) : InputObjectFieldConfig
Parameters
- $value : InputValueDefinitionNode
Tags
Return values
InputObjectFieldConfig —buildType()
public
buildType(string|(\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\Node&\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\NamedTypeNode)|(\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\Node&\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\TypeDefinitionNode) $ref) : Type|NamedType
Parameters
- $ref : string|(\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\Node&\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\NamedTypeNode)|(\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\Node&\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\TypeDefinitionNode)
Tags
Return values
Type|NamedType —maybeBuildType()
Calling this method is an equivalent of `typeMap[typeName]` in `graphql-js`.
public
maybeBuildType(string $name) : (\Automattic\WooCommerce\Vendor\GraphQL\Type\Definition\Type&\Automattic\WooCommerce\Vendor\GraphQL\Type\Definition\NamedType)|null
It is legal to access a type from the map of already-built types that doesn't exist in the map. Since we build types lazily, and we don't have a such map of built types, this method provides a way to build a type that may not exist in the SDL definitions and returns null instead.
Parameters
- $name : string
Tags
Return values
(\Automattic\WooCommerce\Vendor\GraphQL\Type\Definition\Type&\Automattic\WooCommerce\Vendor\GraphQL\Type\Definition\NamedType)|null —buildWrappedType()
private
buildWrappedType(ListTypeNode|NonNullTypeNode|NamedTypeNode $typeNode) : Type
Parameters
- $typeNode : ListTypeNode|NonNullTypeNode|NamedTypeNode
Tags
Return values
Type —getDeprecationReason()
Given a collection of directives, returns the string value for the deprecation reason.
private
getDeprecationReason(EnumValueDefinitionNode|FieldDefinitionNode|InputValueDefinitionNode $node) : string|null
Parameters
Tags
Return values
string|null —internalBuildType()
private
internalBuildType(string $typeName[, (\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\Node&\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\NamedTypeNode)|(\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\Node&\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\TypeDefinitionNode)|null $typeNode = null ]) : Type|NamedType
Parameters
- $typeName : string
- $typeNode : (\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\Node&\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\NamedTypeNode)|(\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\Node&\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\TypeDefinitionNode)|null = null
Tags
Return values
Type|NamedType —makeEnumDef()
private
makeEnumDef(EnumTypeDefinitionNode $def) : EnumType
Parameters
- $def : EnumTypeDefinitionNode
Tags
Return values
EnumType —makeFieldDefMap()
private
makeFieldDefMap(array<string|int, \Automattic\WooCommerce\Vendor\GraphQL\Language\AST\ObjectTypeDefinitionNode|\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\ObjectTypeExtensionNode|\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\InterfaceTypeDefinitionNode|\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\InterfaceTypeExtensionNode> $nodes) : array<string|int, mixed>
Parameters
- $nodes : array<string|int, \Automattic\WooCommerce\Vendor\GraphQL\Language\AST\ObjectTypeDefinitionNode|\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\ObjectTypeExtensionNode|\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\InterfaceTypeDefinitionNode|\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\InterfaceTypeExtensionNode>
Tags
Return values
array<string|int, mixed> —makeImplementedInterfaces()
private
makeImplementedInterfaces(array<string|int, \Automattic\WooCommerce\Vendor\GraphQL\Language\AST\ObjectTypeDefinitionNode|\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\ObjectTypeExtensionNode|\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\InterfaceTypeDefinitionNode|\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\InterfaceTypeExtensionNode> $nodes) : array<int, InterfaceType>
Parameters
- $nodes : array<string|int, \Automattic\WooCommerce\Vendor\GraphQL\Language\AST\ObjectTypeDefinitionNode|\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\ObjectTypeExtensionNode|\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\InterfaceTypeDefinitionNode|\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\InterfaceTypeExtensionNode>
Tags
Return values
array<int, InterfaceType> —makeInputFields()
private
makeInputFields(array<string|int, \Automattic\WooCommerce\Vendor\GraphQL\Language\AST\InputObjectTypeDefinitionNode|\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\InputObjectTypeExtensionNode> $nodes) : array<string, UnnamedInputObjectFieldConfig>
Parameters
- $nodes : array<string|int, \Automattic\WooCommerce\Vendor\GraphQL\Language\AST\InputObjectTypeDefinitionNode|\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\InputObjectTypeExtensionNode>
Tags
Return values
array<string, UnnamedInputObjectFieldConfig> —makeInputObjectDef()
private
makeInputObjectDef(InputObjectTypeDefinitionNode $def) : InputObjectType
Parameters
Tags
Return values
InputObjectType —makeInputValues()
private
makeInputValues(NodeList<string|int, InputValueDefinitionNode> $values) : array<string, UnnamedInputObjectFieldConfig>
Parameters
- $values : NodeList<string|int, InputValueDefinitionNode>
Tags
Return values
array<string, UnnamedInputObjectFieldConfig> —makeInterfaceDef()
private
makeInterfaceDef(InterfaceTypeDefinitionNode $def) : InterfaceType
Parameters
- $def : InterfaceTypeDefinitionNode
Tags
Return values
InterfaceType —makeScalarDef()
private
makeScalarDef(ScalarTypeDefinitionNode $def) : CustomScalarType
Parameters
- $def : ScalarTypeDefinitionNode
Tags
Return values
CustomScalarType —makeSchemaDef()
private
makeSchemaDef(TypeDefinitionNode|Node $def) : CustomScalarType|EnumType|InputObjectType|InterfaceType|ObjectType|UnionType
Parameters
- $def : TypeDefinitionNode|Node
Tags
Return values
CustomScalarType|EnumType|InputObjectType|InterfaceType|ObjectType|UnionType —makeSchemaDefFromConfig()
private
makeSchemaDefFromConfig(Node $def, array<string, mixed> $config) : CustomScalarType|EnumType|InputObjectType|InterfaceType|ObjectType|UnionType
Parameters
- $def : Node
- $config : array<string, mixed>
Tags
Return values
CustomScalarType|EnumType|InputObjectType|InterfaceType|ObjectType|UnionType —makeTypeDef()
private
makeTypeDef(ObjectTypeDefinitionNode $def) : ObjectType
Parameters
- $def : ObjectTypeDefinitionNode
Tags
Return values
ObjectType —makeUnionDef()
private
makeUnionDef(UnionTypeDefinitionNode $def) : UnionType
Parameters
- $def : UnionTypeDefinitionNode
