New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make PagedListResponse iterable #221
Make PagedListResponse iterable #221
Conversation
Codecov Report
@@ Coverage Diff @@
## master #221 +/- ##
==========================================
+ Coverage 85.88% 85.89% +0.01%
==========================================
Files 68 68
Lines 2550 2552 +2
==========================================
+ Hits 2190 2192 +2
Misses 360 360
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great!
Only thing I can think of is if we want to show the recommended way to NOT iterate over all results, e.g.:
$page = $pagedListResponse->getPage();
if ($page->hasNextPage()) {
$nextPage = $page->getNextPage();
}
Can you think of a place it would make sense to put this?
@bshaffer added examples in the class comments - WDYT? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks nice, just one minor nit!
src/PagedListResponse.php
Outdated
* ``` | ||
* $pagedListResponse = $client->getList(...); | ||
* foreach ($pagedListResponse as $element) { | ||
* // doSomethingWith($element); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
What a guy! |
PTAL, and let me know whether we need more or clearer documentation. cc @sirtorry, @tmatsuo
Closes #153