mirror of
https://github.com/standardebooks/web.git
synced 2025-07-07 15:20:32 -04:00
Rename GitCommit::FromLogLine and have it accept the full line
This commit is contained in:
parent
e9cf55b53f
commit
df8eac6f82
2 changed files with 6 additions and 4 deletions
|
@ -10,14 +10,17 @@ class GitCommit{
|
|||
/**
|
||||
* @throws Exceptions\InvalidGitCommitException
|
||||
*/
|
||||
public static function FromLog(string $unixTimestamp, string $hash, string $message): GitCommit{
|
||||
public static function FromLogLine(string $logLine): GitCommit{
|
||||
$instance = new GitCommit();
|
||||
list($unixTimestamp, $hash, $message) = explode(' ', $logLine, 3);
|
||||
|
||||
try{
|
||||
$instance->Created = new DateTimeImmutable('@' . $unixTimestamp);
|
||||
}
|
||||
catch(\Exception){
|
||||
throw new Exceptions\InvalidGitCommitException('Invalid timestamp for Git commit.');
|
||||
}
|
||||
|
||||
$instance->Message = $message;
|
||||
$instance->Hash = $hash;
|
||||
return $instance;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue