/** * @param Commit $commitData * @return \Anroots\Pgca\Git\Commit */ private function createCommit(Commit $commitData) { // Remove the last character from the commit message. // This is always a newline due to the way Gitlib works. $commitMessage = substr($commitData->getMessage(), 0, mb_strlen($commitData->getMessage()) - 1); $files = $this->extractFilePaths($commitData->getDiff()->getFiles()); return $this->commitFactory->create(['hash' => $commitData->getHash(), 'message' => $commitMessage, 'shortHash' => $commitData->getShortHash(), 'summary' => $commitData->getSubjectMessage(), 'authorName' => $commitData->getAuthorName(), 'changedFiles' => $files]); }
/** * @param $commit * @return array */ public static function commitToArray(Commit $commit) { $branches = []; foreach ($commit->getIncludingBranches(true, false) as $branch) { $branches[] = $branch->getName(); } return ['hash' => $commit->getHash(), 'shortHash' => $commit->getShortHash(), 'message' => $commit->getMessage(), 'shortMessage' => $commit->getShortMessage(), 'image' => "//www.gravatar.com/avatar/" . md5($commit->getAuthorEmail()), 'branches' => $branches, 'name' => $commit->getAuthorName(), 'email' => $commit->getAuthorEmail(), 'date' => $commit->getCommitterDate()->format(DATE_ISO8601)]; }
/** * @param Release $release * @param $commit * @return array */ protected function describeCommitFields(Release $release, Commit $commit) { return [['title' => 'Commit', 'value' => $commit->getShortHash(), 'short' => true], ['title' => 'Message', 'value' => $commit->getShortMessage(), 'short' => true], ['title' => 'Author', 'value' => $commit->getAuthorName() . '(' . $commit->getAuthorEmail() . ')'], ['title' => 'Details', 'value' => $release->url()]]; }
protected function commitToArray(Commit $commit) { $commitData = array('hash' => $commit->getHash(), 'shortHash' => $commit->getShortHash(), 'parentHashes' => $commit->getParentHashes(), 'shortMessage' => $commit->getShortMessage(), 'authorName' => $commit->getAuthorName(), 'authorEmail' => $commit->getAuthorEmail(), 'authorDate' => $commit->getAuthorDate(), 'message' => $commit->getMessage()); return $commitData; }