/**
  * {@inheritdoc}
  */
 public function build(ReaderTypeInterface $type, array $transportConfig, $resourceType, array $options)
 {
     $resolver = $this->getOptionsResolver($type);
     $transport = $this->createTransport($transportConfig, $this->destinationDir, $this->eventDispatcher);
     $resources = new ResourceCollection([new FileResource($transport)]);
     $type->build($this, $resolver->resolve($options));
     if (isset($this->transformers[$resourceType])) {
         foreach ($this->transformers[$resourceType] as $transformer) {
             $resources->addTransformer($transformer);
         }
     }
     switch ($this->readerType) {
         case self::READER_TYPE_XML:
             // xml is the default, let it fall through
         // xml is the default, let it fall through
         default:
             return new XmlReader($resources, $this->eventDispatcher);
     }
 }
 /**
  * @param ResourceCollection $resources
  */
 protected function removeResources(ResourceCollection $resources)
 {
     $resources->rewind();
     while ($resources->count()) {
         try {
             $resource = $resources->dequeue();
             $transport = $resource->getTransport();
             $this->logger->getLogger()->debug(sprintf('Removing resource: %s', $transport->getDestination()));
             $transport->purge();
         } catch (TransportException $e) {
             // no biggie, if we could not transport it, we don't have to remove it
         }
     }
 }