Flow\Helper\Cycler::next PHP Méthode

next() public méthode

public next ( )
    public function next()
    {
        return $this->elements[$this->idx++ % $this->length];
    }

Usage Example

Exemple #1
0
 public function test_cycle()
 {
     $elements = array(1, 2, 3);
     $cycler = new Helper\Cycler($elements);
     $this->assertTrue($cycler instanceof \IteratorAggregate);
     $this->assertEquals(1, $cycler->next());
     $this->assertEquals(2, $cycler->next());
     $this->assertEquals(3, $cycler->next());
     $this->assertTrue(in_array($cycler->random(), $elements));
 }