FeaturePhp/Exporter/ZipExporter.php
public function export($product) {
        $productLineName = $product->getProductLine()->getName();
        $files = $product->generateFiles();
        $zip = $this->open();
        
        if (count($files) === 0)
            $files[] = new fphp\File\TextFile("NOTICE", "No files were generated.");
        
        foreach ($files as $file)
            if (!$file->getContent()->addToZip($zip, fphp\Helper\Path::join($productLineName, $file->getTarget())))
                throw new ZipExporterException("could not add file to zip archive at \"$this->target\"");
        
        $this->close($zip);
    }
public function export($product) {
        $productLineName = $product->getProductLine()->getName();
        $files = $product->generateFiles();
        $zip = $this->open();
        
        if (count($files) === 0)
            $files[] = new fphp\File\TextFile("NOTICE", "No files were generated.");
        
        foreach ($files as $file)
            if (!$file->getContent()->addToZip($zip, fphp\Helper\Path::join($productLineName, $file->getTarget())))
                throw new ZipExporterException("could not add file to zip archive at \"$this->target\"");
        
        $this->close($zip);
    }
public function export ( $ product ) { $ productLineName = $ product -> getProductLine ( ) -> getName ( ) ; $ files = $ product -> generateFiles ( ) ; $ zip = $ this -> open ( ) ; if ( count ( $ files ) === 0 ) $ files [ ] = new fphp \ File \ TextFile ( "NOTICE" , "No files were generated." ) ; foreach ( $ files as $ file ) if ( ! $ file -> getContent ( ) -> addToZip ( $ zip , fphp \ Helper \ Path :: join ( $ productLineName , $ file -> getTarget ( ) ) ) ) throw new ZipExporterException ( "could not add file to zip archive at \"$this->target\"" ) ; $ this -> close ( $ zip ) ; }
Exports a product as a ZIP archive.
Every generated file is added to the archive at its target path. If there are no files,
a NOTICE file is generated because \ZipArchive does not support saving an empty ZIP archive.
The archive's root directory has the product line's name.
@param \FeaturePhp\ProductLine\Product $product
Exports a product as a ZIP archive . Every generated file is added to the archive at its target path . If there are no files a NOTICE file is generated because \ ZipArchive does not support saving an empty ZIP archive . The archive s root directory has the product line s name .