Total Complexity | 5 |
Total Lines | 71 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
18 | class ExposedField |
||
19 | { |
||
20 | /** |
||
21 | * @var Right|null |
||
22 | */ |
||
23 | private $right; |
||
24 | |||
25 | /** |
||
26 | * @var string|null |
||
27 | */ |
||
28 | private $name; |
||
29 | |||
30 | /** |
||
31 | * @var bool |
||
32 | */ |
||
33 | private $logged; |
||
34 | |||
35 | /** |
||
36 | * @var string|null |
||
37 | */ |
||
38 | private $returnType; |
||
39 | |||
40 | /** |
||
41 | * @param mixed[] $attributes |
||
42 | */ |
||
43 | public function __construct(array $attributes = []) |
||
44 | { |
||
45 | $this->name = $attributes['name'] ?? null; |
||
46 | $this->logged = $attributes['logged'] ?? false; |
||
47 | $this->right = $attributes['right'] ?? null; |
||
48 | $this->returnType = $attributes['returnType'] ?? null; |
||
49 | } |
||
50 | |||
51 | /** |
||
52 | * Returns the GraphQL right to be applied to this exposed field. |
||
53 | * |
||
54 | * @return Right|null |
||
55 | */ |
||
56 | public function getRight(): ?Right |
||
57 | { |
||
58 | return $this->right; |
||
59 | } |
||
60 | |||
61 | /** |
||
62 | * Returns the name of the GraphQL query/mutation/field. |
||
63 | * If not specified, the name of the method should be used instead. |
||
64 | * |
||
65 | * @return null|string |
||
66 | */ |
||
67 | public function getName(): ?string |
||
68 | { |
||
69 | return $this->name; |
||
70 | } |
||
71 | |||
72 | /** |
||
73 | * @return bool |
||
74 | */ |
||
75 | public function isLogged(): bool |
||
76 | { |
||
77 | return $this->logged; |
||
78 | } |
||
79 | |||
80 | /** |
||
81 | * Returns the GraphQL return type of the request (as a string). |
||
82 | * The string can represent the FQCN of the type or an entry in the container resolving to the GraphQL type. |
||
83 | * |
||
84 | * @return string|null |
||
85 | */ |
||
86 | public function getReturnType(): ?string |
||
89 | } |
||
90 | } |
||
91 |