phar = $phar; if (!file_exists($this->stub = $stub)) { throw new Exception("File '$stub' does not exist"); } } /** * @param bool $verbose */ function run($verbose = false) { if ($verbose) { printf("Using stub '%s'...\n", basename($this->stub)); } $stub = preg_replace_callback('/^#include <([^>]+)>/m', function($includes) { return file_get_contents($includes[1], true, null, 5); }, file_get_contents($this->stub)); if ($this->phar->isCompressed() && substr($stub, 0, 2) === "#!") { $stub = substr($stub, strpos($stub, "\n")+1); } $this->phar->setStub($stub); } }