Exemple #1
0
 /**
  * Finalize the project.
  *
  * @return void
  */
 public function finalize()
 {
     // disabled for interoperability with systems without gzip ext
     $this->phar->compressFiles(\Phar::GZ);
     $filename = $this->configuration->get('phar');
     $this->phar->getPharchive()->setAlias(basename($filename));
     $writer = new PharWriter();
     $writer->save($this->phar->getPharchive(), $filename);
     unset($this->phar);
     chmod($filename, 0755);
 }
 /**
  * Instantiate the tasks to process.
  *
  * @param ConfigurationValues $config The configuration values.
  *
  * @return Filter
  *
  * @throws \InvalidArgumentException When an unknown filter type has been configured.
  */
 private function buildFilters($config)
 {
     $collections = [];
     foreach ($config->get('rewrites') as $filterConfig) {
         $filters = [];
         foreach ($filterConfig['filter'] as $filter) {
             $this->logger->info('instantiate filter ' . $filter['type']);
             switch ($filter['type']) {
                 case 'replace':
                     $filters[] = new Filter\ReplaceStringFilter($filter);
                     break;
                 case 'php-strip':
                     $filters[] = new Filter\PhpStripWhiteSpaceFilter($filter);
                     break;
                 case 'warning-time':
                     $filters[] = new Filter\ReplaceStringWithTimestamp($filter);
                     break;
                 default:
                     throw new \InvalidArgumentException('Unknown filter type: ' . $filter['type']);
             }
         }
         $collections[] = new Filter\Collection($filterConfig['files'], $filters);
     }
     return new Filter($collections);
 }