/**
* @throws DependencyMissingException
*
* @return string|false
*/
public function getVersion()
{
static $version;
if (!$version) {
if (!$this->shellHelper->commandExists('git')) {
throw new DependencyMissingException('Git must be installed');
}
$version = false;
$string = $this->execute(['--version'], false);
if ($string && preg_match('/(^| )([0-9]+[^ ]*)/', $string, $matches)) {
$version = $matches[2];
}
}
return $version;
}