protected function OperationFactory::createReplaceOp in Drupal 9
Same name and namespace in other branches
- 8 composer/Plugin/Scaffold/Operations/OperationFactory.php \Drupal\Composer\Plugin\Scaffold\Operations\OperationFactory::createReplaceOp()
- 10 composer/Plugin/Scaffold/Operations/OperationFactory.php \Drupal\Composer\Plugin\Scaffold\Operations\OperationFactory::createReplaceOp()
Creates a 'replace' scaffold op.
Replace ops may copy or symlink, depending on settings.
Parameters
\Composer\Package\PackageInterface $package: The package that relative paths will be relative from.
OperationData $operation_data: The parameter data for this operation object, i.e. the relative 'path'.
Return value
\Drupal\Composer\Plugin\Scaffold\Operations\OperationInterface A scaffold replace operation object.
1 call to OperationFactory::createReplaceOp()
- OperationFactory::create in composer/
Plugin/ Scaffold/ Operations/ OperationFactory.php - Creates a scaffolding operation object as determined by the metadata.
File
- composer/
Plugin/ Scaffold/ Operations/ OperationFactory.php, line 77
Class
- OperationFactory
- Create Scaffold operation objects based on provided metadata.
Namespace
Drupal\Composer\Plugin\Scaffold\OperationsCode
protected function createReplaceOp(PackageInterface $package, OperationData $operation_data) {
if (!$operation_data
->hasPath()) {
throw new \RuntimeException("'path' component required for 'replace' operations.");
}
$package_name = $package
->getName();
$package_path = $this
->getPackagePath($package);
$source = ScaffoldFilePath::sourcePath($package_name, $package_path, $operation_data
->destination(), $operation_data
->path());
$op = new ReplaceOp($source, $operation_data
->overwrite());
return $op;
}