Sets the archive to use for de-/compression

@param  string $archive Archive to use
@return self
337676
public function setArchive($archive)
    {
        $archive = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $archive);
        $this->options['archive'] = (string) $archive;

        return $this;
    }
980037
public function addArchive(string $file): self
    {
        if (!\is_file($file)) {
            throw new \InvalidArgumentException(\sprintf('Archive not found: "%s"', $file));
        }
        
        if (!\is_readable($file)) {
            throw new \RuntimeException(\sprintf('Archive not readable: "%s"', $file));
        }
        
        $zip = new \ZipArchive();
        $zip->open($file);
        
        try {
            for ($i = 0; $i < $zip->numFiles; $i++) {
                $stat = (array) $zip->statIndex($i);
                
                // This will skip empty files as well... need a better way to this eventually.
                if (empty($stat['size'])) {
                    continue;
                }
                
                $name = $zip->getNameIndex($i);
                
                // Cap memory at 256KB to allow for large deployments when necessary.
                $stream = new StringStream('', 262144);
                $resource = $zip->getStream($name);
                
                try {
                    while (!\feof($resource)) {
                        $stream->write(\fread($resource, 8192));
                    }
                    
                    $stream->rewind();
                } finally {
                    @\fclose($resource);
                }
                
                $this->resources[\trim(\str_replace('\\', '/', $name), '/')] = $stream;
            }
        } finally {
            @$zip->close();
        }
        
        return $this;
    }
147225
public function compressBackupDatabase(TempFile $archive = null): TempFile
	{
		$this->check();
		if ($archive === null) {
			$archive = new TempFile('databaze.zip');
		}
		File::zip($this->backupDatabase(), (string) $archive);

		return $archive;
	}
522951
public function setZip($zip)
    {
        if (!empty($zip) && is_string($zip) && ctype_print($zip)) {
            $this->zip = trim($zip);
        }

        return $this;
    }
1263394
public function setArchived($value)
    {
        $this->_validateNotNull('Archived', $value);
        $this->_validateInt('Archived', $value);

        if ($this->data['archived'] === $value) {
            return;
        }

        $this->data['archived'] = $value;

        $this->_setModified('archived');
    }
86708
public function setCache($cache) : self
    {
        if (is_string($cache)) {
            $this->cache = CacheFactory::make($cache);
        } elseif ($cache instanceof Cacheable) {
            $this->cache = $cache;
        }

        $prefix = 'tus:' . strtolower((new \ReflectionClass(static::class))->getShortName()) . ':';

        $this->cache->setPrefix($prefix);

        return $this;
    }
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);
    }
989583
public function setCompression($compression)
    {
        if (is_string($this->compression)) {
            $compression = ['adapter' => $compression];
        }

        $this->compression = $compression;
        return $this;
    }
849085
public function setCompression($level = 9, $type = Archive::COMPRESS_AUTO)
    {
        $this->compressioncheck($type);
        if ($level < -1 || $level > 9) {
            throw new ArchiveIllegalCompressionException('Compression level should be between -1 and 9');
        }
        $this->comptype  = $type;
        $this->complevel = $level;
        if($level == 0) $this->comptype = Archive::COMPRESS_NONE;
        if($type == Archive::COMPRESS_NONE) $this->complevel = 0;
    }
1315044
public function disArchiveFiles()
    {
        $properties     = $this->getProperties();
        $acceptedFiles  = $properties['acceptedFiles'];
        $archExt        = $this->getArchiveExtensionConstant();
        $acceptedFiles  = $this->rmAcceptedFiles($acceptedFiles, $archExt);
        $properties['acceptedFiles']    = $acceptedFiles;
        $this->setProperties($properties);
        return $this;
    }
840547
protected function findRepositoryRoot(\ZipArchive $archive)
    {
        // Find root directory in zip file.
        $count    = $archive->numFiles;
        $rootFile = $archive->statIndex(0);
        $root     = $rootFile['name'];
        for ($i = 1; $i < $count; ++$i) {
            $file = $archive->statIndex($i);
            $root = $this->commonStartString($root, $file['name']);
        }

        return $root;
    }
532597
public function setCompression($mode)
    {
        switch ($mode) {
            case "gzip":
                $this->compression = "gz";
                break;
            case "bzip2":
                $this->compression = "bz2";
                break;
            case "lzma2":
                $this->compression = "lzma2";
                break;
            case "none":
                $this->compression = null;
                break;
            default:
                $this->log("Ignoring unknown compression mode: " . $mode, Project::MSG_WARN);
                $this->compression = null;
        }
    }
732025
public function setCompression($compression)
    {
        /**
         * If we don't support passed compression, leave old one.
         */
        switch ($compression) {
            case 'gzip':
                $this->compression = Phar::GZ;
                break;
            case 'bzip2':
                $this->compression = Phar::BZ2;
                break;
            default:
                break;
        }
    }
33052
public function setBlob($blob) {
        $this->blob = $blob;
        $this->setFilesize(strlen($blob));
        $this->setChecksum(md5($blob));

        return $this;
    }
6111
public function setPngCompression($compress = null)
    {
        if ($compress) {
            $this->useCompress = true;
        }

        $this->compress = isset($compress)
            ? $compress
            : self::PNG_COMPRESSION_DEFAULT;

        (is_numeric($this->compress) and $this->compress >= -1 and $this->compress <= 9)
            or $this->raiseError('Quality not in range.');

        $this->log("Setting PNG compression level to {$this->compress}.");

        return $this;
    }
282017
public function remove($key)
    {
        if (!$this->has($key)) {
            return;
        }

        unset($this->archive[$key]);
        unset($this->keys[$key]);

    }
128936
public function delete($file_name_or_array): ZipManager {

        try {

            foreach ( $this->zip_archives as $archive ) {
                $archive->delete($file_name_or_array);
            }
            return $this;

        } catch (ZipException $ze) {
            throw $ze;
        }

    }