~canonical-sysadmins/wordpress/openstack-objectstorage-k8s

« back to all changes in this revision

Viewing changes to vendor/phpunit/phpunit/tests/_files/TestIterator.php

  • Committer: Jacek Nykis
  • Date: 2015-02-11 15:35:31 UTC
  • Revision ID: jacek.nykis@canonical.com-20150211153531-hmy6zi0ov2qfkl0b
Initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
class TestIterator implements Iterator
 
3
{
 
4
    protected $array;
 
5
    protected $position = 0;
 
6
 
 
7
    public function __construct($array = array())
 
8
    {
 
9
        $this->array = $array;
 
10
    }
 
11
 
 
12
    public function rewind()
 
13
    {
 
14
        $this->position = 0;
 
15
    }
 
16
 
 
17
    public function valid()
 
18
    {
 
19
        return $this->position < count($this->array);
 
20
    }
 
21
 
 
22
    public function key()
 
23
    {
 
24
        return $this->position;
 
25
    }
 
26
 
 
27
    public function current()
 
28
    {
 
29
        return $this->array[$this->position];
 
30
    }
 
31
 
 
32
    public function next()
 
33
    {
 
34
        $this->position++;
 
35
    }
 
36
}