当前位置: 首页>>代码示例>>PHP>>正文


PHP Phar::getSupportedCompression方法代码示例

本文整理汇总了PHP中Phar::getSupportedCompression方法的典型用法代码示例。如果您正苦于以下问题:PHP Phar::getSupportedCompression方法的具体用法?PHP Phar::getSupportedCompression怎么用?PHP Phar::getSupportedCompression使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Phar的用法示例。


在下文中一共展示了Phar::getSupportedCompression方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __c3_build_html_report

 function __c3_build_html_report(PHP_CodeCoverage $codeCoverage, $path)
 {
     $writer = new PHP_CodeCoverage_Report_HTML();
     $writer->process($codeCoverage, $path . 'html');
     if (file_exists($path . '.tar')) {
         unlink($path . '.tar');
     }
     $phar = new PharData($path . '.tar');
     $phar->setSignatureAlgorithm(Phar::SHA1);
     $files = $phar->buildFromDirectory($path . 'html');
     array_map('unlink', $files);
     if (in_array('GZ', Phar::getSupportedCompression())) {
         if (file_exists($path . '.tar.gz')) {
             unlink($path . '.tar.gz');
         }
         $phar->compress(\Phar::GZ);
         // close the file so that we can rename it
         unset($phar);
         unlink($path . '.tar');
         rename($path . '.tar.gz', $path . '.tar');
     }
     return $path . '.tar';
 }
开发者ID:lenninsanchez,项目名称:donadores,代码行数:23,代码来源:c3.php

示例2: run

 public function run()
 {
     $this->printTaskInfo("Creating <info>{$this->filename}</info>");
     $this->phar->setSignatureAlgorithm(\Phar::SHA1);
     $this->phar->startBuffering();
     $this->printTaskInfo('Packing ' . count($this->files) . ' files into phar');
     $progress = new ProgressBar($this->getOutput());
     $progress->start(count($this->files));
     $this->startTimer();
     foreach ($this->files as $path => $content) {
         $this->phar->addFromString($path, $content);
         $progress->advance();
     }
     $this->phar->stopBuffering();
     $progress->finish();
     $this->getOutput()->writeln('');
     if ($this->compress and in_array('GZ', \Phar::getSupportedCompression())) {
         if (count($this->files) > 1000) {
             $this->printTaskInfo("Too many files. Compression DISABLED");
         } else {
             $this->printTaskInfo($this->filename . " compressed");
             $this->phar = $this->phar->compressFiles(\Phar::GZ);
         }
     }
     $this->stopTimer();
     $this->printTaskSuccess("<info>{$this->filename}</info> produced");
     return Result::success($this, '', ['time' => $this->getExecutionTime()]);
 }
开发者ID:roland-d,项目名称:Robo,代码行数:28,代码来源:PackPhar.php

示例3: var_dump

<?php

var_dump(Phar::getSupportedCompression());
?>
===DONE===
开发者ID:lsqtongxin,项目名称:hhvm,代码行数:5,代码来源:phar_get_supportedcomp1.php

示例4: run

 public function run()
 {
     $this->printTaskInfo('Creating {filename}', ['filename' => $this->filename]);
     $this->phar->setSignatureAlgorithm(\Phar::SHA1);
     $this->phar->startBuffering();
     $this->printTaskInfo('Packing {file-count} files into phar', ['file-count' => count($this->files)]);
     $this->startProgressIndicator();
     foreach ($this->files as $path => $content) {
         $this->phar->addFromString($path, $content);
         $this->advanceProgressIndicator();
     }
     $this->phar->stopBuffering();
     $this->advanceProgressIndicator();
     if ($this->compress and in_array('GZ', \Phar::getSupportedCompression())) {
         if (count($this->files) > 1000) {
             $this->printTaskInfo('Too many files. Compression DISABLED');
         } else {
             $this->printTaskInfo('{filename} compressed', ['filename' => $this->filename]);
             $this->phar = $this->phar->compressFiles(\Phar::GZ);
         }
     }
     $this->advanceProgressIndicator();
     $this->stopProgressIndicator();
     $this->printTaskSuccess('{filename} produced', ['filename' => $this->filename]);
     return Result::success($this, '', ['time' => $this->getExecutionTime()]);
 }
开发者ID:greg-1-anderson,项目名称:Robo,代码行数:26,代码来源:PackPhar.php

示例5: compile

    /**
     * Compile new composer.phar
     * @param string $filename
     */
    public function compile($filename = 'codecept.phar')
    {
        if(file_exists($filename)) {
            unlink($filename);
        }

        $phar = new \Phar($filename, 0, 'codecept.phar');
        $phar->setSignatureAlgorithm(\Phar::SHA1);

        $phar->startBuffering();

        $finder = new Finder();
        $finder->files()
            ->ignoreVCS(true)
            ->name('*.php')
            ->name('*.tpl.dist')
            ->name('*.html.dist')
            ->in($this->compileDir . '/src');

        foreach ($finder as $file) {
            $this->addFile($phar, $file);
        }

	    $finder = new Finder();
        $finder
            ->files()
            ->ignoreVCS(true)
            ->name('*.php')
            ->name('*.js')
            ->name('*.css')
            ->name('*.png')
            ->name('*.tpl.dist')
            ->name('*.html.dist')
            ->exclude('Tests')
            ->exclude('tests')
            ->exclude('benchmark')
            ->exclude('demo')
            ->in($this->compileDir.'/plugins/frameworks');

        foreach($finder as $file) {
            $this->addFile($phar, $file);
        }

        $finder = new Finder();
        $finder
            ->files()
            ->ignoreVCS(true)
            ->name('*.php')
            ->name('*.css')
            ->name('*.png')
            ->name('*.js')
            ->name('*.css')
            ->name('*.png')
            ->name('*.tpl.dist')
            ->name('*.html.dist')
            ->exclude('Tests')
            ->exclude('tests')
            ->exclude('benchmark')
            ->exclude('demo')
            ->in($this->compileDir.'/vendor')
        ;

        foreach($finder as $file) {
            $this->addFile($phar, $file);
        }

        $this->addFile($phar, new \SplFileInfo($this->compileDir.'/autoload.php'));

        $this->setMainExecutable($phar);
        $this->setStub($phar);
        $phar->stopBuffering();

        if(in_array('GZ', \Phar::getSupportedCompression())) {
            //do not use compressFiles as it has issue with temporary file when adding large amount of files
//            $phar->compressFiles(\Phar::GZ);
            $phar = $phar->compressFiles(\Phar::GZ);
            echo "Compressed\r\n";

        } else {
            $phar = $phar->compress(\Phar::NONE);
        }



        unset($phar);
    }
开发者ID:hendryguna,项目名称:laravel-basic,代码行数:90,代码来源:Compiler.php

示例6: run

 public function run()
 {
     $this->printTaskInfo("creating <info>{$this->filename}</info>");
     $this->phar->setSignatureAlgorithm(\Phar::SHA1);
     $this->phar->startBuffering();
     $this->printTaskInfo('packing ' . count($this->files) . ' files into phar');
     $progress = new ProgressHelper();
     $progress->start($this->getOutput(), count($this->files));
     foreach ($this->files as $path => $content) {
         $this->phar->addFromString($path, $content);
         $progress->advance();
     }
     $this->phar->stopBuffering();
     $progress->finish();
     if ($this->compress and in_array('GZ', \Phar::getSupportedCompression())) {
         $this->printTaskInfo($this->filename . " compressed");
         $this->phar = $this->phar->compressFiles(\Phar::GZ);
     }
     $this->printTaskInfo($this->filename . " produced");
     return Result::success($this);
 }
开发者ID:sliver,项目名称:Robo,代码行数:21,代码来源:PackPhar.php


注:本文中的Phar::getSupportedCompression方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。