LazyTypeIterator   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 5
c 0
b 0
f 0
dl 0
loc 18
ccs 5
cts 5
cp 1
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A __invoke() 0 4 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Andi\GraphQL\Common;
6
7
use Andi\GraphQL\TypeRegistryInterface;
8
9
final class LazyTypeIterator
10
{
11
    /**
12
     * @var pure-callable(): iterable
0 ignored issues
show
Documentation Bug introduced by
The doc comment pure-callable(): iterable at position 0 could not be parsed: Unknown type name 'pure-callable' at position 0 in pure-callable(): iterable.
Loading history...
13
     */
14
    private readonly mixed $types;
15
16 3
    public function __construct(
17
        callable $types,
18
        private readonly TypeRegistryInterface $typeRegistry,
19
    ) {
20 3
        $this->types = $types;
0 ignored issues
show
Bug introduced by
The property types is declared read-only in Andi\GraphQL\Common\LazyTypeIterator.
Loading history...
21
    }
22
23 2
    public function __invoke(): iterable
24
    {
25 2
        foreach (\call_user_func($this->types) as $type) {
26 2
            yield $this->typeRegistry->get($type);
27
        }
28
    }
29
}
30