src/Visithor/Compiler/Compiler.php
protected function addFile(
        Phar $phar,
        SplFileInfo $file,
        $strip = true
    ) {
        $path = strtr(str_replace(dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR, '', $file->getRealPath()), '\\', '/');
        $content = file_get_contents($file);
        if ($strip) {
            $content = $this->stripWhitespace($content);
        } elseif ('LICENSE' === basename($file)) {
            $content = "\n" . $content . "\n";
        }

        if ($path === 'src/Composer/Composer.php') {
            $content = str_replace('@package_version@', $this->version, $content);
            $content = str_replace('@release_date@', $this->versionDate, $content);
        }

        $phar->addFromString($path, $content);

        return $this;
    }
protected function addFile(
        Phar $phar,
        SplFileInfo $file,
        $strip = true
    ) {
        $path = strtr(str_replace(dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR, '', $file->getRealPath()), '\\', '/');
        $content = file_get_contents($file);
        if ($strip) {
            $content = $this->stripWhitespace($content);
        } elseif ('LICENSE' === basename($file)) {
            $content = "\n" . $content . "\n";
        }

        if ($path === 'src/Composer/Composer.php') {
            $content = str_replace('@package_version@', $this->version, $content);
            $content = str_replace('@release_date@', $this->versionDate, $content);
        }

        $phar->addFromString($path, $content);

        return $this;
    }
protected function addFile ( Phar $ phar , SplFileInfo $ file , $ strip = true ) { $ path = strtr ( str_replace ( dirname ( dirname ( dirname ( __DIR__ ) ) ) . DIRECTORY_SEPARATOR , '' , $ file -> getRealPath ( ) ) , '\\' , '/' ) ; $ content = file_get_contents ( $ file ) ; if ( $ strip ) { $ content = $ this -> stripWhitespace ( $ content ) ; } elseif ( 'LICENSE' === basename ( $ file ) ) { $ content = "\n" . $ content . "\n" ; } if ( $ path === 'src/Composer/Composer.php' ) { $ content = str_replace ( '@package_version@' , $ this -> version , $ content ) ; $ content = str_replace ( '@release_date@' , $ this -> versionDate , $ content ) ; } $ phar -> addFromString ( $ path , $ content ) ; return $ this ; }
Add a file into the phar package

@param Phar        $phar  Phar object
@param SplFileInfo $file  File to add
@param bool        $strip strip

@return Compiler self Object
Add a file into the phar package