TITAN Library for PHP5  5.1.0
Web Software Development Kit for PHP5
iterator Class Reference

Titan Iterator Class. More...

Inheritance diagram for iterator:
callback options cache session

Public Member Functions

 max_count ($max_count=-1)
 
- Public Member Functions inherited from callback
 __construct ($callback=NULL)
 
 callback ($callback=NULL)
 
 argument ($value)
 
 parameter ($name, $value= '')
 
factory (array $arguments=array())
 
execute ()
 

Additional Inherited Members

- Protected Member Functions inherited from callback
arguments (array $arguments=array())
 

Detailed Description

Titan Iterator Class.

Class: \tl\data\iterator

Author
James E. Bush work@.nosp@m.bush.nosp@m..cc
Version
5.1.0

Constructor:

__construct(array $array = array(), $max_count = -1, $delay = -1)

Parameters:
    array    $array      (optional) Initialize with this array
                         (default) empty array
    integer  $max_count  (optional) Maximum iterations before usleep()
                         (default) -1 = do not change the existing max_count (default: 50)
    integer  $delay      (optional) uSeconds to delay execution when maximum iterations is reached
                         (default) -1 = do not change the existing delay (default: 250000 = 0.25 seconds)

Example: $list = new \tl\data\iterator($myArray);

Array Methods:

asort()
    Sort the array and maintain index association

arsort()
    Sort the array in reverse order and maintain index association

krsort()
    Sort the array by key in reverse order

ksort()
    Sort the array by key

rsort()
    Sort the array in reverse order

sort()
    Sort the array

shuffle()
    Shuffle the array

count($mode = null)
    Count all elements in the array
        see also: http://php.net/manual/en/function.count.php

rewind()
    Rewind the position of the internal array pointer of the array

current()
    Return the current element in the array

key()
    Fetch a key from the array

next()
    Advance the internal array pointer of the array

Implemented "magic" methods:

__get($key)
    e.g. $value = $obj->key;

__set($key, $value)
    e.g. $obj->key = $value;

__isset($key)
    e.g. if (isset($obj->key)) { ... }

__unset($key)
    e.g. unset($obj->key);

Example:

    $arry = new \tl\data\iterator([], 10);
    $arry->callback(array('bar', 'foo'));

      is the same as

    $arry = new \tl\data\iterator();
    $arry->max_count(10)->callback(array('bar', 'foo'));

Member Function Documentation

max_count (   $max_count = -1)

put your comment there...

Parameters
mixed$max_count
Returns
iterator

The documentation for this class was generated from the following file: