Passed
Push — master ( 898411...5b804b )
by Andrey
56s queued 13s
created

EnumValue   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 39
ccs 13
cts 13
cp 1
rs 10
wmc 7

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 3 1
A __construct() 0 12 3
A getDescription() 0 3 1
A getValue() 0 3 1
A getDeprecationReason() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Andi\GraphQL\Field;
6
7
use Andi\GraphQL\Definition\Field\EnumValueInterface;
8
9
final class EnumValue implements EnumValueInterface
10
{
11
    private readonly string $description;
12
    private readonly string $deprecationReason;
13
14 2
    public function __construct(
15
        private readonly string $name,
16
        private readonly mixed $value,
17
        ?string $description = null,
18
        ?string $deprecationReason = null,
19
    ) {
20 2
        if (null !== $description) {
21 1
            $this->description = $description;
0 ignored issues
show
Bug introduced by
The property description is declared read-only in Andi\GraphQL\Field\EnumValue.
Loading history...
22
        }
23
24 2
        if (null !== $deprecationReason) {
25 1
            $this->deprecationReason = $deprecationReason;
0 ignored issues
show
Bug introduced by
The property deprecationReason is declared read-only in Andi\GraphQL\Field\EnumValue.
Loading history...
26
        }
27
    }
28
29
30 2
    public function getName(): string
31
    {
32 2
        return $this->name;
33
    }
34
35 2
    public function getDescription(): ?string
36
    {
37 2
        return $this->description ?? null;
38
    }
39
40 2
    public function getDeprecationReason(): ?string
41
    {
42 2
        return $this->deprecationReason ?? null;
43
    }
44
45 2
    public function getValue(): mixed
46
    {
47 2
        return $this->value;
48
    }
49
}
50