Class Hashtable (namespace Nette\Collections)


Provides the base class for a generic collection of keys and values.

ArrayObject
   |
   --Collection
      |
      --Hashtable

Implements interfaces:

Direct Known Sub-classes:

Author: David Grudl
Copyright: Copyright (c) 2004, 2009 David Grudl
Located: in /Collections/Hashtable.php (line 47)
Public Method Summary
bool
add (mixed $key, mixed $item)
Inserts the specified element to the map.
void
append ($item)
Append is not supported.
mixed
get (string $key, [mixed $default = NULL])
Returns variable or $default if there is no element.
void
getKeys ()
Returns a array of the keys contained in this map.
void
import (array|\Traversable $arr)
Import from array or any traversable object.
bool
offsetExists (string $key)
Exists item? (\ArrayAccess implementation).
mixed
offsetGet (string $key)
Returns item (\ArrayAccess implementation).
void
offsetSet (string $key, object $item)
Inserts (replaces) item (\ArrayAccess implementation).
void
offsetUnset (string $key)
Removes the element at the specified position in this list.
mixed
search (mixed $item)
Returns the key of the first occurrence of the specified element,.
void
throwKeyNotFound ([$val = TRUE])
Do throw KeyNotFoundException?
Methods Inherited From Collection
__construct(), append(), beforeAdd(), beforeRemove(), clear(), contains(), exchangeArray(), getClass(), getIterator(), import(), isReadOnly(), remove(), search(), setArray(), setReadOnly(), __call(), __callStatic(), __get(), __isset(), __set(), __unset()
Variable Summary

Method Details

line 61

add

public bool add (mixed $key, mixed $item)

Inserts the specified element to the map.

Implementation of:

Input
mixed $key
mixed $item
Output
bool  
Throws
throws InvalidArgumentException, \InvalidStateException

line 82

append

public void append ($item)

Append is not supported.

Implementation of:

Input
$item
Output
void  

line 145

get

public mixed get (string $key, [mixed $default = NULL])

Returns variable or $default if there is no element.

Input
string $key key
mixed $default default value
Output
mixed  
Throws
throws InvalidArgumentException

line 93

getKeys

public void getKeys ()

Returns a array of the keys contained in this map.

return array

Implementation of:

Output
void  

line 119

import

public void import (array|\Traversable $arr)

Import from array or any traversable object.

Overridden in child classes as:

Input
array|\Traversable $arr
Output
void  
Throws
throws InvalidArgumentException

line 226

offsetExists

public bool offsetExists (string $key)

Exists item? (\ArrayAccess implementation).

Input
string $key key
Output
bool  
Throws
throws InvalidArgumentException

line 201

offsetGet

public mixed offsetGet (string $key)

Returns item (\ArrayAccess implementation).

Input
string $key key
Output
mixed  
Throws
throws KeyNotFoundException, \InvalidArgumentException

line 183

offsetSet

public void offsetSet (string $key, object $item)

Inserts (replaces) item (\ArrayAccess implementation).

Input
string $key key
object $item
Output
void  
Throws
throws NotSupportedException, \InvalidArgumentException

line 243

offsetUnset

public void offsetUnset (string $key)

Removes the element at the specified position in this list.

Input
string $key key
Output
void  
Throws
throws NotSupportedException, \InvalidArgumentException

line 106

search

public mixed search (mixed $item)

Returns the key of the first occurrence of the specified element,.

or FALSE if this map does not contain this element.

Implementation of:

Input
mixed $item
Output
mixed  

line 165

throwKeyNotFound

public void throwKeyNotFound ([$val = TRUE])

Do throw KeyNotFoundException?

Input
$val
Output
void