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

Titan Iterator Class. More...

Inheritance diagram for iterator:
array_iterator loadable array_iterator fields cache options session

Public Member Functions

 __construct ($max_count=-1, $delay=-1)
 
 max_count ($max_count=-1)
 
 iterator_delay ($delay=-1)
 
 next (&$arry, $max_count=-1)
 
 each (&$arry, $max_count=-1)
 
- Public Member Functions inherited from loadable
 __construct ($class= '', $method= '',...$params)
 
 file ($file)
 
 constructor ($class,...$params)
 
 method ($class, $method,...$params)
 
 func ($function,...$params)
 
 arguments ($type, $value)
 
 values ($name, $value= '')
 
factory_force (...$params)
 
factory (...$params)
 
execute (...$params)
 

Additional Inherited Members

- Protected Member Functions inherited from loadable
process_arguments ($type, array $arguments=[])
 

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($max_count = -1, $delay = -1)

Parameters:
    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();
    $arry->max_count(10);
    $arry->method('bar', 'foo');

Constructor & Destructor Documentation

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

Constructor

Parameters
integer$max_count(optional) The maximum number of iterations to execute before callback method or function and pausing (default) -1 = Use class default (50)
integer$delay(optional) The amount of time in microseconds to pause after calling the callback method or function (default) -1 = Use class default (100000 uSec or 1/10 of a second)

Member Function Documentation

max_count (   $max_count = -1)

Set the maximum number of iterations to execute before callback method or function and pausing

Parameters
integer$max_count(optional) The maximum number of iterations to execute before callback method or function and pausing (default) -1 = Use current value - the class default is 50
iterator_delay (   $delay = -1)

Set the amount of time in microseconds to pause after calling the callback method or function

Parameters
integer$delay(optional) The amount of time in microseconds to pause after calling the callback method or function (default) -1 = Use current value - the class default is 100000 uSec or 1/10 of a second
next ( $arry,
  $max_count = -1 
)

Functions as PHP next() except increments iterator counter and allows an override on internal $max_count

Parameters
mixed$arryThe array being iterated
integer$max_count(optional) The maximum number of iterations to execute before callback method or function and pausing (default) -1 = Use current value - the class default is 50
each ( $arry,
  $max_count = -1 
)

Functions as PHP each() except increments iterator counter and allows an override on internal $max_count

Parameters
mixed$arryThe array being iterated
integer$max_count(optional) The maximum number of iterations to execute before callback method or function and pausing (default) -1 = Use current value - the class default is 50

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