| Server IP : 213.186.33.4 / Your IP : 216.73.216.193 Web Server : Apache System : Linux webm006.cluster103.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : awebpaca ( 35430) PHP Version : 8.5.0 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/a/w/e/awebpaca/Dolibarr/htdocs/includes/stripe/lib/Util/ |
Upload File : |
<?php
namespace Stripe\Util;
class AutoPagingIterator implements \Iterator
{
private $lastId = null;
private $page = null;
private $pageOffset = 0;
private $params = [];
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 ?: [],
['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;
}
}