function ManageOptions::ensureLocations

Same name in other branches
  1. 9 composer/Plugin/Scaffold/ManageOptions.php \Drupal\Composer\Plugin\Scaffold\ManageOptions::ensureLocations()
  2. 10 composer/Plugin/Scaffold/ManageOptions.php \Drupal\Composer\Plugin\Scaffold\ManageOptions::ensureLocations()
  3. 11.x composer/Plugin/Scaffold/ManageOptions.php \Drupal\Composer\Plugin\Scaffold\ManageOptions::ensureLocations()

Ensures that all of the locations defined in the scaffold files exist.

Create them on the filesystem if they do not.

1 call to ManageOptions::ensureLocations()
ManageOptions::getLocationReplacements in composer/Plugin/Scaffold/ManageOptions.php
Creates an interpolator for the 'locations' element.

File

composer/Plugin/Scaffold/ManageOptions.php, line 81

Class

ManageOptions
Per-project options from the 'extras' section of the composer.json file.

Namespace

Drupal\Composer\Plugin\Scaffold

Code

protected function ensureLocations() {
    $fs = new Filesystem();
    $locations = $this->getOptions()
        ->locations() + [
        'web_root' => './',
    ];
    $locations = array_map(function ($location) use ($fs) {
        $fs->ensureDirectoryExists($location);
        $location = realpath($location);
        return $location;
    }, $locations);
    return $locations;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.