Skip to content

Commit 733cc7b

Browse files
bug #88 Do not use PreFileDownloadEvent from Composer (emodric)
This PR was merged into the 1.2-dev branch. Discussion ---------- Do not use PreFileDownloadEvent from Composer Commits ------- 72e6652 Do not use PreFileDownloadEvent from Composer
2 parents 61ef076 + 72e6652 commit 733cc7b

File tree

1 file changed

+3
-19
lines changed

1 file changed

+3
-19
lines changed

src/GitHubClient.php

+3-19
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,7 @@
1616
use Composer\Factory;
1717
use Composer\IO\IOInterface;
1818
use Composer\Json\JsonFile;
19-
use Composer\Plugin\PluginEvents;
20-
use Composer\Plugin\PreFileDownloadEvent;
2119
use Composer\Util\HttpDownloader;
22-
use Composer\Util\RemoteFilesystem;
23-
use Hirak\Prestissimo\CurlRemoteFilesystem;
2420

2521
/**
2622
* @author Nicolas Grekas <[email protected]>
@@ -185,18 +181,6 @@ public function getRepositories(array &$failures = null, $withFundingLinks = fal
185181

186182
public function call($graphql, array &$failures = [])
187183
{
188-
$rfs = $this->rfs;
189-
190-
if ($eventDispatcher = $this->composer->getEventDispatcher()) {
191-
$preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $rfs, 'https://api.github.com/graphql');
192-
193-
$eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
194-
195-
if ($rfs instanceof RemoteFilesystem && !$preFileDownloadEvent->getRemoteFilesystem() instanceof CurlRemoteFilesystem) {
196-
$rfs = $preFileDownloadEvent->getRemoteFilesystem();
197-
}
198-
}
199-
200184
$options = [
201185
'http' => [
202186
'method' => 'POST',
@@ -205,10 +189,10 @@ public function call($graphql, array &$failures = [])
205189
],
206190
];
207191

208-
if ($rfs instanceof HttpDownloader) {
209-
$result = $rfs->get('https://api.github.com/graphql', $options)->getBody();
192+
if ($this->rfs instanceof HttpDownloader) {
193+
$result = $this->rfs->get('https://api.github.com/graphql', $options)->getBody();
210194
} else {
211-
$result = $rfs->getContents('github.com', 'https://api.github.com/graphql', false, $options);
195+
$result = $this->rfs->getContents('github.com', 'https://api.github.com/graphql', false, $options);
212196
}
213197

214198
$result = json_decode($result, true);

0 commit comments

Comments
 (0)