importers = $importers; $this->strategy = $strategy; } /** * * @param string $source * @param string $target * * @throws ImportFailureException */ public function import($source, $target) { $strategy = $this->strategy->detect($source); if (!isset($this->importers[$strategy])) { throw new ImportFailureException(sprintf('Unable to get an import for source `%s`', $source)); } $this->importers[$strategy]->import($source, $target); } }