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

Breadcrumb

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

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

Version

Namespace

SebastianBergmann

Code

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

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal