file = $file; $this->package = new Phar($file); $this->encoding = $encoding; switch ($encoding) { case Phar::GZ: $this->extension = ".gz"; break; case Phar::BZ2: $this->extension = ".bz2"; break; } } /** * @param bool $verbose * @return string */ public function run($verbose = false) { if ($verbose) { printf("Compressing %s ...\n", basename($this->package->getPath())); } /* stop shebang */ $stub = $this->package->getStub(); $phar = $this->package->compress($this->encoding); $phar->setStub(substr($stub, strpos($stub, "\n")+1)); return $this->file . $this->extension; } }