3 namespace pharext\Task
;
10 * Clone a compressed copy of a phar
12 class PharCompress
implements Task
35 * @param string $file path to the original phar
36 * @param int $encoding Phar::GZ or Phar::BZ2
38 public function __construct($file, $encoding) {
40 $this->package
= new Phar($file);
41 $this->encoding
= $encoding;
45 $this->extension
= ".gz";
48 $this->extension
= ".bz2";
54 * @param bool $verbose
57 public function run($verbose = false) {
59 printf("Compressing %s ...\n", basename($this->package
->getPath()));
62 $stub = $this->package
->getStub();
63 $phar = $this->package
->compress($this->encoding
);
64 $phar->setStub(substr($stub, strpos($stub, "\n")+
1));
65 return $this->file
. $this->extension
;