コード例 #1
0
 public function creatingArchive()
 {
     $contents = array('lang/Object.class.php' => 'class Object { }', 'lang/Type.class.php' => 'class Type extends Object { }');
     $a = new Archive(new Stream());
     $a->open(ARCHIVE_CREATE);
     foreach ($contents as $filename => $bytes) {
         $a->addFileBytes($filename, NULL, NULL, $bytes);
     }
     $a->create();
     $this->assertEntries($a, $contents);
 }
コード例 #2
0
 /**
  * Adds sourcecode to a given XAR archive
  *
  * @param   lang.archive.Archive a
  * @param   string name
  * @param   string bytes sourcecode
  */
 protected function add(Archive $a, $name, $bytes)
 {
     $a->addFileBytes($name . '.class.php', $path = '', $name . '.class.php', '<?php ' . $bytes . ' ?>');
 }