本文整理汇总了PHP中GitRepository::getNumberOfCommits方法的典型用法代码示例。如果您正苦于以下问题:PHP GitRepository::getNumberOfCommits方法的具体用法?PHP GitRepository::getNumberOfCommits怎么用?PHP GitRepository::getNumberOfCommits使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GitRepository
的用法示例。
在下文中一共展示了GitRepository::getNumberOfCommits方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPage
/**
* Returns a subset of commits ordered from newest to oldest.
*
* @param $pageNumber
* @return Commit[]
*/
public function getPage($pageNumber)
{
$this->numberOfCommits = $this->repository->getNumberOfCommits($this->query);
$firstCommitIndex = $pageNumber * $this->commitsPerPage;
$lastCommitIndex = ($pageNumber + 1) * $this->commitsPerPage;
if ($lastCommitIndex >= $this->numberOfCommits) {
$this->isLastPage = true;
} else {
$this->isLastPage = false;
}
$query = $this->query . ' --skip=' . $firstCommitIndex . ' --max-count=' . $this->commitsPerPage;
return $this->repository->log($query);
}
示例2: getPage
/**
* Returns a subset of commits ordered from newest to oldest.
*
* @param $pageNumber
* @return Commit[]
*/
public function getPage($pageNumber)
{
$this->numberOfCommits = $this->repository->getNumberOfCommits();
$firstCommitIndex = $pageNumber * $this->commitsPerPage;
$lastCommitIndex = ($pageNumber + 1) * $this->commitsPerPage;
if ($lastCommitIndex >= $this->numberOfCommits) {
$range = sprintf("HEAD~%s", $firstCommitIndex);
$this->isLastPage = true;
} else {
$range = sprintf("HEAD~%s..HEAD~%s", $lastCommitIndex, $firstCommitIndex);
$this->isLastPage = false;
}
return $this->repository->log($range);
}