Class Xyster_Collection_Abstract

Description

Implements interfaces:

Abstract class for collections

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

Located in /Collection/Abstract.php (line 31)


	
			
Direct descendents
Class Description
Xyster_Collection_Set_Abstract Abstract class for no-duplicate collections
Xyster_Collection_List_Abstract Abstract class for index-based collections
Xyster_Validate_Errors An error notification class
Xyster_Collection Implementation of Xyster_Collection_Abstract with static helper methods
Variable Summary
array $_items
Method Summary
boolean add (mixed $item)
void clear ()
boolean contains (mixed $item)
int count ()
SeekableIterator getIterator ()
boolean isEmpty ()
boolean merge (Xyster_Collection_Interface $values)
boolean remove (mixed $item)
array toArray ()
string __toString ()
Variables
array $_items = array() (line 38)

The actual collection entries

  • access: protected
Methods
add (line 46)

Adds an item to the collection

  • return: Whether the collection changed as a result of this method
  • access: public
boolean add (mixed $item)
  • mixed $item: The item to add

Implementation of:
Xyster_Collection_Interface::add()
Adds an item to the collection

Redefined in descendants as:
clear (line 55)

Removes all items from the collection

  • access: public
void clear ()

Implementation of:
Xyster_Collection_Interface::clear()
Removes all items from the collection

Redefined in descendants as:
contains (line 69)

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
  • access: public
boolean contains (mixed $item)
  • mixed $item: The item to test

Implementation of:
Xyster_Collection_Interface::contains()
Tests to see whether the collection contains the value supplied
containsAll (line 80)

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

  • return: Whether the collection contains all of the supplied values
  • access: public
boolean containsAll (Xyster_Collection_Interface $values)

Implementation of:
Xyster_Collection_Interface::containsAll()
Tests to see whether the collection contains all of the supplied values
containsAny (line 99)

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
  • access: public
boolean containsAny (Xyster_Collection_Interface $values)

Implementation of:
Xyster_Collection_Interface::containsAny()
Tests to see whether the collection contains any of the supplied values
count (line 114)

Gets the number of items in the collection

  • return: The number of items
  • access: public
int count ()
getIterator (line 124)

Gets an iterator for the values in the collection

  • access: public
SeekableIterator getIterator ()
isEmpty (line 139)

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
  • access: public
boolean isEmpty ()

Implementation of:
Xyster_Collection_Interface::isEmpty()
Tests to see if the collection contains no elements
merge (line 150)

Merges the values from the supplied collection into this one

  • return: Whether the collection changed as a result of this method
  • access: public
boolean merge (Xyster_Collection_Interface $values)

Implementation of:
Xyster_Collection_Interface::merge()
Merges the values from the supplied collection into this one
remove (line 165)

Removes the specified value from the collection

  • return: If the value was in the collection
  • access: public
boolean remove (mixed $item)
  • mixed $item: The value to remove

Implementation of:
Xyster_Collection_Interface::remove()
Removes the specified value from the collection

Redefined in descendants as:
removeAll (line 182)

Removes all of the specified values from the collection

  • return: Whether the collection changed as a result of this method
  • access: public
boolean removeAll (Xyster_Collection_Interface $values)

Implementation of:
Xyster_Collection_Interface::removeAll()
Removes all of the specified values from the collection

Redefined in descendants as:
retainAll (line 202)

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
  • access: public
boolean retainAll (Xyster_Collection_Interface $values)

Implementation of:
Xyster_Collection_Interface::retainAll()
Removes all values from the collection except for the ones specified

Redefined in descendants as:
toArray (line 222)

Puts the items in this collection into an array

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

Implementation of:
Xyster_Collection_Interface::toArray()
Puts the items in this collection into an array
__toString (line 233)

Converts the collection into a string

  • magic:
  • access: public
string __toString ()

Documentation generated on Mon, 19 May 2008 17:06:52 -0400 by phpDocumentor 1.4.2