src/Service/Cdn.php
public function objectReplace($object, $bucket, $replaceWith, $options = [], $bIsStream = false)
    {
        //  Firstly, attempt the upload
        $upload = $this->objectCreate($replaceWith, $bucket, $options, $bIsStream);

        if ($upload) {

            $oObj = $this->getObject($object);

            if ($oObj) {
                $this->objectDelete($oObj->id);
            }

            return $upload;

        } else {
            return false;
        }
    }
public function objectReplace($object, $bucket, $replaceWith, $options = [], $bIsStream = false)
    {
        //  Firstly, attempt the upload
        $upload = $this->objectCreate($replaceWith, $bucket, $options, $bIsStream);

        if ($upload) {

            $oObj = $this->getObject($object);

            if ($oObj) {
                $this->objectDelete($oObj->id);
            }

            return $upload;

        } else {
            return false;
        }
    }
public function objectReplace ( $ object , $ bucket , $ replaceWith , $ options = [ ] , $ bIsStream = false ) { //  Firstly, attempt the upload $ upload = $ this -> objectCreate ( $ replaceWith , $ bucket , $ options , $ bIsStream ) ; if ( $ upload ) { $ oObj = $ this -> getObject ( $ object ) ; if ( $ oObj ) { $ this -> objectDelete ( $ oObj -> id ) ; } return $ upload ; } else { return false ; } }
Uploads an object and, if successful, removes the old object. Note that a new Object ID is created.

@param mixed   $object      The existing object's ID or filename
@param mixed   $bucket      The bucket's ID or slug
@param mixed   $replaceWith The replacement: $_FILE key, path or data stream
@param array   $options     An array of options to apply to the upload
@param boolean $bIsStream   Whether the replacement object is a data stream or not

@return mixed                stdClass on success, false on failure
Uploads an object and if successful removes the old object . Note that a new Object ID is created .