SchemaPrinter
in package
Given an instance of Schema, prints it in GraphQL type language.
Table of Contents
- doPrint() : string
- printIntrospectionSchema() : string
- printType() : string
- breakLine() : array<string|int, string>
- descriptionLines() : array<string|int, string>
- escapeQuote() : string
- isSchemaOfCommonNames() : bool
- GraphQL schema define root types for each type of operation. These types are the same as any other type and can be named in any manner, however there is a common naming convention:
- printArgs() : string
- printDeprecated() : string
- printDescription() : string
- printDescriptionWithComments() : string
- printDirective() : string
- printEnum() : string
- printEnumValues() : string
- printFields() : string
- printFilteredSchema() : string
- printInputObject() : string
- printInputValue() : string
- printInterface() : string
- printObject() : string
- printScalar() : string
- printSchemaDefinition() : string
- printUnion() : string
Methods
doPrint()
public
static doPrint(Schema $schema[, array<string, bool> $options = [] ]) : string
Parameters
- $schema : Schema
- $options : array<string, bool> = []
-
Available options:
- commentDescriptions: Provide true to use preceding comments as the description. This option is provided to ease adoption and will be removed in v16.
Return values
string —printIntrospectionSchema()
public
static printIntrospectionSchema(Schema $schema[, array<string, bool> $options = [] ]) : string
Parameters
- $schema : Schema
- $options : array<string, bool> = []
Return values
string —printType()
public
static printType(Type $type[, array<string, bool> $options = [] ]) : string
Parameters
- $type : Type
- $options : array<string, bool> = []
Return values
string —breakLine()
protected
static breakLine(string $line, int $maxLen) : array<string|int, string>
Parameters
- $line : string
- $maxLen : int
Return values
array<string|int, string> —descriptionLines()
protected
static descriptionLines(string $description, int $maxLen) : array<string|int, string>
Parameters
- $description : string
- $maxLen : int
Return values
array<string|int, string> —escapeQuote()
protected
static escapeQuote(mixed $line) : string
Parameters
- $line : mixed
Return values
string —isSchemaOfCommonNames()
GraphQL schema define root types for each type of operation. These types are the same as any other type and can be named in any manner, however there is a common naming convention:
protected
static isSchemaOfCommonNames(Schema $schema) : bool
schema { query: Query mutation: Mutation }
When using this naming convention, the schema description can be omitted.
Parameters
- $schema : Schema
Return values
bool —printArgs()
protected
static printArgs(array<string, bool> $options, mixed $args[, mixed $indentation = '' ]) : string
Parameters
- $options : array<string, bool>
- $args : mixed
- $indentation : mixed = ''
Return values
string —printDeprecated()
protected
static printDeprecated(mixed $fieldOrEnumVal) : string
Parameters
- $fieldOrEnumVal : mixed
Return values
string —printDescription()
protected
static printDescription(array<string, bool> $options, mixed $def[, mixed $indentation = '' ][, mixed $firstInBlock = true ]) : string
Parameters
- $options : array<string, bool>
- $def : mixed
- $indentation : mixed = ''
- $firstInBlock : mixed = true
Return values
string —printDescriptionWithComments()
protected
static printDescriptionWithComments(mixed $lines, mixed $indentation, mixed $firstInBlock) : string
Parameters
- $lines : mixed
- $indentation : mixed
- $firstInBlock : mixed
Return values
string —printDirective()
protected
static printDirective(Directive $directive, array<string, bool> $options) : string
Parameters
- $directive : Directive
- $options : array<string, bool>
Return values
string —printEnum()
protected
static printEnum(EnumType $type, array<string, bool> $options) : string
Parameters
- $type : EnumType
- $options : array<string, bool>
Return values
string —printEnumValues()
protected
static printEnumValues(mixed $values, array<string, bool> $options) : string
Parameters
- $values : mixed
- $options : array<string, bool>
Return values
string —printFields()
protected
static printFields(array<string, bool> $options, mixed $type) : string
Parameters
- $options : array<string, bool>
- $type : mixed
Return values
string —printFilteredSchema()
protected
static printFilteredSchema(Schema $schema, callable $directiveFilter, callable $typeFilter, array<string, bool> $options) : string
Parameters
- $schema : Schema
- $directiveFilter : callable
- $typeFilter : callable
- $options : array<string, bool>
Return values
string —printInputObject()
protected
static printInputObject(InputObjectType $type, array<string, bool> $options) : string
Parameters
- $type : InputObjectType
- $options : array<string, bool>
Return values
string —printInputValue()
protected
static printInputValue(mixed $arg) : string
Parameters
- $arg : mixed
Return values
string —printInterface()
protected
static printInterface(InterfaceType $type, array<string, bool> $options) : string
Parameters
- $type : InterfaceType
- $options : array<string, bool>
Return values
string —printObject()
protected
static printObject(ObjectType $type, array<string, bool> $options) : string
Parameters
- $type : ObjectType
- $options : array<string, bool>
Return values
string —printScalar()
protected
static printScalar(ScalarType $type, array<string, bool> $options) : string
Parameters
- $type : ScalarType
- $options : array<string, bool>
Return values
string —printSchemaDefinition()
protected
static printSchemaDefinition(Schema $schema) : string
Parameters
- $schema : Schema
Return values
string —printUnion()
protected
static printUnion(UnionType $type, array<string, bool> $options) : string
Parameters
- $type : UnionType
- $options : array<string, bool>