A
[ class tree: A ] [ index: A ] [ all elements ]

Class: A_Collection

Source Location: /Collection.php

Class Overview


A_Collection


Implements interfaces:

  • Iterator (internal interface)
  • ArrayAccess (internal interface)

Variables

Methods


Child classes:

A_Config_Base
A_Config_Base
A_Db_Activerecord
A_Db_Activerecord

Class Details

[line 16]
A_Collection

Standard collection class that has get/set/has, iterator and array access




[ Top ]


Class Variables

$_data = array()

[line 19]



Tags:

access:  protected

Type:   mixed


[ Top ]



Class Methods


constructor __construct [line 24]

A_Collection __construct( [array $data = array()])



Tags:

access:  public


Overridden in child classes as:

A_Config_Base::__construct()
A_Db_Activerecord::__construct()

Parameters:

array   $data   Initial Collection data

[ Top ]

method add [line 97]

self add( mixed $value, [mixed $ignoreNull = false])

Appends an item to the end of the collection.



Tags:

access:  public


Parameters:

mixed   $value   Value to append to the collection
mixed   $ignoreNull   Won't add null items if set to true (optional, default false)

[ Top ]

method count [line 123]

int count( )

Get the number of items in this Collection



Tags:

access:  public


[ Top ]

method current [line 206]

void current( )



Tags:

see:  Iterator::current()
access:  public



Implementation of:
Iterator::current
[ Top ]

method get [line 65]

void get( mixed $key, [mixed $default = null])

Get value at specified index/key, or null if that key doesn't exist



Tags:

access:  public


Parameters:

mixed   $key   Index of item to get
mixed   $default   Default value if key does not exist. Optional, default null.

[ Top ]

method has [line 158]

boolean has( mixed $key)

Check if this Collection contains the specified key



Tags:

return:  True if key exists
access:  public


Parameters:

mixed   $key  

[ Top ]

method import [line 35]

self import( array $data)

Recursively import data into this Collection, converting sub-arrays into sub-Collections



Tags:

access:  public


Parameters:

array   $data  

[ Top ]

method join [line 186]

string join( string $delimiter)

Put data into string separated by a delimiter



Tags:

access:  public


Parameters:

string   $delimiter  

[ Top ]

method key [line 214]

void key( )



Tags:

see:  Iterator::key()
access:  public


Overridden in child classes as:

A_Db_Activerecord::key()


Implementation of:
Iterator::key
[ Top ]

method next [line 222]

void next( )



Tags:

see:  Iterator::next()
access:  public



Implementation of:
Iterator::next
[ Top ]

method offsetExists [line 250]

void offsetExists( $offset)



Tags:

see:  ArrayAccess::offsetExists()
access:  public



Implementation of:
ArrayAccess::offsetExists

Parameters:

   $offset  

[ Top ]

method offsetGet [line 258]

void offsetGet( $offset)



Tags:

see:  ArrayAccess::offsetGet()
access:  public



Implementation of:
ArrayAccess::offsetGet

Parameters:

   $offset  

[ Top ]

method offsetSet [line 266]

void offsetSet( $offset, $value)



Tags:

see:  ArrayAccess::offsetSet()
access:  public



Implementation of:
ArrayAccess::offsetSet

Parameters:

   $offset  
   $value  

[ Top ]

method offsetUnset [line 274]

void offsetUnset( $offset)



Tags:

see:  ArrayAccess::offsetUnset()
access:  public



Implementation of:
ArrayAccess::offsetUnset

Parameters:

   $offset  

[ Top ]

method remove [line 111]

self remove( mixed $key)

Removed the specified key from this Collection



Tags:

access:  public


Parameters:

mixed   $key  

[ Top ]

method rewind [line 230]

void rewind( )



Tags:

see:  Iterator::rewind()
access:  public



Implementation of:
Iterator::rewind
[ Top ]

method set [line 78]

self set( mixed $key, mixed $value, [mixed $default = null])

Sets the specified key to a value, or a default if the value is null. The key is deleted if default is null



Tags:

access:  public


Parameters:

mixed   $key  
mixed   $value  
mixed   $default   Set as value if $value is strict null. Optional, default null.

[ Top ]

method slice [line 147]

A_Collection slice( int $offset, [int $length = null])

Extract a slice of this Collection into a new Collection



Tags:

access:  public


Parameters:

int   $offset   Offset of slice
int   $length   Length of slice (optional, to end of collection if ommitted)

[ Top ]

method toArray [line 169]

array toArray( [$convertChildren $convertChildren = false])

Convert this Collection to a normal array



Tags:

access:  public


Parameters:

$convertChildren   $convertChildren   Set to true to recursively convert child collections too (optional, default false).

[ Top ]

method userSort [line 134]

self userSort( callback $callback)

Sort this collection (without preserving keys) with a callback function.



Tags:

access:  public


Parameters:

callback   $callback   Function to sort with

[ Top ]

method valid [line 238]

void valid( )



Tags:

see:  Iterator::valid()
access:  public



Implementation of:
Iterator::valid
[ Top ]

method _expand [line 43]

void _expand( $obj, $data)



Tags:

access:  protected


Parameters:

   $obj  
   $data  

[ Top ]

method __get [line 288]

void __get( $key)



Tags:

access:  public


Parameters:

   $key  

[ Top ]

method __set [line 293]

void __set( $key, $value)



Tags:

access:  public


Parameters:

   $key  
   $value  

[ Top ]

method __toString [line 283]

void __toString( )



Tags:

access:  public


[ Top ]


Documentation generated on Sun, 24 Jul 2011 00:03:22 +0000 by phpDocumentor 1.4.3