Get ZipArchive files
TODO: tests

@param $bucketName
@param array $filesName
@param $zipFileName
@param bool $private
@return bool
487723
public function getAllZip($bucketName, array $filesName, $zipFileName, $private = false){
        $zip = new \ZipArchive();
        if ($zip->open($zipFileName, \ZipArchive::CREATE) === true) {
            foreach ($filesName as $file) {
                $content = $this->get($bucketName,$file,$private,false);
                if($content !== false){
                    try{
                        $zip->addFromString($file, $content["content"]);
                    }catch (\Exception $e){
                        return false;
                    }
                }
            }
            $zip->close();
        }else{
            return false;
        }
        return true;
    }
471579
public function get($filename)
    {
        try {

            $result = $this->client
                ->getObject(array(
                    'Bucket' => $this->name,
                    'Key'    => $filename
                ));

        } catch (\Aws\S3\Exception\S3Exception $e) {

            if ($e->getStatusCode() == '404') {
                throw new ObjectNotFoundException($e->getMessage());
            }

            throw $e;
        }

        return $result;
    }
1358230
public void getBlobMetadata(String bucketName, String blobName) throws StorageException {
    // [START storage_get_metadata]
    // Instantiate a Google Cloud Storage client
    Storage storage = StorageOptions.getDefaultInstance().getService();

    // The name of a bucket, e.g. "my-bucket"
    // String bucketName = "my-bucket";

    // The name of a blob, e.g. "my-blob"
    // String blobName = "my-blob";

    // Select all fields
    // Fields can be selected individually e.g. Storage.BlobField.CACHE_CONTROL
    Blob blob = storage.get(bucketName, blobName, BlobGetOption.fields(Storage.BlobField.values()));

    // Print blob metadata
    System.out.println("Bucket: " + blob.getBucket());
    System.out.println("CacheControl: " + blob.getCacheControl());
    System.out.println("ComponentCount: " + blob.getComponentCount());
    System.out.println("ContentDisposition: " + blob.getContentDisposition());
    System.out.println("ContentEncoding: " + blob.getContentEncoding());
    System.out.println("ContentLanguage: " + blob.getContentLanguage());
    System.out.println("ContentType: " + blob.getContentType());
    System.out.println("Crc32c: " + blob.getCrc32c());
    System.out.println("Crc32cHexString: " + blob.getCrc32cToHexString());
    System.out.println("ETag: " + blob.getEtag());
    System.out.println("Generation: " + blob.getGeneration());
    System.out.println("Id: " + blob.getBlobId());
    System.out.println("KmsKeyName: " + blob.getKmsKeyName());
    System.out.println("Md5Hash: " + blob.getMd5());
    System.out.println("Md5HexString: " + blob.getMd5ToHexString());
    System.out.println("MediaLink: " + blob.getMediaLink());
    System.out.println("Metageneration: " + blob.getMetageneration());
    System.out.println("Name: " + blob.getName());
    System.out.println("Size: " + blob.getSize());
    System.out.println("StorageClass: " + blob.getStorageClass());
    System.out.println("TimeCreated: " + new Date(blob.getCreateTime()));
    System.out.println("Last Metadata Update: " + new Date(blob.getUpdateTime()));
    Boolean temporaryHoldIsEnabled = (blob.getTemporaryHold() != null && blob.getTemporaryHold());
    System.out.println("temporaryHold: " + (temporaryHoldIsEnabled ? "enabled" : "disabled"));
    Boolean eventBasedHoldIsEnabled =
        (blob.getEventBasedHold() != null && blob.getEventBasedHold());
    System.out.println("eventBasedHold: " + (eventBasedHoldIsEnabled ? "enabled" : "disabled"));
    if (blob.getRetentionExpirationTime() != null) {
      System.out.println("retentionExpirationTime: " + new Date(blob.getRetentionExpirationTime()));
    }
    if (blob.getMetadata() != null) {
      System.out.println("\n\n\nUser metadata:");
      for (Map.Entry<String, String> userMetadata : blob.getMetadata().entrySet()) {
        System.out.println(userMetadata.getKey() + "=" + userMetadata.getValue());
      }
    }
    // [END storage_get_metadata]
  }
717502
public static function factory($name, $filename)
    {
        switch ($name) {
            case 'ZipArchive':
                if (class_exists('ZipArchive', false)) {
                    return new ZipArchive($filename);
                }
                break;

            case 'tar.gz':
                return new Tar($filename, 'gz');

            case 'tar.bz2':
                return new Tar($filename, 'bz2');

            case 'gz':
                if (function_exists('gzopen')) {
                    return new Gzip($filename);
                }
                break;

            case 'PclZip':
            default:
                return new PclZip($filename);
        }

        return new PclZip($filename);
    }
542472
public function getBucketLocation($bucketName, $options = array())
    {
        list($config) = $this->parseOptions($options, BosOptions::CONFIG);
        $response = $this->sendRequest(
            HttpMethod::GET,
            array(
                BosOptions::CONFIG => $config,
                'bucket_name' => $bucketName,
                'params' => array(
                    BosOptions::LOCATION => '',
                ),
            )
        );
        return $response->locationConstraint;
    }
593725
protected function open($archiveFileName)
    {
        $this->zip = new ZipArchive();
        $open_result = $this->zip->open($archiveFileName);
        if ($open_result !== true) {
            throw new Exception('Could not open Zip archive: '.$open_result);
        }
    }
402863
public function getArchiveSize() {
        if (!is_resource($this->zipFile)) {
            return strlen($this->zipData);
        }
        $filestat = fstat($this->zipFile);

        return $filestat['size'];
    }
1270797
public Blob copyToBucket(String bucketName) {
    // [START copyToBucket]
    CopyWriter copyWriter = blob.copyTo(bucketName);
    Blob copiedBlob = copyWriter.getResult();
    // [END copyToBucket]
    return copiedBlob;
  }
947691
public Blob updateBlobWithMetageneration(String bucketName, String blobName) {
    // [START updateBlobWithMetageneration]
    Blob blob = storage.get(bucketName, blobName);
    BlobInfo updatedInfo = blob.toBuilder().setContentType("text/plain").build();
    storage.update(updatedInfo, BlobTargetOption.metagenerationMatch());
    // [END updateBlobWithMetageneration]
    return blob;
  }
1107026
public function get($bucketName, $fileName, $private = false, $metadataOnly = false)
    {
        $token = null;
        if ($private == true) {
            $this->ensureAuthorized();
            $token = $this->token;
        }
        $response = $this->client->b2DownloadFileByName($this->downloadURL, $bucketName, $fileName, $token, $metadataOnly);
        if ($response->isOk(false)) {
            return array('headers' => $response->getHeaders(), 'content' => $response->getRawContent());
        }

        return false;
    }
756836
private Archive openArchive(File zipFileName, boolean useOptimizedZip) throws IOException {
        File origZipFileName = zipFileName;
        if (symbolFileEnabled && locations.isDefaultBootClassPathRtJar(zipFileName)) {
            File file = zipFileName.getParentFile().getParentFile(); // ${java.home}
            if (new File(file.getName()).equals(new File("jre")))
                file = file.getParentFile();
            // file == ${jdk.home}
            for (String name : symbolFileLocation)
                file = new File(file, name);
            // file == ${jdk.home}/lib/ct.sym
            if (file.exists())
                zipFileName = file;
        }

        Archive archive;
        try {

            ZipFile zdir = null;

            boolean usePreindexedCache = false;
            String preindexCacheLocation = null;

            if (!useOptimizedZip) {
                zdir = new ZipFile(zipFileName);
            } else {
                usePreindexedCache = options.isSet("usezipindex");
                preindexCacheLocation = options.get("java.io.tmpdir");
                String optCacheLoc = options.get("cachezipindexdir");

                if (optCacheLoc != null && optCacheLoc.length() != 0) {
                    if (optCacheLoc.startsWith("\"")) {
                        if (optCacheLoc.endsWith("\"")) {
                            optCacheLoc = optCacheLoc.substring(1, optCacheLoc.length() - 1);
                        }
                        else {
                            optCacheLoc = optCacheLoc.substring(1);
                        }
                    }

                    File cacheDir = new File(optCacheLoc);
                    if (cacheDir.exists() && cacheDir.canWrite()) {
                        preindexCacheLocation = optCacheLoc;
                        if (!preindexCacheLocation.endsWith("/") &&
                            !preindexCacheLocation.endsWith(File.separator)) {
                            preindexCacheLocation += File.separator;
                        }
                    }
                }
            }

            if (origZipFileName == zipFileName) {
                if (!useOptimizedZip) {
                    archive = new ZipArchive(this, zdir);
                } else {
                    archive = new ZipFileIndexArchive(this,
                                    zipFileIndexCache.getZipFileIndex(zipFileName,
                                    null,
                                    usePreindexedCache,
                                    preindexCacheLocation,
                                    options.isSet("writezipindexfiles")));
                }
            } else {
                if (!useOptimizedZip) {
                    archive = new SymbolArchive(this, origZipFileName, zdir, symbolFilePrefix);
                } else {
                    archive = new ZipFileIndexArchive(this,
                                    zipFileIndexCache.getZipFileIndex(zipFileName,
                                    symbolFilePrefix,
                                    usePreindexedCache,
                                    preindexCacheLocation,
                                    options.isSet("writezipindexfiles")));
                }
            }
        } catch (FileNotFoundException ex) {
            archive = new MissingArchive(zipFileName);
        } catch (ZipFileIndex.ZipFormatException zfe) {
            throw zfe;
        } catch (IOException ex) {
            if (zipFileName.exists())
                log.error("error.reading.file", zipFileName, getMessage(ex));
            archive = new MissingArchive(zipFileName);
        }

        archives.put(origZipFileName, archive);
        return archive;
    }
817171
public function deleteZip($zipname)
    {
        if (!file_exists($zipname)) {
            try {
                throw new Exception('no file zip');
            } catch (\Exception $e) {
                $e->getMessage();
            }
        }
        @chmod($zipname, 0777);

        if (!$this->zip->open($zipname)) {
        }

        $loop = $this->zip->numFiles;

        if (!$loop) {
            try {
                throw new Exception('no file zip');
            } catch (\Exception $e) {
                $e->getMessage();
            }
        }
        for ($i = 0; $i < $loop; ++$i) {
            $this->zip->deleteIndex($i);
        }
    }
146448
public function getFileData($fileName)
    {
        return new ArchiveEntry($this->inArchiveFileName, filesize($this->fileName),
            $this->uncompressedSize, $this->modificationTime);
    }
60584
public function exists($bucketName, $fileName)
    {
        $this->ensureAuthorized();
        $response = $this->client->b2DownloadFileByName($this->downloadURL, $bucketName, $fileName, $this->token, true);
        if (!$response->isOk(false)) {
            return false;
        }
        return $response->getHeader('x-bz-file-name') == $fileName;
    }
1293212
public static function createArchive(array $files, $archiveFileName){
        if (count($files) > 1) return false;
        $filename = array_shift($files);
        if (is_null($filename)) return false; // invalid list
        if (file_put_contents($archiveFileName,
                static::compressData(file_get_contents($filename))) !== false)
            return 1;
    }
1221620
public function getFileResource($fileName)
    {
        if (!in_array($fileName, $this->files, true))
            return false;

        return $this->archive->getFileResource($fileName);
    }
677597
public static function statFolder($bucketName, $path) {
        $path = self::normalizerPath($path, True);	

        return self::statBase($bucketName, $path);
    }