Burgomaster::createStub PHP Method

createStub() private method

This phar also registers a constant that can be used to check if you are running the phar. The constant is the basename of the $dest variable without the extension, with "_PHAR" appended, then converted to all caps (e.g., "/foo/guzzle.phar" gets a contant defined as GUZZLE_PHAR.
private createStub ( $dest, string $autoloaderFilename = 'autoloader.php' ) : string
$dest
$autoloaderFilename string Name of the autoloader file.
return string
    private function createStub($dest, $autoloaderFilename = 'autoloader.php')
    {
        $this->startSection('stub');
        $this->debug("Creating phar stub at {$dest}");
        $alias = basename($dest);
        $constName = str_replace('.phar', '', strtoupper($alias)) . '_PHAR';
        $stub = "<?php\n";
        $stub .= "define('{$constName}', true);\n";
        $stub .= "require 'phar://{$alias}/{$autoloaderFilename}';\n";
        $stub .= "__HALT_COMPILER();\n";
        $this->endSection();
        return $stub;
    }