Version 1
[yaffs-website] / vendor / drupal-composer / drupal-scaffold / src / InitialFileFetcher.php
1 <?php
2
3 /**
4  * @file
5  * Contains \DrupalComposer\DrupalScaffold\FileFetcher.
6  */
7
8 namespace DrupalComposer\DrupalScaffold;
9
10 use Composer\Util\Filesystem;
11 use Composer\Util\RemoteFilesystem;
12
13 class InitialFileFetcher extends FileFetcher {
14   public function fetch($version, $destination) {
15     array_walk($this->filenames, function ($filename, $sourceFilename) use ($version, $destination) {
16       $target = "$destination/$filename";
17       if (!file_exists($target)) {
18         $url = $this->getUri($sourceFilename, $version);
19         $this->fs->ensureDirectoryExists($destination . '/' . dirname($filename));
20         $this->remoteFilesystem->copy($url, $url, $target);
21       }
22     });
23   }
24 }