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;
    }