Example #1
0
 public function test8_Iteration()
 {
     # iteration
     $this->assertTrue(static::$collection->getIterator() instanceof \ArrayIterator);
     $result = [];
     foreach (static::$collection as $key => $value) {
         $result[] = $key;
     }
     sort($result);
     $this->assertEquals($result, Util::array_from_str('json part1 part2 yaml'));
 }
 /**
  * Get the iterator without loading remote values
  * 
  * @return ArrayIterator
  */
 function getLocalIterator()
 {
     return parent::getIterator();
 }
Example #3
0
<?php

require_once 'Arr.php';
require_once 'Collection.php';
$foo = array('name' => 'haicheng', 'age' => '28');
$foo_collection = new Collection($foo);
echo $foo_collection->toJson();
$foo_collection->add('foo1', '1');
$foo_collection->add('foo2.foo1-1', '2');
echo $foo_collection->toJson();
var_dump($foo_collection->getIterator());
 /**
  * {@inheritdoc}
  */
 public function getIterator()
 {
     $this->initialize();
     return $this->coll->getIterator();
 }
Example #5
0
 /**
  * Returns the iterator.
  * @return ArrayIterator
  */
 public function getIterator()
 {
     if (!$this->isLoaded() && $this->isLoadable()) {
         $this->load();
     }
     return parent::getIterator();
 }
 /**
  * TODO: Implement a iterator that will keep fetching records
  * from Graph API until hasNext() of the collection runs out
  *
  */
 public function getIterator()
 {
     return parent::getIterator();
 }