function Version::getGitInformation
1 call to Version::getGitInformation()
- Version::generate in vendor/
sebastian/ version/ src/ Version.php
File
-
vendor/
sebastian/ version/ src/ Version.php, line 60
Class
Namespace
SebastianBergmannCode
private function getGitInformation(string $path) : bool|string {
if (!is_dir($path . DIRECTORY_SEPARATOR . '.git')) {
return false;
}
$process = proc_open('git describe --tags', [
1 => [
'pipe',
'w',
],
2 => [
'pipe',
'w',
],
], $pipes, $path);
if (!is_resource($process)) {
return false;
}
$result = trim(stream_get_contents($pipes[1]));
fclose($pipes[1]);
fclose($pipes[2]);
$returnCode = proc_close($process);
if ($returnCode !== 0) {
return false;
}
return $result;
}