/** * Merge require-dev into RootPackage. * * @param \Composer\Package\RootPackageInterface $root * @param \Arcanedev\Composer\Entities\PluginState $state */ protected function mergeDevRequires(RootPackageInterface $root, PluginState $state) { if (!empty($requires = $this->getPackage()->getDevRequires())) { $this->mergeStabilityFlags($root, $requires); $duplicateLinks = []; $requires = $this->replaceSelfVersionDependencies('require-dev', $requires, $root); $root->setDevRequires($this->mergeLinks($root->getDevRequires(), $requires, $state->replaceDuplicateLinks(), $duplicateLinks)); $state->addDuplicateLinks('require-dev', $duplicateLinks); } }
/** * Get extra config. * * @param \Composer\Package\RootPackageInterface $root * @param \Arcanedev\Composer\Entities\PluginState $state * @param array $extra * * @return array */ private function getExtra(RootPackageInterface $root, PluginState $state, $extra) { $rootExtra = $root->getExtra(); if ($state->replaceDuplicateLinks()) { return self::mergeExtraArray($state->shouldMergeExtraDeep(), $rootExtra, $extra); } if (!$state->shouldMergeExtraDeep()) { foreach (array_intersect(array_keys($extra), array_keys($rootExtra)) as $key) { $this->getLogger()->info("Ignoring duplicate <comment>{$key}</comment> in " . "<comment>{$this->getPath()}</comment> extra config."); } } return static::mergeExtraArray($state->shouldMergeExtraDeep(), $extra, $rootExtra); }
/** * Run first install. * * @param \Composer\Script\Event $event * * @throws \Exception * * @codeCoverageIgnore */ private function runFirstInstall(ScriptEvent $event) { $installer = Installer::create($event->getIO(), Factory::create($event->getIO(), null, false)); $installer->setPreferSource($this->isPreferredInstall('source')); $installer->setPreferDist($this->isPreferredInstall('dist')); $installer->setDevMode($event->isDevMode()); $installer->setDumpAutoloader($this->state->shouldDumpAutoloader()); $installer->setOptimizeAutoloader($this->state->shouldOptimizeAutoloader()); if ($this->state->forceUpdate()) { // Force update mode so that new packages are processed rather than just telling // the user that composer.json and composer.lock don't match. $installer->setUpdate(true); } $installer->run(); }