readerFactory = $readerFactory; $this->resourceWriter = $resourceWriter; $this->resourceLocator = $resourceLocator ?: new ResourceLocator(); } /** * Teleports a file from a destination to an other * * @param ZippyResource $resource A Resource * @param string $context The current context * * @throws IOException when file could not be written on local * @throws InvalidArgumentException when path to file is not valid */ public function teleport(ZippyResource $resource, $context) { $reader = $this->readerFactory->getReader($resource, $context); $target = $this->resourceLocator->mapResourcePath($resource, $context); $this->resourceWriter->writeFromReader($reader, $target); } }