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

Breadcrumb

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

function SvnDriver::getFileContent

Overrides VcsDriverInterface::getFileContent

File

vendor/composer/composer/src/Composer/Repository/Vcs/SvnDriver.php, line 176

Class

SvnDriver
@author Jordi Boggiano <j.boggiano@seld.be> @author Till Klampaeckel <till@php.net>

Namespace

Composer\Repository\Vcs

Code

public function getFileContent(string $file, string $identifier) : ?string {
    $identifier = '/' . trim($identifier, '/') . '/';
    if (Preg::isMatch('{^(.+?)(@\\d+)?/$}', $identifier, $match) && $match[2] !== null) {
        $path = $match[1];
        $rev = $match[2];
    }
    else {
        $path = $identifier;
        $rev = '';
    }
    try {
        $resource = $path . $file;
        $output = $this->execute([
            'svn',
            'cat',
        ], $this->baseUrl . $resource . $rev);
        if ('' === trim($output)) {
            return null;
        }
    } catch (\RuntimeException $e) {
        throw new TransportException($e->getMessage());
    }
    return $output;
}
RSS feed
Powered by Drupal