[ Index ]

PHP Cross Reference of Limb3

title

Body

[close]

/core/src/ -> lmbCollectionDecorator.class.php (source)

   1  <?php
   2  /*
   3   * Limb PHP Framework
   4   *
   5   * @link http://limb-project.com 
   6   * @copyright  Copyright &copy; 2004-2007 BIT(http://bit-creative.com)
   7   * @license    LGPL http://www.gnu.org/copyleft/lesser.html 
   8   */
   9  lmb_require('limb/core/src/lmbCollectionInterface.interface.php');
  10  
  11  /**

  12   * class lmbCollectionDecorator.

  13   *

  14   * @package core

  15   * @version $Id$

  16   */
  17  class lmbCollectionDecorator implements lmbCollectionInterface
  18  {
  19    protected $iterator;
  20  
  21    function __construct($iterator)
  22    {
  23      $this->iterator = $iterator;
  24    }
  25  
  26    function valid()
  27    {
  28      return $this->iterator->valid();
  29    }
  30  
  31    function current()
  32    {
  33      return $this->iterator->current();
  34    }
  35  
  36    function next()
  37    {
  38      $this->iterator->next();
  39    }
  40  
  41    function rewind()
  42    {
  43      $this->iterator->rewind();
  44    }
  45  
  46    function key()
  47    {
  48      return $this->iterator->key();
  49    }
  50  
  51    function sort($params)
  52    {
  53      $this->iterator->sort($params);
  54      return $this;
  55    }
  56  
  57    function getArray()
  58    {
  59      $result = array();
  60      foreach($this as $object)
  61        $result[] = $object;
  62      return $result;
  63    }
  64  
  65    function at($pos)
  66    {
  67      return $this->iterator->at($pos);
  68    }
  69  
  70    function paginate($offset, $limit)
  71    {
  72      $this->iterator->paginate($offset, $limit);
  73      return $this;
  74    }
  75  
  76    function getOffset()
  77    {
  78      return $this->iterator->getOffset();
  79    }
  80  
  81    function getLimit()
  82    {
  83      return $this->iterator->getLimit();
  84    }
  85  
  86    function countPaginated()
  87    {
  88      return $this->iterator->countPaginated();
  89    }
  90  
  91    //Countable interface
  92    function count()
  93    {
  94      return $this->iterator->count();
  95    }
  96    //end
  97  
  98    //ArrayAccess interface
  99    function offsetExists($offset)
 100    {
 101      return !is_null($this->at($offset));
 102    }
 103  
 104    function offsetGet($offset)
 105    {
 106      return $this->at($offset);
 107    }
 108  
 109    function offsetSet($offset, $value)
 110    {
 111      return $this->iterator->offsetSet($offset, $value);
 112    }
 113  
 114    function offsetUnset($offset)
 115    {
 116      return $this->iterator->offsetUnset($offset);
 117    }
 118    //end
 119  }
 120  ?>


Generated: Fri Aug 29 04:49:26 2008 Cross-referenced by PHPXref 0.7