PathsResponse
extends IteratorIterator
in package
Iterable collection of payment path responses
This class provides an iterable wrapper around a collection of PathResponse objects representing possible asset conversion routes. It extends IteratorIterator to enable efficient traversal of payment paths returned from Horizon API endpoints. The collection supports iteration, counting, array conversion, and dynamic addition of path records.
Used by PathsPageResponse to hold the paths contained in a single page of results. Each item represents a potential route for converting one asset to another through intermediate assets, including the required source amount and resulting destination amount.
Tags
Table of Contents
Methods
- __construct() : mixed
- Constructs a new paths collection
- add() : void
- Adds a path response to the collection
- count() : int
- Gets the total number of paths in this collection
- current() : PathResponse
- Gets the current path in the iteration
- toArray() : array<string|int, PathResponse>
Methods
__construct()
Constructs a new paths collection
public
__construct(PathResponse ...$responses) : mixed
Parameters
- $responses : PathResponse
-
Variable number of path responses
add()
Adds a path response to the collection
public
add(PathResponse $response) : void
Parameters
- $response : PathResponse
-
The path response to add
count()
Gets the total number of paths in this collection
public
count() : int
Return values
int —The count of payment paths
current()
Gets the current path in the iteration
public
current() : PathResponse
Return values
PathResponse —The current path response
toArray()
public
toArray() : array<string|int, PathResponse>