WooCommerce Code Reference

QueryComplexity extends QuerySecurityRule
in package

Tags
phpstan-import-type

ASTAndDefs from QuerySecurityRule

Table of Contents

DISABLED  = 0
$context  : QueryValidationContext
$fieldNodeAndDefs  : ArrayObject
$fragments  : array<string|int, mixed>
$maxQueryComplexity  : int
$name  : string
$queryComplexity  : int
$rawVariableValues  : array<string|int, mixed>
$variableDefs  : NodeList
__construct()  : mixed
getMaxQueryComplexity()  : int
getName()  : string
getQueryComplexity()  : int
Complexity of the first operation exceeding the defined limit, or, in case no operation exceeds the limit, complexity of the last defined operation.
getRawVariableValues()  : array<string, mixed>
getSDLVisitor()  : array<string|int, mixed>
Returns structure suitable for @see \Automattic\WooCommerce\Vendor\GraphQL\Language\Visitor.
getVisitor()  : array<string|int, mixed>
maxQueryComplexityErrorMessage()  : string
setMaxQueryComplexity()  : void
Set max query complexity. If equal to 0 no check is done. Must be greater or equal to 0.
setRawVariableValues()  : void
buildFieldArguments()  : array<string, mixed>
checkIfGreaterOrEqualToZero()  : void
collectFieldASTsAndDefs()  : ArrayObject
Given a selectionSet, adds all fields in that selection to the passed in map of fields, and returns it at the end.
directiveExcludesField()  : bool
Will the given field be executed at all, given the directives placed upon it?
fieldComplexity()  : int
fieldDefinition()  : FieldDefinition|null
gatherFragmentDefinition()  : void
getFieldName()  : string
getFragment()  : FragmentDefinitionNode|null
getFragments()  : array<string, FragmentDefinitionNode>
invokeIfNeeded()  : array<string|int, mixed>
isEnabled()  : bool
nodeComplexity()  : int

Constants

Properties

Methods

getQueryComplexity()

Complexity of the first operation exceeding the defined limit, or, in case no operation exceeds the limit, complexity of the last defined operation.

public getQueryComplexity() : int
Return values
int

setMaxQueryComplexity()

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

public setMaxQueryComplexity(int $maxQueryComplexity) : void
Parameters
$maxQueryComplexity : int
Tags
throws
InvalidArgumentException
Return values
void

collectFieldASTsAndDefs()

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

protected collectFieldASTsAndDefs(QueryValidationContext $context, Type|null $parentType, SelectionSetNode $selectionSet[, ArrayObject<string, true>|null $visitedFragmentNames = null ][, ArrayObject|null $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
$context : QueryValidationContext
$parentType : Type|null
$selectionSet : SelectionSetNode
$visitedFragmentNames : ArrayObject<string, true>|null = null
$astAndDefs : ArrayObject|null = null
Tags
see
OverlappingFieldsCanBeMerged
phpstan-param

ASTAndDefs|null $astAndDefs

throws
Exception
throws
ReflectionException
throws
InvariantViolation
phpstan-return

ASTAndDefs

Return values
ArrayObject