Map.phpView Source

Show: PublicProtectedPrivateinherited
Table of Contents

\Ulrichsg\Collections\Map

Package:
A simple key-value map. Its main advantage over plain arrays is that you never have to call isset() to avoid warnings. Supports square-bracket syntax and foreach loops.
Implements
Children
\Ulrichsg\Collections\NumberMap
License
MIT  
Link
https://github.com/ulrichsg/php-collections  
Version
 

Methods

methodpublic__construct(array $data = array()) : void

Creates a new map with the given array as its contents. Omitting the argument creates an empty map.

methodpubliccount() : int

Returns the number of values in the map.

methodpublicget(mixed $key, mixed $default = null) : mixed

If the map contains the given key, returns the associated value. Otherwise, returns the default value.

methodpublicgetIterator() : \ArrayIterator

Returns an iterator over the map.

methodpublichasKey(mixed $key) : bool

Returns true if the map contains the given key, false otherwise.

methodpublicremove(mixed $key) : void

Removes the given key and its associated value from the map. Does nothing if the key is not in the map.

methodpublicset(mixed $key, mixed $value) : void

Puts the given key-value pair into the map.

Documentation was generated by phpDocumentor 2.0.0b7 .