for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* This file is part of SebastianFeldmann\Git.
*
* (c) Sebastian Feldmann <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace SebastianFeldmann\Git\Log;
* Class Commit
* @package SebastianFeldmann\Git
* @author Sebastian Feldmann <[email protected]>
* @link https://github.com/sebastianfeldmann/git
* @since Class available since Release 1.2.0
class Commit
{
* @var string
private $hash;
* @var array
private $names;
private $subject;
private $body;
* @var \DateTimeImmutable
private $date;
private $author;
* Commit constructor.
* @param string $hash
* @param array $names
* @param string $subject
* @param string $body
* @param \DateTimeImmutable $date
* @param string $author
public function __construct(
string $hash,
array $names,
string $subject,
string $body,
\DateTimeImmutable $date,
string $author
)
$this->hash = $hash;
$this->names = $names;
$this->subject = $subject;
$this->body = $body;
$this->date = $date;
$this->author = $author;
}
* Hash getter.
* @return string
public function getHash(): string
return $this->hash;
* Does the commit have names.
* @return bool
public function hasNames(): bool
return !empty($this->names);
* Names getter.
* @return array
public function getNames(): array
return $this->names;
* Description getter.
* @deprecated
public function getDescription(): string
return $this->getSubject();
* Subject getter.
public function getSubject(): string
return $this->subject;
* Body getter.
public function getBody(): string
return $this->body;
* Date getter.
* @return \DateTimeImmutable
public function getDate(): \DateTimeImmutable
return $this->date;
* Author getter.
public function getAuthor(): string
return $this->author;