Total Complexity | 3 |
Total Lines | 23 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
21 | */ |
||
22 | final class DirectiveDefinitionContext extends DefinitionContext |
||
23 | { |
||
24 | /** |
||
25 | * @param array $args |
||
26 | * @return DirectiveInterface |
||
27 | * @throws \Throwable |
||
28 | */ |
||
29 | public function build(array $args): DirectiveInterface |
||
30 | { |
||
31 | $locations = \array_map(fn(LocationNode $loc): string => $loc->name->value, $this->ast->locations); |
||
|
|||
32 | |||
33 | return new Directive($this->getName(), [ |
||
34 | 'description' => $this->description($this->ast), |
||
35 | 'repeatable' => $this->ast->repeatable !== null, |
||
36 | 'locations' => $locations, |
||
37 | ]); |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * @return string |
||
42 | */ |
||
43 | public function getName(): string |
||
44 | { |
||
56 |