Wikimedia\Composer\Merge\PluginState::shouldMergeExtra PHP Méthode

shouldMergeExtra() public méthode

By default, the extra section is not merged and there will be many cases where the merge of the extra section is performed too late to be of use to other plugins. When enabled, merging uses one of two strategies - either 'first wins' or 'last wins'. When enabled, 'first wins' is the default behaviour. If Replace mode is activated then 'last wins' is used.
public shouldMergeExtra ( ) : boolean
Résultat boolean
    public function shouldMergeExtra()
    {
        return $this->mergeExtra;
    }

Usage Example

 /**
  * Merge extra config into a RootPackageInterface
  *
  * @param RootPackageInterface $root
  * @param PluginState $state
  */
 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(self::mergeExtraArray($state->shouldMergeExtraDeep(), $rootExtra, $extra));
     } else {
         if (!$state->shouldMergeExtraDeep()) {
             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(self::mergeExtraArray($state->shouldMergeExtraDeep(), $extra, $rootExtra));
     }
 }
All Usage Examples Of Wikimedia\Composer\Merge\PluginState::shouldMergeExtra