Skip to content

Commit

Permalink
fix example
Browse files Browse the repository at this point in the history
  • Loading branch information
Naoray committed Oct 27, 2023
1 parent bc69d2f commit 01b313f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions examples/pagination/backwards.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,20 @@
$orderId = 'ord_8wmqcHMN4U';

// cursor paginating backwards through all orders
$page = $client->orders->page($orderId);
$page = $mollie->orders->page($orderId);

while ($page->hasPrevious()) {
foreach ($page as $order) {
echo($order->id);
echo ($order->id);
}

$page = $page->previous();
}

// iterating backwards using the iterator by passing iterateBackwards = true
// in php 8.0+ you could also use the named parameter syntax iterator(iterateBackwards: true)
foreach ($client->orders->iterator(null, null, [], true) as $order) {
echo($order->id);
foreach ($mollie->orders->iterator(null, null, [], true) as $order) {
echo ($order->id);
}
} catch (\Mollie\Api\Exceptions\ApiException $e) {
echo "API call failed: " . htmlspecialchars($e->getMessage());
Expand Down
8 changes: 4 additions & 4 deletions examples/pagination/basic_usage.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,20 @@


// cursor paginating through all orders
$page = $client->orders->page();
$page = $mollie->orders->page();

while ($page->hasNext()) {
foreach ($page as $order) {
echo($order->id);
echo ($order->id);
}

$page = $page->next();
}


// using the iterator we can iterate over all orders directly
foreach ($client->orders->iterator() as $order) {
echo($order->id);
foreach ($mollie->orders->iterator() as $order) {
echo ($order->id);
}
} catch (\Mollie\Api\Exceptions\ApiException $e) {
echo "API call failed: " . htmlspecialchars($e->getMessage());
Expand Down

0 comments on commit 01b313f

Please sign in to comment.