Open Data Catalog v2.0.0
Import.php
Go to the documentation of this file.
1 <?php
2 
4 
5 use Contracts\FactoryInterface;
9 
15 class Import implements FactoryInterface {
16  private $jobStoreFactory;
17  private $databaseTableFactory;
18 
19  private $services = [];
20 
24  public function __construct(JobStoreFactory $jobStoreFactory, DatabaseTableFactory $databaseTableFactory) {
25  $this->jobStoreFactory = $jobStoreFactory;
26  $this->databaseTableFactory = $databaseTableFactory;
27  }
28 
34  public function getInstance(string $identifier, array $config = []) {
35 
36  if (!isset($config['resource'])) {
37  throw new \Exception("config['resource'] is required");
38  }
39 
40  $resource = $config['resource'];
41 
42  if (!isset($this->services[$identifier])) {
43  $this->services[$identifier] = new Instance($resource, $this->jobStoreFactory, $this->databaseTableFactory);
44  }
45 
46  return $this->services[$identifier];
47  }
48 
49 }
Drupal\dkan_datastore\Storage\DatabaseTableFactory
Definition: DatabaseTableFactory.php:11
Drupal\dkan_datastore\Service\Factory\Import
Definition: Import.php:15
Drupal\dkan_datastore\Service\Factory
Definition: Import.php:3
Drupal\dkan_datastore\Service\Factory\Import\getInstance
getInstance(string $identifier, array $config=[])
Definition: Import.php:34
Drupal\dkan_datastore\Service\Import
Definition: Import.php:16
Drupal\dkan_datastore\Storage\JobStoreFactory
Definition: JobStoreFactory.php:11
Drupal\dkan_datastore\Service\Factory\Import\__construct
__construct(JobStoreFactory $jobStoreFactory, DatabaseTableFactory $databaseTableFactory)
Definition: Import.php:24