mirror of
https://github.com/standardebooks/web.git
synced 2025-07-05 14:20:29 -04:00
22 lines
522 B
PHP
22 lines
522 B
PHP
<?
|
|
use Safe\DateTimeImmutable;
|
|
|
|
class GitCommit{
|
|
public DateTimeImmutable $Created;
|
|
public string $Message;
|
|
public string $Hash;
|
|
|
|
/**
|
|
* @throws Exceptions\InvalidGitCommitException
|
|
*/
|
|
public function __construct(string $unixTimestamp, string $hash, string $message){
|
|
try{
|
|
$this->Created = new DateTimeImmutable('@' . $unixTimestamp);
|
|
}
|
|
catch(\Exception){
|
|
throw new Exceptions\InvalidGitCommitException('Invalid timestamp for Git commit.');
|
|
}
|
|
$this->Message = $message;
|
|
$this->Hash = $hash;
|
|
}
|
|
}
|