1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | namespace Andi\GraphQL\Argument; |
||
6 | |||
7 | use Andi\GraphQL\Definition\Field\ArgumentInterface; |
||
8 | use Andi\GraphQL\Definition\Field\DefaultValueAwareInterface; |
||
9 | |||
10 | abstract class AbstractArgument implements ArgumentInterface |
||
11 | { |
||
12 | private readonly string $description; |
||
13 | |||
14 | 1 | public function __construct( |
|
15 | private readonly string $name, |
||
16 | private readonly string $type, |
||
17 | private readonly int $mode = 0, |
||
18 | ?string $description = null, |
||
19 | ) { |
||
20 | 1 | if (null !== $description) { |
|
21 | 1 | $this->description = $description; |
|
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
22 | } |
||
23 | } |
||
24 | |||
25 | 1 | public function getName(): string |
|
26 | { |
||
27 | 1 | return $this->name; |
|
28 | } |
||
29 | |||
30 | 1 | public function getDescription(): ?string |
|
31 | { |
||
32 | /** @psalm-suppress RedundantPropertyInitializationCheck */ |
||
33 | 1 | return $this->description ?? null; |
|
34 | } |
||
35 | |||
36 | 1 | public function getType(): string |
|
37 | { |
||
38 | 1 | return $this->type; |
|
39 | } |
||
40 | |||
41 | 1 | public function getMode(): int |
|
42 | { |
||
43 | 1 | return $this->mode; |
|
44 | } |
||
45 | |||
46 | public function hasDefaultValue(): bool |
||
47 | { |
||
48 | return $this instanceof DefaultValueAwareInterface; |
||
49 | } |
||
50 | } |
||
51 |