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

Breadcrumb

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

function GitBitbucketDriver::getFileContent

@inheritDoc

Overrides VcsDriverInterface::getFileContent

File

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

Class

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

Namespace

Composer\Repository\Vcs

Code

public function getFileContent(string $file, string $identifier) : ?string {
    if ($this->fallbackDriver) {
        return $this->fallbackDriver
            ->getFileContent($file, $identifier);
    }
    if (strpos($identifier, '/') !== false) {
        $branches = $this->getBranches();
        if (isset($branches[$identifier])) {
            $identifier = $branches[$identifier];
        }
    }
    $resource = sprintf('https://api.bitbucket.org/2.0/repositories/%s/%s/src/%s/%s', $this->owner, $this->repository, $identifier, $file);
    return $this->fetchWithOAuthCredentials($resource)
        ->getBody();
}
RSS feed
Powered by Drupal