Interpolator example

/** * Interpolate a string using the data from this scaffold file info. * * @param string $name_prefix * (optional) Prefix to add before -rel-path and -full-path item names. * Defaults to path type provided when constructing this object. * * @return \Drupal\Composer\Plugin\Scaffold\Interpolator * An interpolator for making string replacements. */
  public function getInterpolator($name_prefix = '') {
    $interpolator = new Interpolator();
    $this->addInterpolationData($interpolator$name_prefix);
    return $interpolator;
  }

}

  public function getLocationReplacements() {
    $destinationTmpDir = $this->mkTmpDir('location-replacements');
    $interpolator = new Interpolator();
    $interpolator->setData(['web-root' => $destinationTmpDir, 'package-name' => 'fixtures/tmp-destination']);
    return $interpolator;
  }

  /** * Creates a ReplaceOp fixture. * * @param string $project_name * The name of the project to fetch; $package_name is * "fixtures/$project_name". * @param string $source * The name of the asset; path is "assets/$source". * * @return \Drupal\Composer\Plugin\Scaffold\Operations\ReplaceOp * A replace operation object. */

  public function getLocationReplacements() {
    return (new Interpolator())->setData($this->ensureLocations());
  }

  /** * Ensures that all of the locations defined in the scaffold files exist. * * Create them on the filesystem if they do not. */
  protected function ensureLocations() {
    $fs = new Filesystem();
    $locations = $this->getOptions()->locations() + ['web_root' => './'];
    $locations = array_map(function D$location) use ($fs) {
      
Home | Imprint | This part of the site doesn't use cookies.