Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. GitBitbucketDriver.php

function GitBitbucketDriver::getBranches

@inheritDoc

Overrides VcsDriverInterface::getBranches

3 calls to GitBitbucketDriver::getBranches()
GitBitbucketDriver::getChangeDate in vendor/composer/composer/src/Composer/Repository/Vcs/GitBitbucketDriver.php
@inheritDoc
GitBitbucketDriver::getComposerInformation in vendor/composer/composer/src/Composer/Repository/Vcs/GitBitbucketDriver.php
@inheritDoc
GitBitbucketDriver::getFileContent in vendor/composer/composer/src/Composer/Repository/Vcs/GitBitbucketDriver.php
@inheritDoc

File

vendor/composer/composer/src/Composer/Repository/Vcs/GitBitbucketDriver.php, line 342

Class

GitBitbucketDriver
@author Per Bernhardt <plb@webfactory.de>

Namespace

Composer\Repository\Vcs

Code

public function getBranches() : array {
    if ($this->fallbackDriver) {
        return $this->fallbackDriver
            ->getBranches();
    }
    if (null === $this->branches) {
        $branches = [];
        $resource = sprintf('%s?%s', $this->branchesUrl, http_build_query([
            'pagelen' => 100,
            'fields' => 'values.name,values.target.hash,values.heads,next',
            'sort' => '-target.date',
        ], '', '&'));
        $hasNext = true;
        while ($hasNext) {
            $branchData = $this->fetchWithOAuthCredentials($resource)
                ->decodeJson();
            foreach ($branchData['values'] as $data) {
                $branches[$data['name']] = $data['target']['hash'];
            }
            if (empty($branchData['next'])) {
                $hasNext = false;
            }
            else {
                $resource = $branchData['next'];
            }
        }
        $this->branches = $branches;
    }
    return $this->branches;
}
RSS feed
Powered by Drupal