/** * @inheritdoc */ public function transform(ResourceInterface $resource, ResourceCollection $collection) { // break up again $files = $this->breakup($resource); $resources = []; foreach ($files as $file) { $transport = FileTransport::create($file); $transport->setDestination($file); $resources[] = new FileResource($transport); if ($this->maxParts > 0 && sizeof($resources) >= $this->maxParts) { break; } } $collection->unshiftAll($resources); return $collection->shift(); }
/** * @inheritdoc */ public function transform(ResourceInterface $resource, ResourceCollection $collection) { if ($this->needsUnzipping($resource)) { $this->unzip($resource); } $resources = []; foreach ($this->files as $file) { $targetFile = $this->getTargetFile($resource, $file); if (!file_exists($targetFile)) { throw new TransportException(sprintf('File "%s" was not found in the archive', $targetFile)); } $transport = FileTransport::create($targetFile); $transport->setDestinationDir($this->getTargetDir($resource)); $resources[] = new FileResource($transport); } $collection->unshiftAll($resources); return $collection->shift(); }