src/PHPEncoder.php
private function detectRecursion(& $value, array $options, array $recursion)
    {
        if ($options['recursion.detect']) {
            if (array_search($value, $recursion, true) !== false) {
                if ($options['recursion.ignore']) {
                    $value = null;
                } else {
                    throw new \RuntimeException('A recursive value was detected');
                }
            }

            return true;
        }

        return false;
    }
private function detectRecursion(& $value, array $options, array $recursion)
    {
        if ($options['recursion.detect']) {
            if (array_search($value, $recursion, true) !== false) {
                if ($options['recursion.ignore']) {
                    $value = null;
                } else {
                    throw new \RuntimeException('A recursive value was detected');
                }
            }

            return true;
        }

        return false;
    }
private function detectRecursion ( & $ value , array $ options , array $ recursion ) { if ( $ options [ 'recursion.detect' ] ) { if ( array_search ( $ value , $ recursion , true ) !== false ) { if ( $ options [ 'recursion.ignore' ] ) { $ value = null ; } else { throw new \ RuntimeException ( 'A recursive value was detected' ) ; } } return true ; } return false ; }
Attempts to detect circular references in values.
@param mixed $value Value to try for circular reference
@param array $options List of encoder options
@param array $recursion Upper values in the encoding tree
@return bool True if values should be recorded, false if not
@throws \RuntimeException If a recursive value is detected
Attempts to detect circular references in values .