+ $archiveTar->addString($configName, $ymlData);
+ } else {
+ file_put_contents("$directory/$configName", $ymlData);
+ }
+ }
+ // Get all override data from the remaining collections.
+ foreach ($this->storage->getAllCollectionNames() as $collection) {
+ $collection_storage = $this->storage->createCollection($collection);
+ $collection_path = str_replace('.', '/', $collection);
+ if (!$tar) {
+ mkdir("$directory/$collection_path", 0755, true);
+ }
+ foreach ($collection_storage->listAll() as $name) {
+ $configName = "$collection_path/$name.yml";
+ $configData = $collection_storage->read($name);
+ if ($removeUuid) {
+ unset($configData['uuid']);
+ }
+ if ($removeHash) {
+ unset($configData['_core']['default_config_hash']);
+ if (empty($configData['_core'])) {
+ unset($configData['_core']);
+ }
+ }
+
+ $ymlData = Yaml::encode($configData);
+ if ($tar) {
+ $archiveTar->addString($configName, $ymlData);
+ } else {
+ file_put_contents("$directory/$configName", $ymlData);
+ }