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

Breadcrumb

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

function GitDriver::getFileContent

@inheritDoc

Overrides VcsDriverInterface::getFileContent

File

vendor/composer/composer/src/Composer/Repository/Vcs/GitDriver.php, line 147

Class

GitDriver
@author Jordi Boggiano <j.boggiano@seld.be>

Namespace

Composer\Repository\Vcs

Code

public function getFileContent(string $file, string $identifier) : ?string {
    if (isset($identifier[0]) && $identifier[0] === '-') {
        throw new \RuntimeException('Invalid git identifier detected. Identifier must not start with a -, given: ' . $identifier);
    }
    $this->process
        ->execute([
        'git',
        'show',
        $identifier . ':' . $file,
    ], $content, $this->repoDir);
    if (trim($content) === '') {
        return null;
    }
    return $content;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal