/** * Merge extra config into a RootPackage * * @param RootPackage $root * @param PluginState $state */ public function mergeExtra(RootPackage $root, PluginState $state) { $extra = $this->package->getExtra(); unset($extra['merge-plugin']); if (!$state->shouldMergeExtra() || empty($extra)) { return; } $rootExtra = $root->getExtra(); if ($state->replaceDuplicateLinks()) { $root->setExtra(array_merge($rootExtra, $extra)); } else { foreach ($extra as $key => $value) { if (isset($rootExtra[$key])) { $this->logger->debug("Ignoring duplicate <comment>{$key}</comment> in " . "<comment>{$this->path}</comment> extra config."); } } $root->setExtra(array_merge($extra, $rootExtra)); } }
/** * @param RootPackage $package * @return array */ protected function readConfig(RootPackage $package) { $config = array('include' => array()); $extra = $package->getExtra(); if (isset($extra['merge-plugin'])) { $config = array_merge($config, $extra['merge-plugin']); if (!is_array($config['include'])) { $config['include'] = array($config['include']); } } return $config; }