IteratorValue::toArray()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
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