configBuilder = $configBuilder; } public function getStorages() { return $this->storages; } public function getConfigs() { return $this->configs; } public function addStorage($name, $storage) { $this->configBuilder->add($storage->getConfig()); $this->storages[$name] = $storage; } public function init() { $this->configs = $this->configBuilder->loadYaml(); } public function import(Calendar $calendar) { if (!isset($this->configs)) { throw new \Exception('StorageManger was not initialize or configs are not defined'); } foreach ($this->configs as $key => $value) { $storage = $this->storages[$key]; if (!isset($storage)){ throw new \Exception(); } $storage->setRawConfigs($this->configs[$key]); $storage->save($calendar); } } }