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

EnumValue::getValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
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