Ejemplo n.º 1
0
 /**
  * @param  AbstractArchiveBuilder $archiveBuilder
  * @return $this
  */
 public function add(AbstractArchiveBuilder $archiveBuilder)
 {
     if ($archiveBuilder->isAvailable()) {
         $archiveBuilder->setEnvironment($this->environment);
         $this->archiveBuilders[$archiveBuilder->getName()] = $archiveBuilder;
     }
     return $this;
 }
Ejemplo n.º 2
0
 /**
  * @param  string $environment
  * @return $this
  *
  * Sets the execution environment of the Kernel,
  * used to know which cache is used.
  */
 public function setEnvironment($environment)
 {
     parent::setEnvironment($environment);
     $this->zip = new \ZipArchive();
     $cacheFile = $this->generateCacheFile($environment);
     if (file_exists($cacheFile)) {
         unlink($cacheFile);
     }
     $opening = $this->zip->open($cacheFile, \ZipArchive::CREATE);
     if ($opening !== true) {
         throw new \ErrorException($this->translator->trans("An unknown error append"));
     }
     $this->cacheFile = $cacheFile;
     return $this;
 }