|
|
@@ -2,13 +2,31 @@
|
|
|
|
|
|
class git
|
|
|
{
|
|
|
- public static function getVersion()
|
|
|
- {
|
|
|
- $commitHash = trim(exec('git log --pretty="%h" -n1 HEAD'));
|
|
|
+ public static function getCommitHash(){
|
|
|
+ return substr(trim(exec('git log --pretty="%H" -n1 HEAD')), 0, 10);
|
|
|
+ }
|
|
|
|
|
|
+ public static function getCommitDate(){
|
|
|
$commitDate = new \DateTime(trim(exec('git log -n1 --pretty=%ci HEAD')));
|
|
|
$commitDate->setTimezone(new \DateTimeZone('UTC'));
|
|
|
+ return $commitDate->format('d/m/Y à H:i:s');
|
|
|
+ }
|
|
|
+
|
|
|
+ public static function getCommitAuthor(){
|
|
|
+ return exec('git log --pretty="%cn" -n1 HEAD');
|
|
|
+ }
|
|
|
+
|
|
|
+ public static function getCommitName(){
|
|
|
+ return exec('git log --pretty="%s" -n1 HEAD');
|
|
|
+ }
|
|
|
|
|
|
- return sprintf('%s (%s)', $commitHash, $commitDate->format('Y-m-d H:i:s'));
|
|
|
+ public static function printVersion(){
|
|
|
+ echo sprintf(
|
|
|
+ '<h6>%s <span class="badge bg-success">%s</h6></div><div>%s (%s)</div>',
|
|
|
+ self::getCommitAuthor(),
|
|
|
+ self::getCommitHash(),
|
|
|
+ self::getCommitName(),
|
|
|
+ self::getCommitDate()
|
|
|
+ );
|
|
|
}
|
|
|
}
|