LazyTypeByReflectionParameter   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 9
c 0
b 0
f 0
dl 0
loc 20
ccs 11
cts 11
cp 1
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 7 2
A __construct() 0 8 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Andi\GraphQL\Common;
6
7
use Andi\GraphQL\TypeRegistryInterface;
8
use GraphQL\Type\Definition as Webonyx;
9
use ReflectionParameter;
10
11
final class LazyTypeByReflectionParameter extends LazyTypeByReflectionType
12
{
13 6
    public function __construct(
14
        private readonly ReflectionParameter $parameter,
15
        private readonly TypeRegistryInterface $typeRegistry,
16
    ) {
17 6
        parent::__construct(
18 6
            $this->parameter->getType(),
19 6
            $this->typeRegistry,
20 6
            $this->parameter->getDeclaringClass()->getName(),
21 6
        );
22
    }
23
24 5
    public function __invoke(): Webonyx\Type
25
    {
26 5
        $type = parent::__invoke();
27
28 5
        return $this->parameter->isVariadic()
29 1
            ? Webonyx\Type::listOf($type)
30 5
            : $type;
31
    }
32
}
33