/** * Loads a configuration file from a path. * * If the path does not exist, an empty configuration file is returned. * * @param string $path The path to the configuration file. * @param Config $baseConfig The configuration that the loaded configuration * will inherit its values from. * * @return ConfigFile The loaded configuration file. * * @throws StorageException If the file cannot be read. * @throws InvalidConfigException If the file contains invalid configuration. */ public function loadConfigFile($path, Config $baseConfig = null) { if (!$this->storage->exists($path)) { return new ConfigFile($path, $baseConfig); } $serialized = $this->storage->read($path); return $this->serializer->unserializeConfigFile($serialized, $path, $baseConfig); }