VersionPress\Utils\SystemInfo::getGitVersion PHP 메소드

getGitVersion() 공개 정적인 메소드

public static getGitVersion ( ) : string
리턴 string Like "1.9.4" or "2.3.0"
    public static function getGitVersion()
    {
        $gitInfo = self::getGitInfo();
        if (empty($gitInfo)) {
            throw new \Exception("Git not available");
        } else {
            return $gitInfo['git-version'];
        }
    }

Usage Example

 /**
  * @return string "ok", "no-git" or "wrong-version"
  */
 private function tryGit()
 {
     try {
         $gitVersion = SystemInfo::getGitVersion();
         return self::gitMatchesMinimumRequiredVersion($gitVersion) ? "ok" : "wrong-version";
     } catch (Exception $e) {
         return "no-git";
     }
 }