Unzip file

@param string|boolean $destination Destination folder

@return bool
431886
public function unzip($destination = false)
    {
        if (!$destination) {
            $destination = dirname($this->path);
        }

        $archive = new ZipArchive();

        if ($archive->open($this->path) === true) {
            $archive->extractTo($destination);
            $archive->close();

            return true;
        }

        return false;
    }
370060
public function extractArchive($archive, $destination)
    {
        if (!file_exists($archive)) {
            throw new \InvalidArgumentException("Archive not found: $archive");
        }
        if (!file_exists($destination) && !mkdir($destination, 0755, true)) {
            throw new \InvalidArgumentException("Could not create destination directory: $destination");
        }
        $tar = $this->getTarExecutable();
        $destination = $this->fixTarPath($destination);
        $archive = $this->fixTarPath($archive);
        $this->shell->execute([$tar, '-xzp', '-C' . $destination, '-f' . $archive], null, true);
    }
1146606
public function findDestination($destination)
	{
		if (is_file($destination))
		{
			return $destination;
		}

		if ($location = $this->finder->findFileReversed($destination))
		{
			return $location;
		}

		$paths = $this->finder->getPaths();

		if (empty($paths))
		{
			return false;
		}

		$last = end($paths);

		return $last.ltrim($destination, DIRECTORY_SEPARATOR);
	}
143347
public function copyDirectory($directory, $destination)
    {
        $files = $this->fileSystem->allFiles($directory);
        $fileDeployed = false;
        $this->fileSystem->copyDirectory($directory, $destination);

        foreach ($files as $file) {
            $fileContents = $this->fileSystem->get($file);
            $fileDeployed = $this->fileSystem->put($destination.'/'.$file->getRelativePathname(), $fileContents);
        }

        return $fileDeployed;
    }
263747
public function copy($source, $destination, $override = false)
    {
        if (is_dir($destination) && !is_dir($source)) {
            $destination = rtrim($destination, '/') . '/' . basename($source);
        }
        $this->fs->copy($source, $destination, $override);
    }
110281
public function copy( $source, $destination ) {

		$source = $this->get_file( $source );

		if ( false === $source ) {
			return false;
		}

		$destination_parent = $this->get_file( dirname( $destination ) );
		$filename = basename( $destination );

		if ( false === $destination_parent ) {
			return false;
		}

		$destination_parent->contents->$filename = clone $source;

		return true;
	}
77594
public function moveTo(string $destination): void
    {
        $destination = is_dir($destination) ? ("$destination/{$this->clientName}") : $destination;
        Filesystem::checkWritable(dirname($destination));
        if (!move_uploaded_file($this->path, $destination)) {
            throw new FilesystemException("Failed to move file {$this->path} to {$destination}");
        }
    }
402592
protected function write($destination, $content)
    {
        $directory = dirname($destination);

        if ( ! $this->files->exists($directory)) {
            $this->files->makeDirectory($directory, 0755, true);
        }

        return (bool) $this->files->put($destination, $content);
    }
935014
public static function zipExtract(String $source, String $target = NULL) : Bool
    {
        $source = Info::rpath($source);
        $target = Info::rpath($target);

        $source = Base::suffix($source, '.zip');

        if( ! file_exists($source) )
        {
            throw new Exception\FileNotFoundException(NULL, $source);
        }

        if( empty($target) )
        {
            $target = Extension::remove($source);
        }

        $zip = new ZipArchive;

        if( $zip->open($source) === true )
        {
            $zip->extractTo($target);
            $zip->close();

            return true;
        }
        else
        {
            return false;
        }
    }
270478
public function extractTo($destination, $entries = array())
    {
        $result = false;
        if (!empty($entries)) {
            $result = $this->phar->extractTo($destination, $entries);
        } else {
            $result = $this->phar->extractTo($destination);
        }
        if ($result === false) {
            throw new ArchiveException('Error extracting archive.');
        }

        return $this;
    }
1140453
public function moveToDestination($destination = false)
    {
        if (! $destination) {
            $destination = $this->uploadDir;
        }

        $fileName = $this->getSafeName();
        if (strpos($this->getRealType(), $this->getUserExtension) == 0) {
            $fileName = $this->getSafeName() . '.' . $this->getUserExtension();
        }
        
        try {
            rename($this->tmpName, $destination . '/' . $fileName);
        } catch (\Exception $exception) {
            throw new CantMoveToDestination("Error Processing Request", 1);
        }

        return $this;
    }
713755
public static function unZip($zip_file, $destination)
    {
        $zip = new \ZipArchive();
        $archive = $zip->open($zip_file);

        if ($archive === true) {
            Folder::create($destination);

            $unzip = $zip->extractTo($destination);


            if (!$unzip) {
                self::$error = self::ZIP_EXTRACT_ERROR;
                Folder::delete($destination);
                $zip->close();
                return false;
            }

            $package_folder_name = preg_replace('#\./$#', '', $zip->getNameIndex(0));
            $zip->close();

            return $destination . '/' . $package_folder_name;
        }

        self::$error = self::ZIP_EXTRACT_ERROR;
        self::$error_zip = $archive;
        return false;
    }
433051
public function move( $source, $destination ) {

		if ( false === $this->copy( $source, $destination ) ) {
			return false;
		}

		$this->delete( $source );

		return true;
	}
750583
public function moveTo($destination) {
		if (!$this->isValid()) {
			return null;
		}

		$path = $this->generateFinalPath($destination);
		$moved = move_uploaded_file($this->tmpName, $path);

		if (!$moved) {
			return null;
		}

		return $path;
	}
37063
public function checkout($destination)
    {
        $repository = $this->credentials->getCurrentRepository();
        $branch = $repository->branch;
        $repository = $repository->repository;
        $repository = rtrim($repository, '/').'/'.ltrim($branch, '/');
        $repository = preg_replace('#//[a-zA-Z0-9.]+:?[a-zA-Z0-9]*@#', '//', $repository);

        return $this->co([$repository, $destination], $this->getCredentials());
    }
1161618
public function extract($destinationPath)
    {
        if (extension_loaded('zip')) {
            if (is_file($this->filePath)) {
                $zip = new \ZipArchive;
                $contents = $zip->open($this->filePath);

                if ($contents === true) {
                    if (is_dir($destinationPath)) {
                        $zip->extractTo($destinationPath);
                        $zip->close();

                        return true;
                    }
                }
            }
        }

        return false;
    }
833405
private function zip($source, $destination)
    {
        if (!extension_loaded('zip')) {
            throw new Exception("ZIP extension not available");
        }

        $source = realpath($source);
        if (!is_dir($source)) {
            throw new FileException("Source must be a directory.");
        }

        $zip = new ZipArchive();
        $shouldOverwrite = $this->isOverwrite() ? ZipArchive::OVERWRITE : 0;
        if (!$zip->open($destination, ZipArchive::CREATE | $shouldOverwrite)) {
            throw new FileException("Couldn't open zip file.");
        }

        /* @var $iterator RecursiveIteratorIterator|RecursiveDirectoryIterator */
        $dirIterator = new RecursiveDirectoryIterator($source, FilesystemIterator::SKIP_DOTS);
        $iterator = new RecursiveIteratorIterator($dirIterator, RecursiveIteratorIterator::SELF_FIRST);
        while ($iterator->valid()) {
            if ($iterator->isDir()) {
                $zip->addEmptyDir($iterator->getSubPathName());
            } else if ($iterator->isFile()) {
                $zip->addFromString($iterator->getSubPathName(), file_get_contents($iterator->key()));
            }
            $iterator->next();
        }

        return $zip->close();
    }