Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php declare(strict_types=1);
2
/*
3
 * This file is part of PHPUnit.
4
 *
5
 * (c) Sebastian Bergmann <sebastian@phpunit.de>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace PHPUnit\TextUI\XmlConfiguration;
11
 
12
use function count;
13
use function iterator_count;
14
use Countable;
15
use Iterator;
16
 
17
/**
18
 * @internal This class is not covered by the backward compatibility promise for PHPUnit
19
 *
20
 * @template-implements Iterator<int, TestSuite>
21
 */
22
final class TestSuiteCollectionIterator implements Countable, Iterator
23
{
24
    /**
25
     * @var TestSuite[]
26
     */
27
    private $testSuites;
28
 
29
    /**
30
     * @var int
31
     */
32
    private $position;
33
 
34
    public function __construct(TestSuiteCollection $testSuites)
35
    {
36
        $this->testSuites = $testSuites->asArray();
37
    }
38
 
39
    public function count(): int
40
    {
41
        return iterator_count($this);
42
    }
43
 
44
    public function rewind(): void
45
    {
46
        $this->position = 0;
47
    }
48
 
49
    public function valid(): bool
50
    {
51
        return $this->position < count($this->testSuites);
52
    }
53
 
54
    public function key(): int
55
    {
56
        return $this->position;
57
    }
58
 
59
    public function current(): TestSuite
60
    {
61
        return $this->testSuites[$this->position];
62
    }
63
 
64
    public function next(): void
65
    {
66
        $this->position++;
67
    }
68
}