final class Set implements Countable, IteratorAggregate, JsonSerializable, ArrayAccess (View source)

Constants

MIN_CAPACITY

Methods

__construct(iterable $values = [])

No description

void
add(TValue ...$values)

No description

void
allocate(int $capacity)

No description

int
capacity()

No description

void
clear()

No description

bool
contains(TValue ...$values)

No description

Set
copy()

No description

int
count()

Count elements of an object

Set
diff(Set $set)

No description

Set
filter(callable|null $callback = null)

No description

TValue
first()

No description

TValue
get(int $index)

No description

getIterator()

No description

Set
intersect(Set $set)

No description

bool
isEmpty()

No description

string
join(string $glue = '')

No description

mixed
jsonSerialize()

No description

TValue
last()

No description

Set
map(callable $callback)

No description

Set
merge(TValue> $values)

No description

TReturn|null
reduce(callable $callback, TInitial|null $initial = null)

No description

void
remove(TValue ...$values)

No description

void
reverse()

No description

Set
reversed()

No description

Set
slice(int $index, int|null $length = null)

No description

void
sort(callable|null $comparator = null)

No description

Set
sorted(callable|null $comparator = null)

No description

int|float
sum()

No description

array
toArray()

No description

Set
union(Set $set)

No description

Set
xor(Set $set)

No description

array
__serialize()

No description

void
__unserialize(array $data)

No description

bool
offsetExists(TKey $offset)

Whether a offset exists

mixed
offsetGet(TKey $offset)

Offset to retrieve

void
offsetSet(TKey $offset, TValue $value)

Offset to set

void
offsetUnset(TKey $offset)

Offset to unset

Details

__construct(iterable $values = [])

No description

Parameters

iterable $values

void add(TValue ...$values)

No description

Parameters

TValue ...$values

Return Value

void

void allocate(int $capacity)

No description

Parameters

int $capacity

Return Value

void

int capacity()

No description

Return Value

int

void clear()

No description

Return Value

void

bool contains(TValue ...$values)

No description

Parameters

TValue ...$values

Return Value

bool

Set copy()

No description

Return Value

Set

int count()

Count elements of an object

Return Value

int

The custom count as an integer.

The return value is cast to an integer.

Set diff(Set $set)

No description

Parameters

Set $set

Return Value

Set

Set filter(callable|null $callback = null)

No description

Parameters

callable|null $callback

Return Value

Set

TValue first()

No description

Return Value

TValue

TValue get(int $index)

No description

Parameters

int $index

Return Value

TValue

Traversable getIterator()

No description

Return Value

Traversable

An instance of an object implementing Iterator or Traversable

Set intersect(Set $set)

No description

Parameters

Set $set

Return Value

Set

bool isEmpty()

No description

Return Value

bool

string join(string $glue = '')

No description

Parameters

string $glue

Return Value

string

mixed jsonSerialize()

No description

Return Value

mixed

data which can be serialized by json_encode, which is a value of any type other than a resource.

TValue last()

No description

Return Value

TValue

Set map(callable $callback)

No description

Parameters

callable $callback

Return Value

Set

Set merge(TValue> $values)

No description

Parameters

TValue> $values

Return Value

Set

TReturn|null reduce(callable $callback, TInitial|null $initial = null)

No description

Parameters

callable $callback
TInitial|null $initial

Return Value

TReturn|null

void remove(TValue ...$values)

No description

Parameters

TValue ...$values

Return Value

void

void reverse()

No description

Return Value

void

Set reversed()

No description

Return Value

Set

Set slice(int $index, int|null $length = null)

No description

Parameters

int $index
int|null $length

Return Value

Set

void sort(callable|null $comparator = null)

No description

Parameters

callable|null $comparator

Return Value

void

Set sorted(callable|null $comparator = null)

No description

Parameters

callable|null $comparator

Return Value

Set

int|float sum()

No description

Return Value

int|float

array toArray()

No description

Return Value

array

Set union(Set $set)

No description

Parameters

Set $set

Return Value

Set

Set xor(Set $set)

No description

Parameters

Set $set

Return Value

Set

array __serialize()

No description

Return Value

array

void __unserialize(array $data)

No description

Parameters

array $data

Return Value

void

bool offsetExists(TKey $offset)

Whether a offset exists

Parameters

TKey $offset

An offset to check for.

Return Value

bool

true on success or false on failure.

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

mixed offsetGet(TKey $offset)

Offset to retrieve

Parameters

TKey $offset

The offset to retrieve.

Return Value

mixed

Can return all value types.

void offsetSet(TKey $offset, TValue $value)

Offset to set

Parameters

TKey $offset

The offset to assign the value to.

TValue $value

The value to set.

Return Value

void

void offsetUnset(TKey $offset)

Offset to unset

Parameters

TKey $offset

The offset to unset.

Return Value

void