function ReplaceOp::copyScaffold

Same name in other branches
  1. 8.9.x composer/Plugin/Scaffold/Operations/ReplaceOp.php \Drupal\Composer\Plugin\Scaffold\Operations\ReplaceOp::copyScaffold()
  2. 10 composer/Plugin/Scaffold/Operations/ReplaceOp.php \Drupal\Composer\Plugin\Scaffold\Operations\ReplaceOp::copyScaffold()
  3. 11.x composer/Plugin/Scaffold/Operations/ReplaceOp.php \Drupal\Composer\Plugin\Scaffold\Operations\ReplaceOp::copyScaffold()

Copies the scaffold file.

Parameters

\Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath $destination: Scaffold file to process.

\Composer\IO\IOInterface $io: IOInterface to writing to.

Return value

\Drupal\Composer\Plugin\Scaffold\Operations\ScaffoldResult The scaffold result.

1 call to ReplaceOp::copyScaffold()
ReplaceOp::process in composer/Plugin/Scaffold/Operations/ReplaceOp.php
Process this scaffold operation.

File

composer/Plugin/Scaffold/Operations/ReplaceOp.php, line 92

Class

ReplaceOp
Scaffold operation to copy or symlink from source to destination.

Namespace

Drupal\Composer\Plugin\Scaffold\Operations

Code

protected function copyScaffold(ScaffoldFilePath $destination, IOInterface $io) {
    $interpolator = $destination->getInterpolator();
    $this->source
        ->addInterpolationData($interpolator);
    if (file_put_contents($destination->fullPath(), $this->contents()) === FALSE) {
        throw new \RuntimeException($interpolator->interpolate("Could not copy source file <info>[src-rel-path]</info> to <info>[dest-rel-path]</info>!"));
    }
    $io->write($interpolator->interpolate("  - Copy <info>[dest-rel-path]</info> from <info>[src-rel-path]</info>"));
    return new ScaffoldResult($destination, $this->overwrite);
}

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