class SplObjectStorage implements Countable, SeekableIterator, Serializable, ArrayAccess (View source)

Methods

void
attach(TObject $object, TValue $info = null)

Adds an object in the storage

void
detach(TObject $object)

Removes an object from the storage

bool
contains(TObject $object)

Checks if the storage contains a specific object

int
addAll(TValue> $storage)

Adds all objects from another storage

int
removeAll(TValue> $storage)

Removes objects contained in another storage from the current storage

int
removeAllExcept(TValue> $storage)

Removes all objects except for those contained in another storage from the current storage

mixed
getInfo()

Returns the data associated with the current iterator entry

void
setInfo(TValue $info)

Sets the data associated with the current iterator entry

int
count(int $mode = COUNT_NORMAL)

Returns the number of objects in the storage

void
rewind()

Rewind the iterator to the first storage element

bool
valid()

Returns if the current iterator entry is valid

mixed
key()

Returns the index at which the iterator currently is

mixed
current()

Returns the current storage entry

void
next()

Move to the next entry

void
unserialize(string $data)

Unserializes a storage from its string representation

string|null
serialize()

Serializes the storage

bool
offsetExists(TObject $object)

Checks whether an object exists in the storage

void
offsetSet(TObject $object, TValue $info = null)

Associates data to an object in the storage

void
offsetUnset(TObject $object)

Removes an object from the storage

mixed
offsetGet(TObject $object)

Returns the data associated with an object

string
getHash(TObject $object)

Calculate a unique identifier for the contained objects

array
__serialize()

No description

void
__unserialize(array $data)

No description

array
__debugInfo()

No description

void
seek(int $offset)

No description

Details

void attach(TObject $object, TValue $info = null)

Adds an object in the storage

Parameters

TObject $object

The object to add.

TValue $info

[optional]

The data to associate with the object.

Return Value

void

void detach(TObject $object)

Removes an object from the storage

Parameters

TObject $object

The object to remove.

Return Value

void

bool contains(TObject $object)

Checks if the storage contains a specific object

Parameters

TObject $object

The object to look for.

Return Value

bool

true if the object is in the storage, false otherwise.

int addAll(TValue> $storage)

Adds all objects from another storage

Parameters

TValue> $storage

The storage you want to import.

Return Value

int

int removeAll(TValue> $storage)

Removes objects contained in another storage from the current storage

Parameters

TValue> $storage

The storage containing the elements to remove.

Return Value

int

int removeAllExcept(TValue> $storage)

Since: 5.3.6

Removes all objects except for those contained in another storage from the current storage

Parameters

TValue> $storage

The storage containing the elements to retain in the current storage.

Return Value

int

mixed getInfo()

Returns the data associated with the current iterator entry

Return Value

mixed

The data associated with the current iterator position.

void setInfo(TValue $info)

Sets the data associated with the current iterator entry

Parameters

TValue $info

The data to associate with the current iterator entry.

Return Value

void

int count(int $mode = COUNT_NORMAL)

Returns the number of objects in the storage

Parameters

int $mode [optional]

Return Value

int

The custom count as an integer.

The return value is cast to an integer.

void rewind()

Rewind the iterator to the first storage element

Return Value

void

Any returned value is ignored.

bool valid()

Returns if the current iterator entry is valid

Return Value

bool

The return value will be casted to boolean and then evaluated. Returns true on success or false on failure.

mixed key()

Returns the index at which the iterator currently is

Return Value

mixed

TKey on success, or null on failure.

mixed current()

Returns the current storage entry

Return Value

mixed

Can return any type.

void next()

Move to the next entry

Return Value

void

Any returned value is ignored.

void unserialize(string $data)

Since: 5.2.2

Unserializes a storage from its string representation

Parameters

string $data

The string representation of the object.

Return Value

void

string|null serialize()

Since: 5.2.2

Serializes the storage

Return Value

string|null

The string representation of the object or null

bool offsetExists(TObject $object)

Checks whether an object exists in the storage

Parameters

TObject $object

The object to look for.

Return Value

bool

true on success or false on failure.

The return value will be casted to boolean if non-boolean was returned.

void offsetSet(TObject $object, TValue $info = null)

Associates data to an object in the storage

Parameters

TObject $object

The object to associate data with.

TValue $info

[optional]

The data to associate with the object.

Return Value

void

void offsetUnset(TObject $object)

Removes an object from the storage

Parameters

TObject $object

The object to remove.

Return Value

void

mixed offsetGet(TObject $object)

Returns the data associated with an object

Parameters

TObject $object

The object to look for.

Return Value

mixed

Can return all value types.

string getHash(TObject $object)

Since: 5.4

Calculate a unique identifier for the contained objects

Parameters

TObject $object

object whose identifier is to be calculated.

Return Value

string

A string with the calculated identifier.

array __serialize()

Since: 7.4

No description

Return Value

array

void __unserialize(array $data)

Since: 7.4

No description

Parameters

array $data

Return Value

void

array __debugInfo()

Since: 7.4

No description

Return Value

array

void seek(int $offset)

Since: 8.4

No description

Parameters

int $offset

The position to seek to.

Return Value

void