setTimezone(new \DateTimeZone('Europe/Paris')); return $commitDate->format('d/m/Y à H:i:s'); } public static function getCommitAuthor($_target = NULL){ if($_target == NULL){ $target = "HEAD"; } else { $target = "origin/".$_target; } return exec('git log --pretty="%cn" -n1 ' . $target); } public static function getCommitName($_target = NULL){ if($_target == NULL){ $target = "HEAD"; } else { $target = "origin/".$_target; } return exec('git log --pretty="%s" -n1 ' . $target); } public static function getBranchName($_target = NULL){ if($_target == NULL){ return exec('git rev-parse --abbrev-ref HEAD'); } else { return $_target; } } public static function printVersion($_target = NULL){ echo sprintf( '
%s %s %s
%s
Le %s
', self::getCommitAuthor($_target), self::getBranchName($_target), self::getCommitHash($_target), self::getCommitName($_target), self::getCommitDate($_target) ); } }