function SvnDriver::supports
@inheritDoc
Overrides VcsDriverInterface::supports
File
-
vendor/
composer/ composer/ src/ Composer/ Repository/ Vcs/ SvnDriver.php, line 321
Class
- SvnDriver
- @author Jordi Boggiano <j.boggiano@seld.be> @author Till Klampaeckel <till@php.net>
Namespace
Composer\Repository\VcsCode
public static function supports(IOInterface $io, Config $config, string $url, bool $deep = false) : bool {
$url = self::normalizeUrl($url);
if (Preg::isMatch('#(^svn://|^svn\\+ssh://|svn\\.)#i', $url)) {
return true;
}
// proceed with deep check for local urls since they are fast to process
if (!$deep && !Filesystem::isLocalPath($url)) {
return false;
}
$process = new ProcessExecutor($io);
$exit = $process->execute([
'svn',
'info',
'--non-interactive',
'--',
$url,
], $ignoredOutput);
if ($exit === 0) {
// This is definitely a Subversion repository.
return true;
}
// Subversion client 1.7 and older
if (false !== stripos($process->getErrorOutput(), 'authorization failed:')) {
// This is likely a remote Subversion repository that requires
// authentication. We will handle actual authentication later.
return true;
}
// Subversion client 1.8 and newer
if (false !== stripos($process->getErrorOutput(), 'Authentication failed')) {
// This is likely a remote Subversion or newer repository that requires
// authentication. We will handle actual authentication later.
return true;
}
return false;
}