Total Complexity | 4 |
Total Lines | 41 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
5 | trait DirectivesTrait |
||
6 | { |
||
7 | /** |
||
8 | * @var DirectiveNode[] |
||
9 | */ |
||
10 | protected $directives = []; |
||
11 | |||
12 | /** |
||
13 | * @return bool |
||
14 | */ |
||
15 | public function hasDirectives(): bool |
||
16 | { |
||
17 | return !empty($this->directives); |
||
18 | } |
||
19 | |||
20 | /** |
||
21 | * @return DirectiveNode[] |
||
22 | */ |
||
23 | public function getDirectives(): array |
||
24 | { |
||
25 | return $this->directives; |
||
26 | } |
||
27 | |||
28 | /** |
||
29 | * @return array |
||
30 | */ |
||
31 | public function getDirectivesAST(): array |
||
32 | { |
||
33 | return \array_map(function (DirectiveNode $directive) { |
||
34 | return $directive->toAST(); |
||
35 | }, $this->directives); |
||
36 | } |
||
37 | |||
38 | /** |
||
39 | * @param array|DirectiveNode[] $directives |
||
40 | * @return $this |
||
41 | */ |
||
42 | public function setDirectives(array $directives) |
||
46 | } |
||
47 | } |
||
48 |