private function makeSerializable($value)
    {
        if (null === $value) {
            return $value;
        }

        if ($value instanceof Traversable || is_array($value)) {
            $value = ArrayUtils::iteratorToArray($value);

            foreach ($value as $key => $val) {
                $value[$key] = $this->makeSerializable($val);
            }

            return $value;
        }

        if (is_scalar($value)) {
            return $value;
        }

        if (is_resource($value)) {
            return 'resource';
        }

        return new ObjectStub($value);
    }
private function makeSerializable($value)
    {
        if (null === $value) {
            return $value;
        }

        if ($value instanceof Traversable || is_array($value)) {
            $value = ArrayUtils::iteratorToArray($value);

            foreach ($value as $key => $val) {
                $value[$key] = $this->makeSerializable($val);
            }

            return $value;
        }

        if (is_scalar($value)) {
            return $value;
        }

        if (is_resource($value)) {
            return 'resource';
        }

        return new ObjectStub($value);
    }
private function makeSerializable ( $ value ) { if ( null === $ value ) { return $ value ; } if ( $ value instanceof Traversable || is_array ( $ value ) ) { $ value = ArrayUtils :: iteratorToArray ( $ value ) ; foreach ( $ value as $ key => $ val ) { $ value [ $ key ] = $ this -> makeSerializable ( $ val ) ; } return $ value ; } if ( is_scalar ( $ value ) ) { return $ value ; } if ( is_resource ( $ value ) ) { return 'resource' ; } return new ObjectStub ( $ value ) ; }
Retrieves a serializable version of a given value

@param mixed $value

@return mixed

@throws \Zend\Stdlib\Exception\InvalidArgumentException
Retrieves a serializable version of a given value