/**
  * Implentation of the Iterator SPL class for Rewind(), 
  * prepares the whole datasource for an entirely new iterator operation
  * 
  * @access public
  */
 public function rewind()
 {
     $this->datasource->rewind();
     //Process the transformers
     if ($this->valid()) {
         $this->transformedData = $this->transform($this->datasource->current(), $this->datasource->key());
     }
 }
Ejemplo n.º 2
0
 /**
  * Return the key of the current element.
  *
  * @return  mixed
  */
 public function key()
 {
     return $this->_iterator->key();
 }
Ejemplo n.º 3
0
 /**
  * Returns the key of the current offset
  *
  * @return Mixed
  */
 function key()
 {
     return isset($this->offset) ? $this->inner->key() : NULL;
 }
Ejemplo n.º 4
0
 /**
  * Implentation of the Iterator SPL class for Key(), 
  * returns the current element's identification of the data source
  * Returns null if nothing found
  * 
  * @access public
  *
  * @return mixed Value.
  */
 public function key()
 {
     return $this->datasource->key();
 }
Ejemplo n.º 5
0
 public function key()
 {
     return $this->input->key();
 }
Ejemplo n.º 6
0
/**
 * Example of applying a callback to capitalize the first letter.
 * 
 * Note that you must return TRUE from the callback function to continue
 * iterating. This can be useful if you wish to stop iteration under
 * certain conditions.
 *
 * @param   Iterator $it
 * @return  bool
 */
function addDbPrefix(Traversable $it, $prefix = 'test')
{
    echo $it[$it->key()] = $prefix . '_' . $it->current();
    echo PHP_EOL;
    return true;
}