function GitHubDriver::getBranches
@inheritDoc
Overrides VcsDriverInterface::getBranches
1 call to GitHubDriver::getBranches()
- GitHubDriver::getComposerInformation in vendor/
composer/ composer/ src/ Composer/ Repository/ Vcs/ GitHubDriver.php - @inheritDoc
File
-
vendor/
composer/ composer/ src/ Composer/ Repository/ Vcs/ GitHubDriver.php, line 367
Class
- GitHubDriver
- @author Jordi Boggiano <j.boggiano@seld.be>
Namespace
Composer\Repository\VcsCode
public function getBranches() : array {
if ($this->gitDriver) {
return $this->gitDriver
->getBranches();
}
if (null === $this->branches) {
$branches = [];
$resource = $this->getApiUrl() . '/repos/' . $this->owner . '/' . $this->repository . '/git/refs/heads?per_page=100';
do {
$response = $this->getContents($resource);
$branchData = $response->decodeJson();
foreach ($branchData as $branch) {
$name = substr($branch['ref'], 11);
if ($name !== 'gh-pages') {
$branches[$name] = $branch['object']['sha'];
}
}
$resource = $this->getNextPage($response);
} while ($resource);
$this->branches = $branches;
}
return $this->branches;
}