当前位置: 首页>>代码示例>>PHP>>正文


PHP GitRepository::getNumberOfCommits方法代码示例

本文整理汇总了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);
 }
开发者ID:versionpress,项目名称:versionpress,代码行数:19,代码来源:GitLogPaginator.php

示例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);
 }
开发者ID:wp-cpm,项目名称:versionpress,代码行数:20,代码来源:GitLogPaginator.php


注:本文中的GitRepository::getNumberOfCommits方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。