IteratorValue   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 17
ccs 7
cts 7
cp 1
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A unwrap() 0 3 1
A toArray() 0 3 1
A current() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Conia\Boiler;
6
7
use Iterator;
8
use IteratorIterator;
9
10
/**
11
 * @psalm-api
12
 *
13
 * @template-covariant TKey
14
 * @template-covariant TValue
15
 *
16
 * @template TIterator as \Traversable<TKey, TValue>
17
 *
18
 * @template-extends IteratorIterator<TKey, TValue, TIterator>
19
 */
20
class IteratorValue extends IteratorIterator implements ValueInterface
21
{
22 3
    public function current(): mixed
23
    {
24 3
        $value = parent::current();
25
26 3
        return Wrapper::wrap($value);
27
    }
28
29 2
    public function unwrap(): Iterator
30
    {
31 2
        return $this->getInnerIterator();
32
    }
33
34 1
    public function toArray(): ArrayValue
35
    {
36 1
        return new ArrayValue(iterator_to_array($this->getInnerIterator()));
37
    }
38
}
39