Ouzo\Utilities\Iterator\BatchingIterator::valid PHP Method

valid() public method

public valid ( )
    public function valid()
    {
        if (!isset($this->currentChunk)) {
            $this->fetchChunk();
        }
        return !empty($this->currentChunk);
    }

Usage Example

 /**
  * @test
  */
 public function shouldNotBeValidForEmptyArray()
 {
     //given
     $batchIterator = new BatchingIterator(new ArrayIterator(array()), 2);
     //when
     $valid = $batchIterator->valid();
     //then
     $this->assertFalse($valid);
 }