1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-11 01:22:54 +00:00

Added --type option to search

This commit is contained in:
Pierre du Plessis 2016-06-21 16:38:52 +02:00
parent 5a3d60c0cf
commit 6a557e45b8
7 changed files with 110 additions and 11 deletions

View file

@ -190,12 +190,12 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
/**
* {@inheritDoc}
*/
public function search($query, $mode = 0)
public function search($query, $mode = 0, $type = null)
{
$this->loadRootServerFile();
if ($this->searchUrl && $mode === self::SEARCH_FULLTEXT) {
$url = str_replace('%query%', $query, $this->searchUrl);
$url = str_replace(array('%query%', '%type%'), array($query, $type), $this->searchUrl);
$hostname = parse_url($url, PHP_URL_HOST) ?: $url;
$json = $this->rfs->getContents($hostname, $url, false);
@ -642,6 +642,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
$hostname = parse_url($filename, PHP_URL_HOST) ?: $filename;
$rfs = $preFileDownloadEvent->getRemoteFilesystem();
$json = $rfs->getContents($hostname, $filename, false);
if ($sha256 && $sha256 !== hash('sha256', $json)) {
if ($retries) {