/**
  * 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);
 }
Example #2
0
 /**
  * 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);
 }