Symfony\Component\Serializer\Normalizer\AbstractNormalizer::isCircularReference PHP Method

isCircularReference() protected method

Detects if the configured circular reference limit is reached.
protected isCircularReference ( object $object, array &$context ) : boolean
$object object
$context array
return boolean
    protected function isCircularReference($object, &$context)
    {
        $objectHash = spl_object_hash($object);
        if (isset($context[static::CIRCULAR_REFERENCE_LIMIT][$objectHash])) {
            if ($context[static::CIRCULAR_REFERENCE_LIMIT][$objectHash] >= $this->circularReferenceLimit) {
                unset($context[static::CIRCULAR_REFERENCE_LIMIT][$objectHash]);
                return true;
            }
            ++$context[static::CIRCULAR_REFERENCE_LIMIT][$objectHash];
        } else {
            $context[static::CIRCULAR_REFERENCE_LIMIT][$objectHash] = 1;
        }
        return false;
    }