Interface Xyster_Collection_Interface

Description

Interface for collections

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

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

Countable
   |
   --Xyster_Collection_Interface
Direct descendents
Class Description
Xyster_Collection_Set_Interface A tag interface for no-duplicate collections
Xyster_Collection_List_Interface Index-based collection
Method Summary
boolean add (mixed $item)
void clear ()
boolean contains (mixed $item)
boolean isEmpty ()
boolean merge (Xyster_Collection_Interface $values)
boolean remove (mixed $item)
array toArray ()
Methods
add (line 38)

Adds an item to the collection

Some collections don't accept duplicate values, and should return false if the provided value is already in the collection. If the collection is not allowed to contain the supplied value, an InvalidArgumentException should be thrown.

  • return: Whether the collection changed as a result of this method
  • throws: InvalidArgumentException if the collection cannot contain the value
  • throws: Xyster_Collection_Exception if the collection cannot be modified
boolean add (mixed $item)
  • mixed $item: The item to add
clear (line 44)

Removes all items from the collection

  • throws: Xyster_Collection_Exception if the collection cannot be modified
void clear ()
contains (line 54)

Tests to see whether the collection 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 collection contains the supplied value
boolean contains (mixed $item)
  • mixed $item: The item to test
containsAll (line 61)

Tests to see whether the collection contains all of the supplied values

  • return: Whether the collection contains all of the supplied values
boolean containsAll (Xyster_Collection_Interface $values)
containsAny (line 71)

Tests to see whether the collection contains any of the supplied values

Basically, implementations can safely return true on the first item that is found.

  • return: Whether the collection contains any of the supplied values
boolean containsAny (Xyster_Collection_Interface $values)
isEmpty (line 80)

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 ()
merge (line 97)

Merges the values from the supplied collection into this one

If the implementing collection is not allowed to contain the same value twice, it should only add ones in $values not present in $this. If the implementing collection can contain duplicates, then the values can just be appended.

If the collection is not allowed to contain the supplied value, an InvalidArgumentException should be thrown.

  • return: Whether the collection changed as a result of this method
  • throws: InvalidArgumentException if the collection cannot contain the value
  • throws: Xyster_Collection_Exception if the collection cannot be modified
boolean merge (Xyster_Collection_Interface $values)
remove (line 105)

Removes the specified value from the collection

  • return: If the value was in the collection
  • throws: Xyster_Collection_Exception if the collection cannot be modified
boolean remove (mixed $item)
  • mixed $item: The value to remove
removeAll (line 113)

Removes all of the specified values from the collection

  • return: Whether the collection changed as a result of this method
  • throws: Xyster_Collection_Exception if the collection cannot be modified
boolean removeAll (Xyster_Collection_Interface $values)
retainAll (line 124)

Removes all values from the collection except for the ones specified

If the collection doesn't contain any of the values supplied, it should simply be emptied.

  • return: Whether the collection changed as a result of this method
  • throws: Xyster_Collection_Exception if the collection cannot be modified
boolean retainAll (Xyster_Collection_Interface $values)
toArray (line 130)

Puts the items in this collection into an array

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

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