lib/StripeObject.php
protected static function deepCopy($obj)
    {
        if (is_array($obj)) {
            $copy = [];
            foreach ($obj as $k => $v) {
                $copy[$k] = self::deepCopy($v);
            }
            return $copy;
        } elseif ($obj instanceof StripeObject) {
            return $obj::constructFrom(
                self::deepCopy($obj->_values),
                clone $obj->_opts
            );
        } else {
            return $obj;
        }
    }
protected static function deepCopy($obj)
    {
        if (is_array($obj)) {
            $copy = [];
            foreach ($obj as $k => $v) {
                $copy[$k] = self::deepCopy($v);
            }
            return $copy;
        } elseif ($obj instanceof StripeObject) {
            return $obj::constructFrom(
                self::deepCopy($obj->_values),
                clone $obj->_opts
            );
        } else {
            return $obj;
        }
    }
protected static function deepCopy ( $ obj ) { if ( is_array ( $ obj ) ) { $ copy = [ ] ; foreach ( $ obj as $ k => $ v ) { $ copy [ $ k ] = self :: deepCopy ( $ v ) ; } return $ copy ; } elseif ( $ obj instanceof StripeObject ) { return $ obj :: constructFrom ( self :: deepCopy ( $ obj -> _values ) , clone $ obj -> _opts ) ; } else { return $ obj ; } }
Produces a deep copy of the given object including support for arrays
and StripeObjects.
Produces a deep copy of the given object including support for arrays and StripeObjects .