Skip to content

Commit

Permalink
Improved pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
U-KALTURA\Jonathan.Kanarek authored and U-KALTURA\Jonathan.Kanarek committed Aug 17, 2016
1 parent d9ea507 commit 17d21d4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Expand Up @@ -147,6 +147,10 @@ foreach($repos as $repo)
echo "\t$sha - $message\n";
}


if(!$client->hasNextPage())
break;

$commits = $client->getNextPage();
if($client->getPage() == $page)
break;
Expand Down
5 changes: 5 additions & 0 deletions client/GitHubClientBase.php
Expand Up @@ -152,6 +152,11 @@ public function getFirstPage()
return $this->requestLast($this->lastData);
}

public function hasNextPage()
{
return !is_null($this->page);
}

public function getNextPage()
{
if(isset($this->pageData['next']))
Expand Down

0 comments on commit 17d21d4

Please sign in to comment.