TypedArray implements ArrayAccess, Countable, IteratorAggregate
Tags
Interfaces, Classes and Traits
- ArrayAccess
- Countable
- IteratorAggregate
Table of Contents
- KEY_CLASS_KINDS = ['class' => 'class', 'interface' => 'interface', 'trait' => 'trait']
- KEY_TYPES = ['bool' => 'bool', 'float' => 'float', 'int' => 'int', 'mixed' => 'mixed', 'object' => 'object', 'resource' => 'resource', 'string' => 'string']
- VALUE_CLASS_KINDS = ['class' => 'class', 'interface' => 'interface', 'trait' => 'trait']
- VALUE_TYPES = ['array' => 'array', 'bool' => 'bool', 'float' => 'float', 'int' => 'int', 'mixed' => 'mixed', 'object' => 'object', 'resource' => 'resource', 'string' => 'string']
- $keyClassKind : string|null
- $keys : array<int|string, mixed>
- The hash map of key's hash codes and keys.
- $keyType : string
- $valueClassKind : string|null
- $values : array<int|string, mixed>
- The hash map of key's hash codes and values.
- $valueType : string
- count() : int
- getIterator() : ArrayIterator<int|string, mixed>
- isEmpty() : bool
- Determines if the typed array is empty or not.
- new() : TypedArray<mixed, mixed>
- Creates a new instance of the typed array.
- offsetExists() : bool
- offsetGet() : mixed
- offsetSet() : void
- offsetUnset() : void
- toArray() : array<int|string, mixed>
- Gets the typed array of values as a plain array.
- withArrayValue() : TypedArray<mixed, array<int|string, mixed>>
- Returns a new instance of the typed array with the array type value.
- withBoolKey() : TypedArray<bool, mixed>
- Returns a new instance of the typed array with the bool type key.
- withBoolValue() : TypedArray<mixed, bool>
- Returns a new instance of the typed array with the bool type value.
- withClassKey() : TypedArray<object, mixed>
- Returns a new instance of the typed array with the specified class type key.
- withClassValue() : TypedArray<mixed, object>
- Returns a new instance of the typed array with the specified class type value.
- withFloatKey() : TypedArray<float, mixed>
- Returns a new instance of the typed array with the float type key.
- withFloatValue() : TypedArray<mixed, float>
- Returns a new instance of the typed array with the float type value.
- withInterfaceKey() : TypedArray<object, mixed>
- Returns a new instance of the typed array with the class type key that implements the specified interface.
- withInterfaceValue() : TypedArray<mixed, object>
- Returns a new instance of the typed array with the class type value that implements the specified interface.
- withIntKey() : TypedArray<int|null, mixed>
- Returns a new instance of the typed array with the int type key.
- withIntValue() : TypedArray<mixed, int>
- Returns a new instance of the typed array with the int type value.
- withMixedKey() : TypedArray<mixed, mixed>
- Returns a new instance of the typed array with the mixed type key.
- withMixedValue() : TypedArray<mixed, mixed>
- Returns a new instance of the typed array with the mixed type value.
- withObjectKey() : TypedArray<object, mixed>
- Returns a new instance of the typed array with the object type key.
- withObjectValue() : TypedArray<mixed, object>
- Returns a new instance of the typed array with the object type value.
- withResourceKey() : TypedArray<resource, mixed>
- Returns a new instance of the typed array with the resource type key.
- withResourceValue() : TypedArray<mixed, resource>
- Returns a new instance of the typed array with the resource type value.
- withStringKey() : TypedArray<string, mixed>
- Returns a new instance of the typed array with the string type key.
- withStringValue() : TypedArray<mixed, string>
- Returns a new instance of the typed array with the string type value.
- withTraitKey() : TypedArray<object, mixed>
- Returns a new instance of the typed array with the class type key that uses the specified trait.
- withTraitValue() : TypedArray<mixed, object>
- Returns a new instance of the typed array with the class type value that uses the specified trait.
- __construct() : mixed
- getKeyHashCode() : int|string|null
- keyExists() : bool
Constants
KEY_CLASS_KINDS
private
mixed
KEY_CLASS_KINDS
= ['class' => 'class', 'interface' => 'interface', 'trait' => 'trait']
KEY_TYPES
private
mixed
KEY_TYPES
= ['bool' => 'bool', 'float' => 'float', 'int' => 'int', 'mixed' => 'mixed', 'object' => 'object', 'resource' => 'resource', 'string' => 'string']
VALUE_CLASS_KINDS
private
mixed
VALUE_CLASS_KINDS
= ['class' => 'class', 'interface' => 'interface', 'trait' => 'trait']
VALUE_TYPES
private
mixed
VALUE_TYPES
= ['array' => 'array', 'bool' => 'bool', 'float' => 'float', 'int' => 'int', 'mixed' => 'mixed', 'object' => 'object', 'resource' => 'resource', 'string' => 'string']
Properties
$keyClassKind
private
string|null
$keyClassKind
$keys
The hash map of key's hash codes and keys.
private
array<int|string, mixed>
$keys
= []
This is only used when the key type is the object, class, interface, or trait type.
Tags
$keyType
private
string
$keyType
Tags
$valueClassKind
private
string|null
$valueClassKind
$values
The hash map of key's hash codes and values.
private
array<int|string, mixed>
$values
= []
Tags
$valueType
private
string
$valueType
Tags
Methods
count()
public
count() : int
Tags
Return values
int —getIterator()
public
getIterator() : ArrayIterator<int|string, mixed>
Tags
Return values
ArrayIterator<int|string, mixed> —isEmpty()
Determines if the typed array is empty or not.
public
isEmpty() : bool
Return values
bool —new()
Creates a new instance of the typed array.
public
static new() : TypedArray<mixed, mixed>
Return values
TypedArray<mixed, mixed> —offsetExists()
public
offsetExists(mixed $key) : bool
Parameters
- $key : mixed
Tags
Return values
bool —offsetGet()
public
offsetGet(mixed $key) : mixed
Parameters
- $key : mixed
Tags
Return values
mixed —offsetSet()
public
offsetSet(mixed $key, mixed $value) : void
Parameters
- $key : mixed
- $value : mixed
Tags
Return values
void —offsetUnset()
public
offsetUnset(mixed $key) : void
Parameters
- $key : mixed
Tags
Return values
void —toArray()
Gets the typed array of values as a plain array.
public
toArray() : array<int|string, mixed>
Tags
Return values
array<int|string, mixed> —withArrayValue()
Returns a new instance of the typed array with the array type value.
public
withArrayValue() : TypedArray<mixed, array<int|string, mixed>>
Tags
Return values
TypedArray<mixed, array<int|string, mixed>> —withBoolKey()
Returns a new instance of the typed array with the bool type key.
public
withBoolKey() : TypedArray<bool, mixed>
Tags
Return values
TypedArray<bool, mixed> —withBoolValue()
Returns a new instance of the typed array with the bool type value.
public
withBoolValue() : TypedArray<mixed, bool>
Tags
Return values
TypedArray<mixed, bool> —withClassKey()
Returns a new instance of the typed array with the specified class type key.
public
withClassKey(string $class) : TypedArray<object, mixed>
If you are using an object as the key, it is recommended that you implement the equals() and hashCode() methods on the object to determine whether keys are equal or not. Otherwise, the === operator and spl_object_id() function are used to determine it.
Parameters
- $class : string
Tags
Return values
TypedArray<object, mixed> —withClassValue()
Returns a new instance of the typed array with the specified class type value.
public
withClassValue(string $class) : TypedArray<mixed, object>
Parameters
- $class : string
Tags
Return values
TypedArray<mixed, object> —withFloatKey()
Returns a new instance of the typed array with the float type key.
public
withFloatKey() : TypedArray<float, mixed>
Tags
Return values
TypedArray<float, mixed> —withFloatValue()
Returns a new instance of the typed array with the float type value.
public
withFloatValue() : TypedArray<mixed, float>
Tags
Return values
TypedArray<mixed, float> —withInterfaceKey()
Returns a new instance of the typed array with the class type key that implements the specified interface.
public
withInterfaceKey(string $interface) : TypedArray<object, mixed>
If you are using an object as the key, it is recommended that you implement the equals() and hashCode() methods on the object to determine whether keys are equal or not. Otherwise, the === operator and spl_object_id() function are used to determine it.
Parameters
- $interface : string
Tags
Return values
TypedArray<object, mixed> —withInterfaceValue()
Returns a new instance of the typed array with the class type value that implements the specified interface.
public
withInterfaceValue(string $interface) : TypedArray<mixed, object>
Parameters
- $interface : string
Tags
Return values
TypedArray<mixed, object> —withIntKey()
Returns a new instance of the typed array with the int type key.
public
withIntKey() : TypedArray<int|null, mixed>
Tags
Return values
TypedArray<int|null, mixed> —withIntValue()
Returns a new instance of the typed array with the int type value.
public
withIntValue() : TypedArray<mixed, int>
Tags
Return values
TypedArray<mixed, int> —withMixedKey()
Returns a new instance of the typed array with the mixed type key.
public
withMixedKey() : TypedArray<mixed, mixed>
Tags
Return values
TypedArray<mixed, mixed> —withMixedValue()
Returns a new instance of the typed array with the mixed type value.
public
withMixedValue() : TypedArray<mixed, mixed>
Tags
Return values
TypedArray<mixed, mixed> —withObjectKey()
Returns a new instance of the typed array with the object type key.
public
withObjectKey() : TypedArray<object, mixed>
If you are using an object as the key, it is recommended that you implement the equals() and hashCode() methods on the object to determine whether keys are equal or not. Otherwise, the === operator and spl_object_id() function are used to determine it.
Tags
Return values
TypedArray<object, mixed> —withObjectValue()
Returns a new instance of the typed array with the object type value.
public
withObjectValue() : TypedArray<mixed, object>
Tags
Return values
TypedArray<mixed, object> —withResourceKey()
Returns a new instance of the typed array with the resource type key.
public
withResourceKey() : TypedArray<resource, mixed>
Tags
Return values
TypedArray<resource, mixed> —withResourceValue()
Returns a new instance of the typed array with the resource type value.
public
withResourceValue() : TypedArray<mixed, resource>
Tags
Return values
TypedArray<mixed, resource> —withStringKey()
Returns a new instance of the typed array with the string type key.
public
withStringKey() : TypedArray<string, mixed>
Tags
Return values
TypedArray<string, mixed> —withStringValue()
Returns a new instance of the typed array with the string type value.
public
withStringValue() : TypedArray<mixed, string>
Tags
Return values
TypedArray<mixed, string> —withTraitKey()
Returns a new instance of the typed array with the class type key that uses the specified trait.
public
withTraitKey(string $trait) : TypedArray<object, mixed>
If you are using an object as the key, it is recommended that you implement the equals() and hashCode() methods on the object to determine whether keys are equal or not. Otherwise, the === operator and spl_object_id() function are used to determine it.
Parameters
- $trait : string
Tags
Return values
TypedArray<object, mixed> —withTraitValue()
Returns a new instance of the typed array with the class type value that uses the specified trait.
public
withTraitValue(string $trait) : TypedArray<mixed, object>
Parameters
- $trait : string
Tags
Return values
TypedArray<mixed, object> —__construct()
private
__construct(string $keyType, string|null $keyClassKind, string $valueType, string|null $valueClassKind) : mixed
Parameters
- $keyType : string
- $keyClassKind : string|null
- $valueType : string
- $valueClassKind : string|null
Return values
mixed —getKeyHashCode()
private
getKeyHashCode(mixed $key) : int|string|null
Parameters
- $key : mixed
Tags
Return values
int|string|null —keyExists()
private
keyExists(mixed $key, int|string|null $keyHashCode) : bool
Parameters
- $key : mixed
- $keyHashCode : int|string|null