ReservesResponse
extends IteratorIterator
in package
Iterable collection of liquidity pool reserve responses
This class provides an iterable wrapper around a collection of ReserveResponse objects representing the asset reserves held in a liquidity pool. Each reserve represents one asset in the pool with its amount. For constant product pools, there are typically two reserves corresponding to the two assets in the trading pair.
The collection supports iteration, counting, array conversion, and dynamic addition of reserve records. Used by LiquidityPoolResponse to represent the pool's asset holdings.
Tags
Table of Contents
Methods
- __construct() : mixed
- Constructs a new reserves collection
- add() : void
- Adds a reserve response to the collection
- count() : int
- Gets the total number of reserves in this collection
- current() : ReserveResponse
- Gets the current reserve in the iteration
- toArray() : array<string|int, ReserveResponse>
Methods
__construct()
Constructs a new reserves collection
public
__construct(ReserveResponse ...$responses) : mixed
Parameters
- $responses : ReserveResponse
-
Variable number of reserve responses
add()
Adds a reserve response to the collection
public
add(ReserveResponse $response) : void
Parameters
- $response : ReserveResponse
-
The reserve response to add
count()
Gets the total number of reserves in this collection
public
count() : int
Return values
int —The count of reserves
current()
Gets the current reserve in the iteration
public
current() : ReserveResponse
Return values
ReserveResponse —The current reserve response
toArray()
public
toArray() : array<string|int, ReserveResponse>