1
0
Fork 0

RepositoryManager::prependRepository()

This method is useful for dynamically adding repositories with
higher priority than Packagist, e.g. from a Composer plugin.
pull/4951/head
Franz Liedke 2016-02-23 23:06:21 +09:00
parent 4c0e163977
commit ea30392105
1 changed files with 12 additions and 0 deletions

View File

@ -89,6 +89,18 @@ class RepositoryManager
$this->repositories[] = $repository; $this->repositories[] = $repository;
} }
/**
* Adds a repository to the beginning of the chain
*
* This is useful when injecting additional repositories that should trump Packagist, e.g. from a plugin.
*
* @param RepositoryInterface $repository repository instance
*/
public function prependRepository(RepositoryInterface $repository)
{
array_unshift($this->repositories, $repository);
}
/** /**
* Returns a new repository for a specific installation type. * Returns a new repository for a specific installation type.
* *