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\VcsCode
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;
}