Documentation

HashTable
in package

Tags
template

T of IComparable

Table of Contents

Properties

$items  : array<string, T>
HashTable elements.
$keyMap  : array<int, string>
HashTable key map.

Methods

__clone()  : mixed
Implement PHP __clone to create a deep clone, not just a shallow copy.
__construct()  : mixed
Create a new HashTable.
add()  : void
Add HashTable item.
addFromSource()  : void
Add HashTable items from source.
clear()  : void
Clear HashTable.
count()  : int
Count.
getByHashCode()  : null|T
Get by hashcode.
getByIndex()  : null|T
Get by index.
getIndexForHashCode()  : false|int
Get index for hash code.
remove()  : void
Remove HashTable item.
toArray()  : array<string|int, T>
HashTable to array.

Properties

$items

HashTable elements.

protected array<string, T> $items = []

$keyMap

HashTable key map.

protected array<int, string> $keyMap = []

Methods

__clone()

Implement PHP __clone to create a deep clone, not just a shallow copy.

public __clone() : mixed

__construct()

Create a new HashTable.

public __construct([array<string|int, T$source = null ]) : mixed
Parameters
$source : array<string|int, T> = null

Optional source array to create HashTable from

add()

Add HashTable item.

public add(T $source) : void
Parameters
$source : T

Item to add

addFromSource()

Add HashTable items from source.

public addFromSource([array<string|int, T$source = null ]) : void
Parameters
$source : array<string|int, T> = null

Source array to create HashTable from

clear()

Clear HashTable.

public clear() : void

count()

Count.

public count() : int
Return values
int

getByHashCode()

Get by hashcode.

public getByHashCode(string $hashCode) : null|T
Parameters
$hashCode : string
Return values
null|T

getByIndex()

Get by index.

public getByIndex(int $index) : null|T
Parameters
$index : int
Return values
null|T

getIndexForHashCode()

Get index for hash code.

public getIndexForHashCode(string $hashCode) : false|int
Parameters
$hashCode : string
Return values
false|int

remove()

Remove HashTable item.

public remove(T $source) : void
Parameters
$source : T

Item to remove

toArray()

HashTable to array.

public toArray() : array<string|int, T>
Return values
array<string|int, T>

        
On this page

Search results