GraphQL\Validator\Rules\QueryDepth::fieldDepth PHP Method

fieldDepth() private method

private fieldDepth ( $node, $depth, $maxDepth )
    private function fieldDepth($node, $depth = 0, $maxDepth = 0)
    {
        if (isset($node->selectionSet) && $node->selectionSet instanceof SelectionSetNode) {
            foreach ($node->selectionSet->selections as $childNode) {
                $maxDepth = $this->nodeDepth($childNode, $depth, $maxDepth);
            }
        }
        return $maxDepth;
    }