WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit f4be145

Browse files
ozdemirburakfreekmurze
authored andcommitted
update next page and check the limit, fixes issue #269 (#271)
1 parent 4465b12 commit f4be145

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/AnalyticsClient.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ public function performQuery(string $viewId, DateTime $startDate, DateTime $endD
6767
);
6868

6969
while ($nextLink = $result->getNextLink()) {
70+
if (isset($others['max-results']) && count($result->rows) >= $others['max-results']) {
71+
break;
72+
}
73+
7074
$options = [];
7175

7276
parse_str(substr($nextLink, strpos($nextLink, '?') + 1), $options);
@@ -76,6 +80,8 @@ public function performQuery(string $viewId, DateTime $startDate, DateTime $endD
7680
if ($response->rows) {
7781
$result->rows = array_merge($result->rows, $response->rows);
7882
}
83+
84+
$result->nextLink = $response->nextLink;
7985
}
8086

8187
return $result;

0 commit comments

Comments
 (0)