Documentation

AppObject extends ImmutableArray
in package

Read onlyYes
FinalYes

Immutable array consisting of key-value pairs named properties. Keys are necessarily string, and values can be any data type.

Tags
todo

Force a certain naming style for property keys?

template
extends

ImmutableArray<non-decimal-int-string, TValue, array<string, TValue>>

Table of Contents

Properties

$data  : array<string|int, mixed>

Methods

__construct()  : mixed
all()  : bool
contains()  : bool
count()  : int<0, max>
get()  : TValue
getAppList()  : AppList
getAppObject()  : AppObject<string|int, mixed>
getAppObjectWithItemClass()  : AppObject<string|int, T>
getArray()  : array<string|int, mixed>
getArrayable()  : IArrayable<TKey, mixed>
getBool()  : bool
getBoolOrNull()  : bool|null
getFloat()  : float
getFqcn()  : T>
getInt()  : int
getIntStrictlyPositive()  : positive-int
getIterator()  : Traversable
getNullableObject()  : mixed
getNullableScalar()  : mixed
getString()  : string
hasProperty()  : bool
isEqual()  : bool
keys()  : array<int, TKey>
map()  : TReturn>
offsetExists()  : bool
Built-in method that checks that given offset exists in the array and is STRICTLY the same.
offsetGet()  : mixed
offsetSet()  : void
offsetUnset()  : void
removeProperty()  : TValue>
Create a new AppObject with the specified property removed.
set()  : TValue>
toArray()  : TArray

Properties

Methods

__construct()

public __construct([array<string, TValue$array = [] ]) : mixed
Parameters
$array : array<string, TValue> = []

all()

public all(callable(TValue, TKey): bool $callback) : bool
Parameters
$callback : callable(TValue, TKey): bool
Return values
bool

contains()

public contains(mixed $value) : bool
Parameters
$value : mixed
Return values
bool

count()

public count() : int<0, max>
Attributes
#[Override]
Return values
int<0, max>

get()

public get(TKey $key) : TValue
Parameters
$key : TKey
Return values
TValue

getAppObjectWithItemClass()

public getAppObjectWithItemClass(TKey $key, T> $itemFqcn) : AppObject<string|int, T>
Parameters
$key : TKey
$itemFqcn : T>
Tags
template
Return values
AppObject<string|int, T>

getArray()

public getArray(TKey $key) : array<string|int, mixed>
Parameters
$key : TKey
Return values
array<string|int, mixed>

getBool()

public getBool(TKey $key) : bool
Parameters
$key : TKey
Return values
bool

getBoolOrNull()

public getBoolOrNull(TKey $key) : bool|null
Parameters
$key : TKey
Return values
bool|null

getFloat()

public getFloat(TKey $key) : float
Parameters
$key : TKey
Return values
float

getFqcn()

public getFqcn(TKey $key, T> $fqcn) : T>
Parameters
$key : TKey
$fqcn : T>
Tags
template
Return values
T>

getInt()

public getInt(TKey $key) : int
Parameters
$key : TKey
Return values
int

getIntStrictlyPositive()

public getIntStrictlyPositive(TKey $key) : positive-int
Parameters
$key : TKey
Return values
positive-int

getIterator()

public getIterator() : Traversable
Attributes
#[Override]
Return values
Traversable

getNullableObject()

public getNullableObject(TKey $key, string $fqcn) : mixed
Parameters
$key : TKey
$fqcn : string

getNullableScalar()

public getNullableScalar(TKey $key, string $type) : mixed
Parameters
$key : TKey
$type : string

getString()

public getString(TKey $key) : string
Parameters
$key : TKey
Return values
string

hasProperty()

public hasProperty(string $key) : bool
Parameters
$key : string
Return values
bool

Whether the AppObject instance has the specified property.

isEqual()

public isEqual(self $appObject) : bool
Parameters
$appObject : self
Tags
todo

Could return true even if two objects are not of the same class but both inherit from AppObject.

Do we need this method?

Return values
bool

keys()

public keys() : array<int, TKey>
Return values
array<int, TKey>

map()

public map(callable(TValue): TReturn $callback) : TReturn>
Parameters
$callback : callable(TValue): TReturn
Tags
template
Return values
TReturn>

offsetExists()

Built-in method that checks that given offset exists in the array and is STRICTLY the same.

public offsetExists(TKey $offset) : bool

For instance, an object with the property key '3' will return false if given an offset of 3.

Parameters
$offset : TKey
Attributes
#[Override]
Return values
bool

offsetGet()

public offsetGet(TKey $offset) : mixed
Parameters
$offset : TKey
Attributes
#[Override]

offsetSet()

public offsetSet(mixed $offset, mixed $value) : void
Parameters
$offset : mixed
$value : mixed
Attributes
#[Override]

offsetUnset()

public offsetUnset(mixed $offset) : void
Parameters
$offset : mixed
Attributes
#[Override]

removeProperty()

Create a new AppObject with the specified property removed.

public removeProperty(string $keyToRemove) : TValue>
Parameters
$keyToRemove : string
Return values
TValue>

Another AppObject with the same data as this one, but with the specified key removed.

set()

public set(string $offset, TValue $value) : TValue>
Parameters
$offset : string
$value : TValue

The new value of the specified property.

Return values
TValue>

An identical AppObject with the requested change executed.

toArray()

public toArray() : TArray
Tags
todo

Delete?

Attributes
#[Override]
Return values
TArray
On this page

Search results