LazyObjectFields::__invoke()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 2
c 0
b 0
f 0
nc 2
nop 0
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Andi\GraphQL\Common;
6
7
use Andi\GraphQL\Definition\Type\FieldsAwareInterface;
8
use Andi\GraphQL\ObjectFieldResolver\ObjectFieldResolverInterface;
9
10
final class LazyObjectFields
11
{
12 2
    public function __construct(
13
        private readonly FieldsAwareInterface $fields,
14
        private readonly ObjectFieldResolverInterface $fieldResolver,
15
    ) {
16 2
    }
17
18 1
    public function __invoke(): iterable
19
    {
20 1
        foreach ($this->fields->getFields() as $field) {
21 1
            yield $this->fieldResolver->resolve($field);
22
        }
23
    }
24
}
25