コード例 #1
0
ファイル: Phar.php プロジェクト: BGCX261/zibo-svn-to-git
 /**
  * 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);
         }
     }
 }
コード例 #2
0
ファイル: PharTest.php プロジェクト: BGCX261/zibo-svn-to-git
 /**
  * @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);
 }