-
Notifications
You must be signed in to change notification settings - Fork 263
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
CBP tickets #511
CBP tickets #511
Conversation
d3091ee
to
561e493
Compare
561e493
to
f7ba5cc
Compare
34a073e
to
e913988
Compare
e913988
to
b3b232e
Compare
public function valid() | ||
{ | ||
if (!isset($this->tickets[$this->position]) && (!$this->started || $this->afterCursor)) { | ||
$this->getPage(); |
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.
note we only fetch the next page if we're done with the current one. we don't want to fetch all pages and then do all the processing. This is also in the readme.
*/ | ||
public function current() | ||
{ | ||
if (!isset($this->tickets[$this->position]) && (!$this->started || $this->afterCursor)) { |
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.
I just noted this can be abstracted. I'll do that in my next PR.
/** | ||
* @return Ticket The current ticket, possibly fetching a new page. | ||
*/ | ||
public function current() |
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, valid
, key
and other methods are part of the PHP Iterator pattern.
Introducing CBP Iterator for Tickets.
This will be generalized in coming PR.
Usage: See README and tests, but basically:
Note that this PR doesn't address sorting and other params yet. It will be added in a different iteration.