TransactionsResponse
extends IteratorIterator
in package
Represents an iterable collection of transaction responses
This collection holds multiple TransactionResponse objects and provides convenient iteration, counting, and array conversion capabilities. It extends IteratorIterator to allow direct use in foreach loops and other iteration contexts.
Typically populated within a TransactionsPageResponse when querying transaction lists from Horizon. The collection can be dynamically expanded by adding new transaction responses.
Usage patterns:
- Iterate: foreach ($transactions as $transaction) { ... }
- Count: $transactions->count()
- Convert: $array = $transactions->toArray()
- Add: $transactions->add($newTransaction)
Tags
Table of Contents
Methods
- __construct() : mixed
- Creates a new transactions collection
- add() : void
- Adds a transaction to the collection
- count() : int
- Gets the number of transactions in the collection
- current() : TransactionResponse
- Gets the current transaction in the iteration
- toArray() : array<string|int, TransactionResponse>
- Converts the transaction collection to an array
Methods
__construct()
Creates a new transactions collection
public
__construct(TransactionResponse ...$transactions) : mixed
Parameters
- $transactions : TransactionResponse
-
Variable number of transaction response objects
add()
Adds a transaction to the collection
public
add(TransactionResponse $transaction) : void
Parameters
- $transaction : TransactionResponse
-
The transaction response to add
count()
Gets the number of transactions in the collection
public
count() : int
Return values
int —The transaction count
current()
Gets the current transaction in the iteration
public
current() : TransactionResponse
Return values
TransactionResponse —The transaction at the current iterator position
toArray()
Converts the transaction collection to an array
public
toArray() : array<string|int, TransactionResponse>
Return values
array<string|int, TransactionResponse> —Array of transaction response objects