Skip to content

Latest commit

 

History

History
771 lines (270 loc) · 7.56 KB

QueryComplexity.md

File metadata and controls

771 lines (270 loc) · 7.56 KB

QueryComplexity

Properties

maxQueryComplexity

private int $maxQueryComplexity

rawVariableValues

private array|null $rawVariableValues

variableDefs

private \ArrayObject $variableDefs

fieldNodeAndDefs

private \ArrayObject $fieldNodeAndDefs

context

private \GraphQL\Validator\ValidationContext $context

complexity

private int $complexity

Methods

__construct

public __construct(mixed $maxQueryComplexity): mixed

Parameters:

Parameter Type Description
$maxQueryComplexity mixed

getVisitor

public getVisitor(\GraphQL\Validator\ValidationContext $context): mixed

Parameters:

Parameter Type Description
$context \GraphQL\Validator\ValidationContext

fieldComplexity

private fieldComplexity(mixed $node, mixed $complexity): mixed

Parameters:

Parameter Type Description
$node mixed
$complexity mixed

nodeComplexity

private nodeComplexity(\GraphQL\Language\AST\Node $node, mixed $complexity): mixed

Parameters:

Parameter Type Description
$node \GraphQL\Language\AST\Node
$complexity mixed

astFieldInfo

private astFieldInfo(\GraphQL\Language\AST\FieldNode $field): mixed

Parameters:

Parameter Type Description
$field \GraphQL\Language\AST\FieldNode

directiveExcludesField

private directiveExcludesField(\GraphQL\Language\AST\FieldNode $node): mixed

Parameters:

Parameter Type Description
$node \GraphQL\Language\AST\FieldNode

getRawVariableValues

public getRawVariableValues(): mixed

setRawVariableValues

public setRawVariableValues(array|null $rawVariableValues = null): mixed

Parameters:

Parameter Type Description
$rawVariableValues array|null

buildFieldArguments

private buildFieldArguments(\GraphQL\Language\AST\FieldNode $node): mixed

Parameters:

Parameter Type Description
$node \GraphQL\Language\AST\FieldNode

getQueryComplexity

public getQueryComplexity(): mixed

getMaxQueryComplexity

public getMaxQueryComplexity(): mixed

setMaxQueryComplexity

Set max query complexity. If equal to 0 no check is done. Must be greater or equal to 0.

public setMaxQueryComplexity(mixed $maxQueryComplexity): mixed

Parameters:

Parameter Type Description
$maxQueryComplexity mixed

maxQueryComplexityErrorMessage

public static maxQueryComplexityErrorMessage(mixed $max, mixed $count): mixed
  • This method is static.

Parameters:

Parameter Type Description
$max mixed
$count mixed

isEnabled

protected isEnabled(): mixed

Inherited methods

checkIfGreaterOrEqualToZero

check if equal to 0 no check is done. Must be greater or equal to 0.

protected checkIfGreaterOrEqualToZero(string $name, int $value): mixed

Parameters:

Parameter Type Description
$name string
$value int

getFragment

protected getFragment(\GraphQL\Language\AST\FragmentSpreadNode $fragmentSpread): mixed

Parameters:

Parameter Type Description
$fragmentSpread \GraphQL\Language\AST\FragmentSpreadNode

getFragments

protected getFragments(): \GraphQL\Language\AST\FragmentDefinitionNode[]

invokeIfNeeded

protected invokeIfNeeded(\GraphQL\Validator\ValidationContext $context, callable[] $validators): callable[]

Parameters:

Parameter Type Description
$context \GraphQL\Validator\ValidationContext
$validators callable[]

isEnabled

protected isEnabled(): mixed
  • This method is abstract.

gatherFragmentDefinition

protected gatherFragmentDefinition(\GraphQL\Validator\ValidationContext $context): mixed

Parameters:

Parameter Type Description
$context \GraphQL\Validator\ValidationContext

collectFieldASTsAndDefs

Given a selectionSet, adds all of the fields in that selection to the passed in map of fields, and returns it at the end.

protected collectFieldASTsAndDefs(\GraphQL\Validator\ValidationContext $context, \GraphQL\Type\Definition\Type|null $parentType, \GraphQL\Language\AST\SelectionSetNode $selectionSet, ?\ArrayObject $visitedFragmentNames = null, ?\ArrayObject $astAndDefs = null): \ArrayObject

Note: This is not the same as execution's collectFields because at static time we do not know what object type will be used, so we unconditionally spread in all fragments.

Parameters:

Parameter Type Description
$context \GraphQL\Validator\ValidationContext
$parentType \GraphQL\Type\Definition\Type|null
$selectionSet \GraphQL\Language\AST\SelectionSetNode
$visitedFragmentNames ?\ArrayObject
$astAndDefs ?\ArrayObject

See Also:

  • \GraphQL\Validator\Rules\OverlappingFieldsCanBeMerged -

getFieldName

protected getFieldName(\GraphQL\Language\AST\FieldNode $node): mixed

Parameters:

Parameter Type Description
$node \GraphQL\Language\AST\FieldNode

getName

public getName(): mixed

__invoke

public __invoke(\GraphQL\Validator\ValidationContext $context): mixed

Parameters:

Parameter Type Description
$context \GraphQL\Validator\ValidationContext

getVisitor

Returns structure suitable for GraphQL\Language\Visitor

public getVisitor(\GraphQL\Validator\ValidationContext $context): array

Parameters:

Parameter Type Description
$context \GraphQL\Validator\ValidationContext

See Also:

  • \GraphQL\Language\Visitor -

getSDLVisitor

Returns structure suitable for GraphQL\Language\Visitor

public getSDLVisitor(\GraphQL\Validator\SDLValidationContext $context): array

Parameters:

Parameter Type Description
$context \GraphQL\Validator\SDLValidationContext

See Also:

  • \GraphQL\Language\Visitor -