HumHub Documentation (unofficial)

PriorityList
in package
implements Iterator, Countable

Tags
template

TKey of string

template

TValue of mixed

template-implements

Iterator<TKey, TValue>

Table of Contents

Interfaces

Iterator
Countable

Constants

EXTR_BOTH  = 0x3
EXTR_DATA  = 0x1
EXTR_PRIORITY  = 0x2

Properties

$count  : int
Internal counter to avoid usage of count().
$isLIFO  : int
Serial order mode
$items  : mixed
Internal list of all items.
$serial  : positive-int|0
Serial assigned to items to preserve LIFO.
$sorted  : bool
Whether the list was already sorted.

Methods

clear()  : void
Remove all items.
count()  : mixed
{@inheritDoc}
current()  : mixed
{@inheritDoc}
get()  : TValue|null
Get a item.
getIterator()  : self
insert()  : void
Insert a new item.
isLIFO()  : bool
Get/Set serial order mode
key()  : mixed
{@inheritDoc}
next()  : mixed
{@inheritDoc}
remove()  : void
Remove a item.
rewind()  : mixed
{@inheritDoc}
setPriority()  : $this
toArray()  : array<string|int, mixed>
Return list as array
valid()  : mixed
{@inheritDoc}
compare()  : int
Compare the priority of two items.
sort()  : void
Sort all items.

Constants

Properties

$count

Internal counter to avoid usage of count().

protected int $count = 0

$items

Internal list of all items.

protected mixed $items = []

$serial

Serial assigned to items to preserve LIFO.

protected positive-int|0 $serial = 0

$sorted

Whether the list was already sorted.

protected bool $sorted = false

Methods

get()

Get a item.

public get(TKey $name) : TValue|null
Parameters
$name : TKey
Return values
TValue|null

getIterator()

public getIterator() : self
Return values
self

insert()

Insert a new item.

public insert(TKey $name, TValue $value[, int $priority = 0 ]) : void
Parameters
$name : TKey
$value : TValue
$priority : int = 0

isLIFO()

Get/Set serial order mode

public isLIFO([bool|null $flag = null ]) : bool
Parameters
$flag : bool|null = null
Return values
bool

remove()

Remove a item.

public remove(TKey $name) : void
Parameters
$name : TKey

setPriority()

public setPriority(TKey $name, int $priority) : $this
Parameters
$name : TKey
$priority : int
Tags
throws
Exception
Return values
$this

toArray()

Return list as array

public toArray([int $flag = self::EXTR_DATA ]) : array<string|int, mixed>
Parameters
$flag : int = self::EXTR_DATA
Return values
array<string|int, mixed>

compare()

Compare the priority of two items.

protected compare(array<string|int, mixed> $item1, array<string|int, mixed> $item2) : int
Parameters
$item1 : array<string|int, mixed>

,

$item2 : array<string|int, mixed>
Return values
int

        
On this page

Search results