- Full name:
\GraphQL\Validator\Rules\QueryComplexity
- Parent class:
\GraphQL\Validator\Rules\QuerySecurityRule
private int $maxQueryComplexity
private array|null $rawVariableValues
private \ArrayObject $variableDefs
private \ArrayObject $fieldNodeAndDefs
private \GraphQL\Validator\ValidationContext $context
private int $complexity
public __construct(mixed $maxQueryComplexity): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$maxQueryComplexity |
mixed |
public getVisitor(\GraphQL\Validator\ValidationContext $context): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$context |
\GraphQL\Validator\ValidationContext |
private fieldComplexity(mixed $node, mixed $complexity): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$node |
mixed | |
$complexity |
mixed |
private nodeComplexity(\GraphQL\Language\AST\Node $node, mixed $complexity): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$node |
\GraphQL\Language\AST\Node | |
$complexity |
mixed |
private astFieldInfo(\GraphQL\Language\AST\FieldNode $field): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$field |
\GraphQL\Language\AST\FieldNode |
private directiveExcludesField(\GraphQL\Language\AST\FieldNode $node): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$node |
\GraphQL\Language\AST\FieldNode |
public getRawVariableValues(): mixed
public setRawVariableValues(array|null $rawVariableValues = null): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$rawVariableValues |
array|null |
private buildFieldArguments(\GraphQL\Language\AST\FieldNode $node): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$node |
\GraphQL\Language\AST\FieldNode |
public getQueryComplexity(): mixed
public getMaxQueryComplexity(): mixed
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 |
public static maxQueryComplexityErrorMessage(mixed $max, mixed $count): mixed
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
$max |
mixed | |
$count |
mixed |
protected isEnabled(): mixed
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 |
protected getFragment(\GraphQL\Language\AST\FragmentSpreadNode $fragmentSpread): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$fragmentSpread |
\GraphQL\Language\AST\FragmentSpreadNode |
protected getFragments(): \GraphQL\Language\AST\FragmentDefinitionNode[]
protected invokeIfNeeded(\GraphQL\Validator\ValidationContext $context, callable[] $validators): callable[]
Parameters:
Parameter | Type | Description |
---|---|---|
$context |
\GraphQL\Validator\ValidationContext | |
$validators |
callable[] |
protected isEnabled(): mixed
- This method is abstract.
protected gatherFragmentDefinition(\GraphQL\Validator\ValidationContext $context): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$context |
\GraphQL\Validator\ValidationContext |
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 -
protected getFieldName(\GraphQL\Language\AST\FieldNode $node): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$node |
\GraphQL\Language\AST\FieldNode |
public getName(): mixed
public __invoke(\GraphQL\Validator\ValidationContext $context): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$context |
\GraphQL\Validator\ValidationContext |
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 -
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 -