public function copyTo($file)
    {
        if (null === $this->file) {
            throw LogicException::create(
                'The update file has not been downloaded.'
            );
        }

        $mode = 0755;

        if (file_exists($file)) {
            $mode = fileperms($file) & 511;
        }

        if (false === @copy($this->file, $file)) {
            throw FileException::lastError();
        }

        if (false === @chmod($file, $mode)) {
            throw FileException::lastError();
        }

        $key = $file . '.pubkey';

        if (file_exists($this->file . '.pubkey')) {
            if (false === @copy($this->file . '.pubkey', $key)) {
                throw FileException::lastError();
            }
        } elseif (file_exists($key)) {
            if (false === @unlink($key)) {
                throw FileException::lastError();
            }
        }
    }
public function copyTo($file)
    {
        if (null === $this->file) {
            throw LogicException::create(
                'The update file has not been downloaded.'
            );
        }

        $mode = 0755;

        if (file_exists($file)) {
            $mode = fileperms($file) & 511;
        }

        if (false === @copy($this->file, $file)) {
            throw FileException::lastError();
        }

        if (false === @chmod($file, $mode)) {
            throw FileException::lastError();
        }

        $key = $file . '.pubkey';

        if (file_exists($this->file . '.pubkey')) {
            if (false === @copy($this->file . '.pubkey', $key)) {
                throw FileException::lastError();
            }
        } elseif (file_exists($key)) {
            if (false === @unlink($key)) {
                throw FileException::lastError();
            }
        }
    }
public function copyTo ( $ file ) { if ( null === $ this -> file ) { throw LogicException :: create ( 'The update file has not been downloaded.' ) ; } $ mode = 0755 ; if ( file_exists ( $ file ) ) { $ mode = fileperms ( $ file ) & 511 ; } if ( false === @ copy ( $ this -> file , $ file ) ) { throw FileException :: lastError ( ) ; } if ( false === @ chmod ( $ file , $ mode ) ) { throw FileException :: lastError ( ) ; } $ key = $ file . '.pubkey' ; if ( file_exists ( $ this -> file . '.pubkey' ) ) { if ( false === @ copy ( $ this -> file . '.pubkey' , $ key ) ) { throw FileException :: lastError ( ) ; } } elseif ( file_exists ( $ key ) ) { if ( false === @ unlink ( $ key ) ) { throw FileException :: lastError ( ) ; } } }
Copies the update file to the destination.

@param string $file The target file.

@throws Exception\Exception
@throws FileException If the file could not be replaced.
Copies the update file to the destination .