FeatureFlags
extends Response
in package
Represents additional features supported by the anchor for SEP-24 operations
This class contains flags indicating which optional features the anchor supports for deposit and withdrawal operations. These features enhance the flexibility of the anchor's service but are not required by the SEP-24 specification.
Account creation support allows the anchor to create new Stellar accounts for users who don't yet have one. Claimable balance support enables the anchor to send deposit funds as claimable balances, which is useful for recipients without established trustlines to the deposited asset.
Tags
Table of Contents
Properties
- $accountCreation : bool
- $claimableBalances : bool
- $httpClient : Client|null
- $rateLimitLimit : int|null
- $rateLimitRemaining : int|null
- $rateLimitReset : int|null
Methods
- fromJson() : FeatureFlags
- Constructs a new FeatureFlags object from the given data array.
- getHttpClient() : Client|null
- Gets the HTTP client used for pagination requests
- getRateLimitLimit() : int|null
- Returns X-RateLimit-Limit header from the response.
- getRateLimitRemaining() : int|null
- Returns X-RateLimit-Remaining header from the response.
- getRateLimitReset() : int|null
- Returns X-RateLimit-Reset header from the response. Seconds until a new window starts.
- isAccountCreation() : bool
- isClaimableBalances() : bool
- setAccountCreation() : void
- setClaimableBalances() : void
- setHeaders() : void
- Extracts and sets rate limiting information from HTTP response headers
- setHttpClient() : void
- Sets the HTTP client for making follow-up requests
- loadFromJson() : void
- Loads the needed data from a json array.
Properties
$accountCreation
public
bool
$accountCreation
= true
Whether the anchor supports creating accounts for users requesting deposits. Defaults to true.
$claimableBalances
public
bool
$claimableBalances
= false
Whether the anchor supports sending deposit funds as claimable balances. This is relevant for users of Stellar accounts without a trustline to the requested asset. Defaults to false.
$httpClient
protected
Client|null
$httpClient
= null
$rateLimitLimit
protected
int|null
$rateLimitLimit
= null
$rateLimitRemaining
protected
int|null
$rateLimitRemaining
= null
$rateLimitReset
protected
int|null
$rateLimitReset
= null
Methods
fromJson()
Constructs a new FeatureFlags object from the given data array.
public
static fromJson(array<string|int, mixed> $json) : FeatureFlags
Parameters
- $json : array<string|int, mixed>
-
the data array to extract the needed values from.
Return values
FeatureFlags —the constructed FeatureFlags object.
getHttpClient()
Gets the HTTP client used for pagination requests
public
getHttpClient() : Client|null
Return values
Client|null —The HTTP client instance, or null if not set
getRateLimitLimit()
Returns X-RateLimit-Limit header from the response.
public
getRateLimitLimit() : int|null
This number represents the he maximum number of requests that the current client can make in one hour.
Tags
Return values
int|nullgetRateLimitRemaining()
Returns X-RateLimit-Remaining header from the response.
public
getRateLimitRemaining() : int|null
The number of remaining requests for the current window.
Tags
Return values
int|nullgetRateLimitReset()
Returns X-RateLimit-Reset header from the response. Seconds until a new window starts.
public
getRateLimitReset() : int|null
Tags
Return values
int|nullisAccountCreation()
public
isAccountCreation() : bool
Return values
bool —Whether the anchor supports creating accounts for users requesting deposits. Defaults to true.
isClaimableBalances()
public
isClaimableBalances() : bool
Return values
bool —Whether the anchor supports sending deposit funds as claimable balances. This is relevant for users of Stellar accounts without a trustline to the requested asset. Defaults to false.
setAccountCreation()
public
setAccountCreation(bool $accountCreation) : void
Parameters
- $accountCreation : bool
-
Whether the anchor supports creating accounts for users requesting deposits. Defaults to true.
setClaimableBalances()
public
setClaimableBalances(bool $claimableBalances) : void
Parameters
- $claimableBalances : bool
-
Whether the anchor supports sending deposit funds as claimable balances. This is relevant for users of Stellar accounts without a trustline to the requested asset. Defaults to false.
setHeaders()
Extracts and sets rate limiting information from HTTP response headers
public
setHeaders(array<string|int, mixed> $headers) : void
This method processes the X-Ratelimit-* headers from the HTTP response and stores them for client access.
Parameters
- $headers : array<string|int, mixed>
-
Associative array of HTTP headers from the response
setHttpClient()
Sets the HTTP client for making follow-up requests
public
setHttpClient([Client|null $httpClient = null ]) : void
Paginated responses contain links to next/previous pages. This HTTP client is used when following those links to fetch additional pages.
Parameters
- $httpClient : Client|null = null
-
The Guzzle HTTP client to use for pagination
loadFromJson()
Loads the needed data from a json array.
protected
loadFromJson(array<string|int, mixed> $json) : void
Parameters
- $json : array<string|int, mixed>
-
the data array to read from.