final class Set implements Value, Countable, Iterator (View source)

A PHP representation of the CQL set datatype

Methods

__construct(Type $type)

Creates a new collection of a given type.

type()

The type of this set.

array
values()

Array of values in this set.

bool
add(mixed $value)

Adds a value to this set.

bool
has(mixed $value)

Returns whether a value is in this set.

bool
remove(mixed $value)

Removes a value to this set.

int
count()

Total number of elements in this set

mixed
current()

Current element for iteration

mixed
key()

Current key for iteration

void
next()

Move internal iterator forward

bool
valid()

Check whether a current value exists

void
rewind()

Rewind internal iterator

Details

__construct(Type $type)

Creates a new collection of a given type.

Parameters

Type $type

Type type()

The type of this set.

Return Value

Type

array values()

Array of values in this set.

Return Value

array values

bool add(mixed $value)

Adds a value to this set.

Parameters

mixed $value Value

Return Value

bool

whether the value has been added

bool has(mixed $value)

Returns whether a value is in this set.

Parameters

mixed $value Value

Return Value

bool

whether the value is in the set

bool remove(mixed $value)

Removes a value to this set.

Parameters

mixed $value Value

Return Value

bool

whether the value has been removed

int count()

Total number of elements in this set

Return Value

int

The custom count as an integer.

The return value is cast to an integer.

mixed current()

Current element for iteration

Return Value

mixed

Can return any type.

mixed key()

Current key for iteration

Return Value

mixed

TKey on success, or null on failure.

void next()

Move internal iterator forward

Return Value

void

Any returned value is ignored.

bool valid()

Check whether a current value exists

Return Value

bool

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

void rewind()

Rewind internal iterator

Return Value

void

Any returned value is ignored.