Version 1
[yaffs-website] / vendor / drupal-composer / drupal-scaffold / src / InitialFileFetcher.php
diff --git a/vendor/drupal-composer/drupal-scaffold/src/InitialFileFetcher.php b/vendor/drupal-composer/drupal-scaffold/src/InitialFileFetcher.php
new file mode 100644 (file)
index 0000000..e9ce314
--- /dev/null
@@ -0,0 +1,24 @@
+<?php
+
+/**
+ * @file
+ * Contains \DrupalComposer\DrupalScaffold\FileFetcher.
+ */
+
+namespace DrupalComposer\DrupalScaffold;
+
+use Composer\Util\Filesystem;
+use Composer\Util\RemoteFilesystem;
+
+class InitialFileFetcher extends FileFetcher {
+  public function fetch($version, $destination) {
+    array_walk($this->filenames, function ($filename, $sourceFilename) use ($version, $destination) {
+      $target = "$destination/$filename";
+      if (!file_exists($target)) {
+        $url = $this->getUri($sourceFilename, $version);
+        $this->fs->ensureDirectoryExists($destination . '/' . dirname($filename));
+        $this->remoteFilesystem->copy($url, $url, $target);
+      }
+    });
+  }
+}