Interface Xyster_Collection_Map_Interface

Description

Interface for key-based collections

  • copyright: Copyright (c) 2007-2008 Irrational Logic (http://irrationallogic.net)
  • license: New BSD License

Located in /Collection/Map/Interface.php (line 23)

Countable
   |
   --Xyster_Collection_Map_Interface
Method Summary
void clear ()
boolean containsKey (mixed $key)
boolean containsValue (mixed $item)
mixed get (mixed $key)
boolean isEmpty ()
mixed keyFor (mixed $value)
void remove (mixed $key)
void set (mixed $key, mixed $value)
array toArray ()
Methods
clear (line 30)

Removes all items from the collection

  • throws: Xyster_Collection_Exception if the collection cannot be modified
void clear ()
containsKey (line 42)

Tests to see whether the map contains the key supplied

If the supplied value is an object, and the map allows objects as keys, the comparison will be done for identity (===) and not for value (==).

This method is an alias to ArrayAccess::offsetExists

  • return: Whether the map contains the supplied key
boolean containsKey (mixed $key)
  • mixed $key: The key to test
containsValue (line 52)

Tests to see whether the map contains the value supplied

If the supplied value is an object, the comparison will be done for identity (===) and not for value (==).

  • return: Whether the map contains the supplied value
boolean containsValue (mixed $item)
  • mixed $item: The item to test
get (line 62)

Gets the value corresponding to the supplied key

This method could return null if the value is null, or if the value was not found. Use containsValue to check which is true.

  • return: The value found, or null if none
mixed get (mixed $key)
  • mixed $key
isEmpty (line 94)

Tests to see if the collection contains no elements

The return value from this method should be equivalent to

  1. $collection->count(== )
.

  • return: Whether this collection has no elements
boolean isEmpty ()
keyFor (line 78)

Gets the first key found for the value supplied

This method could return null if the key is null, or if the key was not found. Use containsKey to check which is true.

  • return: The key found, or null if none
mixed keyFor (mixed $value)
  • mixed $value
keys (line 68)

Gets all keys contained in this map

  • return: The keys in this map
keysFor (line 85)

Gets all keys for the value supplied

Xyster_Collection_Set_Interface keysFor (mixed $value)
  • mixed $value: The value for which to search
merge (line 106)

Combines this map with the supplied map

The values in the supplied map will take precedence if this map and the supplied map have duplicate keys.

  • return: Whether the map changed as a result of this method
  • throws: Xyster_Collection_Exception If the map cannot be modified
  • throws: InvalidArgumentException if any of the keys or values are invalid for this map
boolean merge (Xyster_Collection_Map_Interface $map)
  • Xyster_Map_Interface $map
remove (line 115)

Removes the mapping for the specified key

This method is an alias to ArrayAccess::offsetUnset

  • throws: Xyster_Collection_Exception If the map cannot be modified
void remove (mixed $key)
  • mixed $key
set (line 125)

Sets a mapping for the key and value supplied

This method is an alias to ArrayAccess::offsetSet

  • throws: Xyster_Collection_Exception If the map cannot be modified
void set (mixed $key, mixed $value)
  • mixed $key
  • mixed $value
toArray (line 135)

Puts the items in this collection into an array

For Maps that allow for scalar-only keys, this array should have the map keys as keys and values as values. If the map allows complex types as keys, this array should contain objects with the key and value available.

  • return: The items in this collection
array toArray ()
values (line 141)

Gets the values contained in this map

Documentation generated on Mon, 19 May 2008 17:07:23 -0400 by phpDocumentor 1.4.2