Example #1
0
 /**
  * Used inside while() clause for looping array data for $key
  */
 public function each($key = '')
 {
     if (!empty($key)) {
         if (isset($this->_each[$key]) !== true) {
             $list = $this->get($key, array());
             $this->_each[$key] = is_array($list) ? array_values($list) : array();
         }
         if ($item = array_shift($this->_each[$key])) {
             if (is_array($item)) {
                 $registry = new Registry();
                 $registry->setData($item);
                 return $registry;
             }
             return $item;
         }
         unset($this->_each[$key]);
     }
     return false;
 }