Mmoreram\PHPFormatter\Compiler\Compiler::addFile PHP Метод

addFile() защищенный Метод

Add a file into the phar package.
protected addFile ( Phar $phar, Symfony\Component\Finder\SplFileInfo $file, boolean $strip = true ) : Compiler
$phar Phar Phar object
$file Symfony\Component\Finder\SplFileInfo File to add
$strip boolean strip
Результат Compiler self Object
    protected function addFile(Phar $phar, SplFileInfo $file, $strip = true)
    {
        $path = strtr(str_replace(dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR, '', $file->getRealPath()), '\\', '/');
        $content = $file->getContents();
        if ($strip) {
            $content = $this->stripWhitespace($content);
        } elseif ('LICENSE' === $file->getBasename()) {
            $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;
    }