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