Esempio n. 1
0
 /**
  * Compresses a directory into the archive
  * @param \Phar $archive Phar object of PHP
  * @param zibo\library\filesystem\File $dir The directory to compress in the archive
  * @param zibo\library\filesystem\File $prefix The path for the directory in the archive
  * @return null
  */
 private function compressDirectory(PhpPhar $archive, File $dir, File $prefix)
 {
     $children = $dir->read();
     if (empty($children)) {
         $archive->addEmptyDir(new File($prefix->getPath(), $dir->getName()));
     } else {
         foreach ($children as $file) {
             $this->compressFile($archive, $file, $prefix);
         }
     }
 }
Esempio n. 2
0
 /**
  * @expectedException zibo\library\archive\exception\ArchiveException
  */
 public function testUncompressWithNonPharPathThrowsException()
 {
     $phar = new Phar($this->nonPharFile);
     $uncompressDirectory = new File('/tmp/zibo/');
     if ($uncompressDirectory->exists()) {
         $uncompressDirectory->delete();
     }
     $phar->uncompress($uncompressDirectory);
 }