/** * Get the instance as an array. * * @return array */ public function toArray() { $commits = []; /** @var Commit $commit */ foreach ($this->log->getCommits() as $commit) { $commits[] = $this->commitToArray($commit); } return $commits; }
public function fromLog(Log $log) { $log->setLimit(self::DEFAULT_LIMIT); $commits = array(); foreach ($log as $commit) { array_push($commits, array('hash' => $commit->getHash(), 'fixedShortHash' => $commit->getFixedShortHash(), 'message' => $commit->getMessage(), 'shortMessage' => $commit->getShortMessage(), 'authorName' => $commit->getAuthorName(), 'authorEmail' => $commit->getAuthorEmail())); } $this->setCommits($commits); $this->setCommitCount(count($log)); }
/** * {@inheritdoc} */ public function count() { return $this->log->countCommits(); }