[#352] Check if there is a link to follow
Signed-off-by: Roland Dalmulder <contact@rolandd.com>
This commit is contained in:
parent
f250b56718
commit
a083871234
|
@ -564,10 +564,15 @@ class PullModel extends AbstractModel
|
||||||
$filesResponse = $github->getFilesForPullRequest($this->getState()->get('github_user'), $this->getState()->get('github_repo'), $id, $page);
|
$filesResponse = $github->getFilesForPullRequest($this->getState()->get('github_user'), $this->getState()->get('github_repo'), $id, $page);
|
||||||
$files = array_merge($files, json_decode($filesResponse->getBody(), false));
|
$files = array_merge($files, json_decode($filesResponse->getBody(), false));
|
||||||
$lastPage = 1;
|
$lastPage = 1;
|
||||||
|
$headers = $filesResponse->getHeaders();
|
||||||
|
|
||||||
|
if (!isset($headers['link'])) {
|
||||||
|
return $files;
|
||||||
|
}
|
||||||
|
|
||||||
preg_match(
|
preg_match(
|
||||||
'/(\?page=[0-9]{1,3}>; rel=\"last\")/',
|
'/(\?page=[0-9]{1,3}>; rel=\"last\")/',
|
||||||
$filesResponse->getHeaders()['link'][0],
|
$headers['link'][0],
|
||||||
$matches
|
$matches
|
||||||
);
|
);
|
||||||
if ($matches && isset($matches[0])) {
|
if ($matches && isset($matches[0])) {
|
||||||
|
|
Loading…
Reference in New Issue