WithoutKeysTraversable   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
dl 0
loc 20
rs 10
c 1
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getIterator() 0 4 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace BenTools\IterableFunctions;
6
7
use Generator;
8
use IteratorAggregate;
9
10
/**
11
 * @internal
12
 *
13
 * @template TKey
14
 * @template TValue
15
 * @implements IteratorAggregate<TKey, TValue>
16
 */
17
final class WithoutKeysTraversable implements IteratorAggregate
18
{
19
    /** @var iterable<TKey, TValue> */
20
    private $iterable;
21
22
    /**
23
     * @param iterable<TKey, TValue> $iterable
24
     */
25
    public function __construct(iterable $iterable)
26
    {
27
        $this->iterable = $iterable;
28
    }
29
30
    /**
31
     * @return Generator<TValue>
32
     */
33
    public function getIterator(): Generator
34
    {
35
        foreach ($this->iterable as $value) {
36
            yield $value;
37
        }
38
    }
39
}
40