ArrayObject
in package
implements
IteratorAggregate, ArrayAccess, Serializable, Countable
Custom framework ArrayObject implementation
Extends version-specific "abstract" implementation.
Tags
Attributes
- #[AllowDynamicProperties]
Table of Contents
Interfaces
- IteratorAggregate
- ArrayAccess
- Serializable
- Countable
Constants
- ARRAY_AS_PROPS = 2
- Entries can be accessed as properties (read and write).
- STD_PROP_LIST = 1
- Properties of the object have their normal functionality when accessed as list (var_dump, foreach, etc.).
Properties
- $flag : self::STD_PROP_LIST|self::ARRAY_AS_PROPS
- $iteratorClass : Iterator>
- $protectedProperties : array<int, string>
- $storage : mixed
Methods
- __construct() : mixed
- __get() : TValue|null
- Returns the value at the specified key by reference
- __isset() : bool
- Returns whether the requested key exists
- __serialize() : array<string, mixed>
- Magic method used for serializing of an instance.
- __set() : void
- Sets the value at the specified key to value
- __unserialize() : void
- Magic method used to rebuild an instance.
- __unset() : void
- Unsets the value at the specified key
- append() : void
- Appends the value
- asort() : void
- Sort the entries by value
- count() : positive-int|0
- Get the number of public properties in the ArrayObject
- exchangeArray() : mixed
- Exchange the array for another one.
- getArrayCopy() : mixed
- Creates a copy of the ArrayObject.
- getFlags() : self::STD_PROP_LIST|self::ARRAY_AS_PROPS
- Gets the behavior flags.
- getIterator() : Iterator<TKey, TValue>
- Create a new iterator from an ArrayObject instance
- getIteratorClass() : Iterator>
- Gets the iterator classname for the ArrayObject.
- ksort() : void
- Sort the entries by key
- natcasesort() : void
- Sort an array using a case insensitive "natural order" algorithm
- natsort() : void
- Sort entries using a "natural order" algorithm
- offsetExists() : bool
- Returns whether the requested key exists
- offsetGet() : TValue|null
- {@inheritDoc}
- offsetSet() : void
- Sets the value at the specified key to value
- offsetUnset() : void
- Unsets the value at the specified key
- serialize() : string
- Serialize an ArrayObject
- setFlags() : void
- Sets the behavior flags
- setIteratorClass() : void
- Sets the iterator classname for the ArrayObject
- uasort() : void
- Sort the entries with a user-defined comparison function and maintain key association
- uksort() : void
- Sort the entries by keys using a user-defined comparison function
- unserialize() : void
- Unserialize an ArrayObject
Constants
ARRAY_AS_PROPS
Entries can be accessed as properties (read and write).
public
mixed
ARRAY_AS_PROPS
= 2
STD_PROP_LIST
Properties of the object have their normal functionality when accessed as list (var_dump, foreach, etc.).
public
mixed
STD_PROP_LIST
= 1
Properties
$flag
protected
self::STD_PROP_LIST|self::ARRAY_AS_PROPS
$flag
$iteratorClass
protected
Iterator>
$iteratorClass
$protectedProperties
protected
array<int, string>
$protectedProperties
$storage
protected
mixed
$storage
Methods
__construct()
public
__construct([mixed $input = [] ][, self::STD_PROP_LIST|self::ARRAY_AS_PROPS $flags = self::STD_PROP_LIST ][, Iterator> $iteratorClass = ArrayIterator::class ]) : mixed
Parameters
- $input : mixed = []
- $flags : self::STD_PROP_LIST|self::ARRAY_AS_PROPS = self::STD_PROP_LIST
- $iteratorClass : Iterator> = ArrayIterator::class
__get()
Returns the value at the specified key by reference
public
& __get(TKey $key) : TValue|null
Parameters
- $key : TKey
Return values
TValue|null__isset()
Returns whether the requested key exists
public
__isset(TKey $key) : bool
Parameters
- $key : TKey
Return values
bool__serialize()
Magic method used for serializing of an instance.
public
__serialize() : array<string, mixed>
Return values
array<string, mixed>__set()
Sets the value at the specified key to value
public
__set(TKey $key, TValue $value) : void
Parameters
- $key : TKey
- $value : TValue
__unserialize()
Magic method used to rebuild an instance.
public
__unserialize(array<string|int, mixed> $data) : void
Parameters
- $data : array<string|int, mixed>
-
Data array.
__unset()
Unsets the value at the specified key
public
__unset(TKey $key) : void
Parameters
- $key : TKey
append()
Appends the value
public
append(TValue $value) : void
Parameters
- $value : TValue
asort()
Sort the entries by value
public
asort() : void
count()
Get the number of public properties in the ArrayObject
public
count() : positive-int|0
Attributes
Return values
positive-int|0exchangeArray()
Exchange the array for another one.
public
exchangeArray(mixed $data) : mixed
Parameters
- $data : mixed
getArrayCopy()
Creates a copy of the ArrayObject.
public
getArrayCopy() : mixed
getFlags()
Gets the behavior flags.
public
getFlags() : self::STD_PROP_LIST|self::ARRAY_AS_PROPS
Return values
self::STD_PROP_LIST|self::ARRAY_AS_PROPSgetIterator()
Create a new iterator from an ArrayObject instance
public
getIterator() : Iterator<TKey, TValue>
Attributes
Return values
Iterator<TKey, TValue>getIteratorClass()
Gets the iterator classname for the ArrayObject.
public
getIteratorClass() : Iterator>
Return values
Iterator>ksort()
Sort the entries by key
public
ksort() : void
natcasesort()
Sort an array using a case insensitive "natural order" algorithm
public
natcasesort() : void
natsort()
Sort entries using a "natural order" algorithm
public
natsort() : void
offsetExists()
Returns whether the requested key exists
public
offsetExists(TKey $key) : bool
Parameters
- $key : TKey
Attributes
Return values
booloffsetGet()
{@inheritDoc}
public
& offsetGet(TKey $key) : TValue|null
Parameters
- $key : TKey
Attributes
Return values
TValue|nulloffsetSet()
Sets the value at the specified key to value
public
offsetSet(TKey $key, TValue $value) : void
Parameters
- $key : TKey
- $value : TValue
Attributes
offsetUnset()
Unsets the value at the specified key
public
offsetUnset(TKey $key) : void
Parameters
- $key : TKey
Attributes
serialize()
Serialize an ArrayObject
public
serialize() : string
Return values
stringsetFlags()
Sets the behavior flags
public
setFlags(self::STD_PROP_LIST|self::ARRAY_AS_PROPS $flags) : void
Parameters
- $flags : self::STD_PROP_LIST|self::ARRAY_AS_PROPS
setIteratorClass()
Sets the iterator classname for the ArrayObject
public
setIteratorClass(Iterator> $class) : void
Parameters
- $class : Iterator>
uasort()
Sort the entries with a user-defined comparison function and maintain key association
public
uasort(callable(TValue, TValue): int $function) : void
Parameters
- $function : callable(TValue, TValue): int
uksort()
Sort the entries by keys using a user-defined comparison function
public
uksort(callable(TKey, TKey): int $function) : void
Parameters
- $function : callable(TKey, TKey): int
unserialize()
Unserialize an ArrayObject
public
unserialize(string $data) : void
Parameters
- $data : string