5 use Contracts\FactoryInterface;
13 class Sae implements FactoryInterface {
20 private $engines = [];
34 private $schemaRetriever;
45 $this->schemaRetriever = $schemaRetriever;
46 $this->storage = $storage;
52 public function getInstance(
string $identifier, array $config = []) {
53 if (!isset($this->engines[$identifier])) {
54 $this->engines[$identifier] =
new Engine($this->getStorage($identifier), $this->getJsonSchema($identifier));
56 return $this->engines[$identifier];
65 private function getJsonSchema($schema_id) {
69 if ($schema_id !=
'dataset') {
73 return $this->schemaRetriever->retrieve(
'dataset');
82 private function getStorage($schema_id) {
83 $this->storage->setSchema($schema_id);
84 return $this->storage;