ArrayIterator   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 2
Metric Value
wmc 6
eloc 9
c 2
b 0
f 2
dl 0
loc 33
ccs 12
cts 12
cp 1
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A key() 0 3 1
A valid() 0 3 1
A next() 0 3 1
A rewind() 0 3 1
A current() 0 4 1
1
<?php
2
3
namespace EasyHttp\MockBuilder\Iterators;
4
5
class ArrayIterator implements \Iterator
6
{
7
    private array $collection = [];
8
9 117
    public function __construct(array $collection)
10
    {
11 117
        $this->collection = $collection;
12
    }
13
14 44
    public function next(): void
15
    {
16 44
        next($this->collection);
17
    }
18
19 117
    public function key(): ?string
20
    {
21 117
        return key($this->collection);
22
    }
23
24 117
    public function valid(): bool
25
    {
26 117
        return array_key_exists($this->key(), $this->collection);
27
    }
28
29 117
    public function rewind(): void
30
    {
31 117
        reset($this->collection);
32
    }
33
34
    #[\ReturnTypeWillChange]
35 94
    public function current()
36
    {
37 94
        return current($this->collection);
38
    }
39
}
40