public function ExtraPackage::mergeExtra in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/wikimedia/composer-merge-plugin/src/Merge/ExtraPackage.php \Wikimedia\Composer\Merge\ExtraPackage::mergeExtra()
Merge extra config into a RootPackageInterface
Parameters
RootPackageInterface $root:
PluginState $state:
1 call to ExtraPackage::mergeExtra()
- ExtraPackage::mergeInto in vendor/
wikimedia/ composer-merge-plugin/ src/ Merge/ ExtraPackage.php - Merge this package into a RootPackageInterface
File
- vendor/
wikimedia/ composer-merge-plugin/ src/ Merge/ ExtraPackage.php, line 389
Class
- ExtraPackage
- Processing for a composer.json file that will be merged into a RootPackageInterface
Namespace
Wikimedia\Composer\MergeCode
public function mergeExtra(RootPackageInterface $root, PluginState $state) {
$extra = $this->package
->getExtra();
unset($extra['merge-plugin']);
if (!$state
->shouldMergeExtra() || empty($extra)) {
return;
}
$rootExtra = $root
->getExtra();
$unwrapped = self::unwrapIfNeeded($root, 'setExtra');
if ($state
->replaceDuplicateLinks()) {
$unwrapped
->setExtra(array_merge($rootExtra, $extra));
}
else {
foreach (array_intersect(array_keys($extra), array_keys($rootExtra)) as $key) {
$this->logger
->info("Ignoring duplicate <comment>{$key}</comment> in " . "<comment>{$this->path}</comment> extra config.");
}
$unwrapped
->setExtra(array_merge($extra, $rootExtra));
}
}