AbiArrayKnownLength
extends AbiTuple
in package
Base class for encoding and decoding ABI (Application Binary Interface) types for Ethereum contracts.
Tags
Table of Contents
Properties
- $emptyType : AbstractABIValue|null
- $inner : array<string|int, AbstractABIValue>
- $length : int
Methods
- __clone() : mixed
- __construct() : mixed
- __toString() : string
- Returns string representation of structure, for known sized arrays with prefix k, for unknown size u, works recursively. The stringified representation purpose is debugging - to see what data and structure was created by bindings etc. It's often more useful representation than print_r or var_dump (with or without XDebug).
- decodeBin() : int
- Decodes the binary data and updates the object(recursive).
- encodeBin() : string
- Encodes the ABI value to its binary representation (recursive).
- isDynamic() : bool
- Checks whether the ABI value is dynamic or not.
- offsetExists() : bool
- offsetGet() : AbstractABIValue
- offsetSet() : void
- offsetUnset() : void
- parseValue() : AbstractABIValue
- Parse the ABI type and value and returns the corresponding AbstractABIValue object.
- splitTypeBits() : array<string|int, mixed>
- Splits the ABI type into its type and bit-length components. Also works for amount of bytes for non-dynamic bytes.
- unwrapToPhpFriendlyVals() : mixed
- Transforms the ABI value into a more PHP-friendly types, such as Common\Address, OOGmp, and such (recursive).
- headLen() : int
- tail() : string
Properties
$emptyType
protected
AbstractABIValue|null
$emptyType
$inner
protected
array<string|int, AbstractABIValue>
$inner
= []
$length
protected
int
$length
Methods
__clone()
public
__clone() : mixed
__construct()
public
__construct(int $length[, AbstractABIValue|null $children = null ]) : mixed
Parameters
- $length : int
- $children : AbstractABIValue|null = null
__toString()
Returns string representation of structure, for known sized arrays with prefix k, for unknown size u, works recursively. The stringified representation purpose is debugging - to see what data and structure was created by bindings etc. It's often more useful representation than print_r or var_dump (with or without XDebug).
public
__toString() : string
Tags
Return values
string —stringified structure, for example (u[k[123,0xabcd],k[456,0x1234]],256)
decodeBin()
Decodes the binary data and updates the object(recursive).
public
decodeBin(string &$dataBin, int $globalOffset) : int
Parameters
- $dataBin : string
-
The binary data to be decoded.
- $globalOffset : int
-
The global offset in the binary data.
Tags
Return values
int —The new global offset.
encodeBin()
Encodes the ABI value to its binary representation (recursive).
public
encodeBin() : string
Tags
Return values
string —The binary-encoded string.
isDynamic()
Checks whether the ABI value is dynamic or not.
public
isDynamic() : bool
Tags
Return values
bool —True if dynamic, false otherwise.
offsetExists()
public
offsetExists(mixed $offset) : bool
Parameters
- $offset : mixed
Tags
Return values
booloffsetGet()
public
offsetGet(mixed $offset) : AbstractABIValue
Parameters
- $offset : mixed
Tags
Return values
AbstractABIValueoffsetSet()
public
offsetSet(mixed $offset, mixed $value) : void
Parameters
- $offset : mixed
- $value : mixed
Tags
offsetUnset()
public
offsetUnset(mixed $offset) : void
Parameters
- $offset : mixed
Tags
parseValue()
Parse the ABI type and value and returns the corresponding AbstractABIValue object.
public
static parseValue(string $type, mixed $value) : AbstractABIValue
Parameters
- $type : string
-
The ABI type.
- $value : mixed
-
The value to be parsed.
Tags
Return values
AbstractABIValue —An instance of the parsed ABI type.
splitTypeBits()
Splits the ABI type into its type and bit-length components. Also works for amount of bytes for non-dynamic bytes.
public
static splitTypeBits(string $type) : array<string|int, mixed>
Parameters
- $type : string
-
The ABI type.
Return values
array<string|int, mixed>unwrapToPhpFriendlyVals()
Transforms the ABI value into a more PHP-friendly types, such as Common\Address, OOGmp, and such (recursive).
public
unwrapToPhpFriendlyVals(array<string|int, mixed>|null $tuplerData) : mixed
Parameters
- $tuplerData : array<string|int, mixed>|null
-
Data structure for wanted tuples, tightly related to ABIGen logic. Always null-safe.
Tags
Return values
mixed —The PHP-friendly value.
headLen()
protected
headLen(AbstractABIValue $val) : int
Parameters
- $val : AbstractABIValue
Tags
Return values
inttail()
protected
tail(AbstractABIValue $val) : string
Parameters
- $val : AbstractABIValue