コード例 #1
0
ファイル: TPagedMapIterator.php プロジェクト: pradosoft/prado
 /**
  * Constructor.
  * @param array the data to be iterated through
  */
 public function __construct(TMap $map, $startIndex, $count)
 {
     $this->_map = $map;
     $this->_index = 0;
     $this->_startIndex = $startIndex;
     if ($startIndex + $count > $map->getCount()) {
         $this->_count = $map->getCount() - $startIndex;
     } else {
         $this->_count = $count;
     }
     $this->_iterator = $map->getIterator();
 }
コード例 #2
0
ファイル: TMapTest.php プロジェクト: Nurudeen/prado
 public function testConstruct()
 {
     $a = array(1, 2, 'key3' => 3);
     $map = new TMap($a);
     $this->assertEquals(3, $map->getCount());
     $map2 = new TMap($this->map);
     $this->assertEquals(2, $map2->getCount());
 }