Skip to content

BaseArray

Borrowed from ramsey/collection

Properties

items

The items of this array.

protected array $items

Methods

__construct

Constructs a new array object.

public __construct(array $items = []): mixed

Parameters:

Parameter Type Description
$items array The initial items to add to array.

getIterator

Returns array as iterator.

public getIterator(): \Traversable

offsetExists

Returns true if the given offset exists in the array.

public offsetExists(mixed $offset): bool

Parameters:

Parameter Type Description
$offset mixed The offset to check.

offsetGet

Returns the value at the specified offset.

public offsetGet(mixed $offset): mixed

Parameters:

Parameter Type Description
$offset mixed The offset for which a value should be returned.

Return Value:

The value stored at the offset, or null if the offset does not exist.


offsetSet

Sets the given value to the given offset in the array.

public offsetSet(mixed $offset, mixed $value): void

Parameters:

Parameter Type Description
$offset mixed The offset to set.
$value mixed The value to set at the given offset.

offsetUnset

Removes the given offset and its value from the array.

public offsetUnset(mixed $offset): void

Parameters:

Parameter Type Description
$offset mixed The offset to remove from the array.

serialize

Returns a JSON string.

public serialize(): string

unserialize

Converts a serialized string representation into an instance object.

public unserialize(array $items): void

Parameters:

Parameter Type Description
$items array A PHP array to unserialize.

count

Returns the number of items in the array.

public count(): int

clear

Removes all items from array instance.

public clear(): void

toArray

Returns an instance as an array.

public toArray(): array

isEmpty

Returns true if array is empty.

public isEmpty(): bool


Automatically generated on 2025-10-13