5 use Contracts\FactoryInterface;
15 class Import implements FactoryInterface {
16 private $jobStoreFactory;
17 private $databaseTableFactory;
19 private $services = [];
25 $this->jobStoreFactory = $jobStoreFactory;
26 $this->databaseTableFactory = $databaseTableFactory;
34 public function getInstance(
string $identifier, array $config = []) {
36 if (!isset($config[
'resource'])) {
37 throw new \Exception(
"config['resource'] is required");
40 $resource = $config[
'resource'];
42 if (!isset($this->services[$identifier])) {
43 $this->services[$identifier] =
new Instance($resource, $this->jobStoreFactory, $this->databaseTableFactory);
46 return $this->services[$identifier];