/** * Add a collection of repositories described by the given configuration * to the given package and the global repository manager. * * @param array $repositories * @param RootPackageInterface $root */ protected function addRepositories(array $repositories, RootPackageInterface $root) { $repoManager = $this->composer->getRepositoryManager(); $newRepos = array(); foreach ($repositories as $repoJson) { $this->debug("Adding {$repoJson['type']} repository"); $repo = $repoManager->createRepository($repoJson['type'], $repoJson); $repoManager->addRepository($repo); $newRepos[] = $repo; } $root->setRepositories(array_merge($newRepos, $root->getRepositories())); }