![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/job-board.corals.io/vendor/stripe/stripe-php/lib/Util/ |
<?php namespace Stripe\Util; class AutoPagingIterator implements \Iterator { private $lastId = null; private $page = null; private $pageOffset = 0; private $params = array(); public function __construct($collection, $params) { $this->page = $collection; $this->params = $params; } public function rewind() { // Actually rewinding would require making a copy of the original page. } public function current() { $item = current($this->page->data); $this->lastId = $item !== false ? $item['id'] : null; return $item; } public function key() { return key($this->page->data) + $this->pageOffset; } public function next() { $item = next($this->page->data); if ($item === false) { // If we've run out of data on the current page, try to fetch another one // and increase the offset the new page would start at $this->pageOffset += count($this->page->data); if ($this->page['has_more']) { $this->params = array_merge( $this->params ? $this->params : array(), array('starting_after' => $this->lastId) ); $this->page = $this->page->all($this->params); } else { return false; } } } public function valid() { $key = key($this->page->data); $valid = ($key !== null && $key !== false); return $valid; } }