function GitHubDriver::getComposerInformation
@inheritDoc
Overrides VcsDriver::getComposerInformation
File
-
vendor/
composer/ composer/ src/ Composer/ Repository/ Vcs/ GitHubDriver.php, line 156
Class
- GitHubDriver
- @author Jordi Boggiano <j.boggiano@seld.be>
Namespace
Composer\Repository\VcsCode
public function getComposerInformation(string $identifier) : ?array {
if ($this->gitDriver) {
return $this->gitDriver
->getComposerInformation($identifier);
}
if (!isset($this->infoCache[$identifier])) {
if ($this->shouldCache($identifier) && ($res = $this->cache
->read($identifier))) {
$composer = JsonFile::parseJson($res);
}
else {
$composer = $this->getBaseComposerInformation($identifier);
if ($this->shouldCache($identifier)) {
$this->cache
->write($identifier, json_encode($composer));
}
}
if ($composer !== null) {
// specials for github
if (isset($composer['support']) && !is_array($composer['support'])) {
$composer['support'] = [];
}
if (!isset($composer['support']['source'])) {
$label = (array_search($identifier, $this->getTags()) ?: array_search($identifier, $this->getBranches())) ?: $identifier;
$composer['support']['source'] = sprintf('https://%s/%s/%s/tree/%s', $this->originUrl, $this->owner, $this->repository, $label);
}
if (!isset($composer['support']['issues']) && $this->hasIssues) {
$composer['support']['issues'] = sprintf('https://%s/%s/%s/issues', $this->originUrl, $this->owner, $this->repository);
}
if (!isset($composer['abandoned']) && $this->isArchived) {
$composer['abandoned'] = true;
}
if (!isset($composer['funding']) && ($funding = $this->getFundingInfo())) {
$composer['funding'] = $funding;
}
}
$this->infoCache[$identifier] = $composer;
}
return $this->infoCache[$identifier];
}