class TypeDef extends AbstractObject implements IdAble

A definition of a parameter or return type in a Module.

Properties

$lastQuery from  AbstractObject

Methods

__construct(AbstractClient $client, QueryBuilderChain $queryBuilderChain)

No description

null|array|string|int|float|bool
queryLeaf(QueryBuilder $leafQueryBuilder, string $leafKey)

No description

asEnum()

If kind is ENUM, the enum-specific type definition. If kind is not ENUM, this will be null.

asInput()

If kind is INPUT, the input-specific type definition. If kind is not INPUT, this will be null.

asInterface()

If kind is INTERFACE, the interface-specific type definition. If kind is not INTERFACE, this will be null.

asList()

If kind is LIST, the list-specific type definition. If kind is not LIST, this will be null.

asObject()

If kind is OBJECT, the object-specific type definition. If kind is not OBJECT, this will be null.

asScalar()

If kind is SCALAR, the scalar-specific type definition. If kind is not SCALAR, this will be null.

id()

A unique identifier for this TypeDef.

TypeDefKind
kind()

The kind of type this is (e.g. primitive, list, object).

bool
optional()

Whether this type can be set to null. Defaults to false.

withConstructor(Function_ $function)

Adds a function for constructing a new instance of an Object TypeDef, failing if the type is not an object.

withEnum(string $name, string|null $description = '', SourceMap|null $sourceMap = null)

Returns a TypeDef of kind Enum with the provided name.

withEnumValue(string $value, string|null $description = '', SourceMap|null $sourceMap = null)

Adds a static value for an Enum TypeDef, failing if the type is not an enum.

withField(string $name, TypeDef $typeDef, string|null $description = '', SourceMap|null $sourceMap = null)

Adds a static field for an Object TypeDef, failing if the type is not an object.

withFunction(Function_ $function)

Adds a function for an Object or Interface TypeDef, failing if the type is not one of those kinds.

withInterface(string $name, string|null $description = '', SourceMap|null $sourceMap = null)

Returns a TypeDef of kind Interface with the provided name.

withKind(TypeDefKind $kind)

Sets the kind of the type.

withListOf(TypeDef $elementType)

Returns a TypeDef of kind List with the provided type for its elements.

withObject(string $name, string|null $description = '', SourceMap|null $sourceMap = null)

Returns a TypeDef of kind Object with the provided name.

withOptional(bool $optional)

Sets whether this type can be set to null.

withScalar(string $name, string|null $description = '')

Returns a TypeDef of kind Scalar with the provided name.

Details

in AbstractObject at line 13
__construct(AbstractClient $client, QueryBuilderChain $queryBuilderChain)

No description

Parameters

AbstractClient $client
QueryBuilderChain $queryBuilderChain

in AbstractObject at line 19
protected null|array|string|int|float|bool queryLeaf(QueryBuilder $leafQueryBuilder, string $leafKey)

No description

Parameters

QueryBuilder $leafQueryBuilder
string $leafKey

Return Value

null|array|string|int|float|bool

at line 19
EnumTypeDef asEnum()

If kind is ENUM, the enum-specific type definition. If kind is not ENUM, this will be null.

Return Value

EnumTypeDef

at line 28
InputTypeDef asInput()

If kind is INPUT, the input-specific type definition. If kind is not INPUT, this will be null.

Return Value

InputTypeDef

at line 37
InterfaceTypeDef asInterface()

If kind is INTERFACE, the interface-specific type definition. If kind is not INTERFACE, this will be null.

Return Value

InterfaceTypeDef

at line 46
ListTypeDef asList()

If kind is LIST, the list-specific type definition. If kind is not LIST, this will be null.

Return Value

ListTypeDef

at line 55
ObjectTypeDef asObject()

If kind is OBJECT, the object-specific type definition. If kind is not OBJECT, this will be null.

Return Value

ObjectTypeDef

at line 64
ScalarTypeDef asScalar()

If kind is SCALAR, the scalar-specific type definition. If kind is not SCALAR, this will be null.

Return Value

ScalarTypeDef

at line 73
AbstractId id()

A unique identifier for this TypeDef.

Return Value

AbstractId

at line 82
TypeDefKind kind()

The kind of type this is (e.g. primitive, list, object).

Return Value

TypeDefKind

at line 91
bool optional()

Whether this type can be set to null. Defaults to false.

Return Value

bool

at line 100
TypeDef withConstructor(Function_ $function)

Adds a function for constructing a new instance of an Object TypeDef, failing if the type is not an object.

Parameters

Function_ $function

Return Value

TypeDef

at line 112
TypeDef withEnum(string $name, string|null $description = '', SourceMap|null $sourceMap = null)

Returns a TypeDef of kind Enum with the provided name.

Note that an enum's values may be omitted if the intent is only to refer to an enum. This is how functions are able to return their own, or any other circular reference.

Parameters

string $name
string|null $description
SourceMap|null $sourceMap

Return Value

TypeDef

at line 131
TypeDef withEnumValue(string $value, string|null $description = '', SourceMap|null $sourceMap = null)

Adds a static value for an Enum TypeDef, failing if the type is not an enum.

Parameters

string $value
string|null $description
SourceMap|null $sourceMap

Return Value

TypeDef

at line 150
TypeDef withField(string $name, TypeDef $typeDef, string|null $description = '', SourceMap|null $sourceMap = null)

Adds a static field for an Object TypeDef, failing if the type is not an object.

Parameters

string $name
TypeDef $typeDef
string|null $description
SourceMap|null $sourceMap

Return Value

TypeDef

at line 171
TypeDef withFunction(Function_ $function)

Adds a function for an Object or Interface TypeDef, failing if the type is not one of those kinds.

Parameters

Function_ $function

Return Value

TypeDef

at line 181
TypeDef withInterface(string $name, string|null $description = '', SourceMap|null $sourceMap = null)

Returns a TypeDef of kind Interface with the provided name.

Parameters

string $name
string|null $description
SourceMap|null $sourceMap

Return Value

TypeDef

at line 200
TypeDef withKind(TypeDefKind $kind)

Sets the kind of the type.

Parameters

TypeDefKind $kind

Return Value

TypeDef

at line 210
TypeDef withListOf(TypeDef $elementType)

Returns a TypeDef of kind List with the provided type for its elements.

Parameters

TypeDef $elementType

Return Value

TypeDef

at line 222
TypeDef withObject(string $name, string|null $description = '', SourceMap|null $sourceMap = null)

Returns a TypeDef of kind Object with the provided name.

Note that an object's fields and functions may be omitted if the intent is only to refer to an object. This is how functions are able to return their own object, or any other circular reference.

Parameters

string $name
string|null $description
SourceMap|null $sourceMap

Return Value

TypeDef

at line 241
TypeDef withOptional(bool $optional)

Sets whether this type can be set to null.

Parameters

bool $optional

Return Value

TypeDef

at line 251
TypeDef withScalar(string $name, string|null $description = '')

Returns a TypeDef of kind Scalar with the provided name.

Parameters

string $name
string|null $description

Return Value

TypeDef