We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
Conditions | 6 |
Paths | 2 |
Total Lines | 25 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 14 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
12 | 2 | public static function toConfig(Node $node, $property = 'fields'): array |
|
13 | { |
||
14 | 2 | $config = []; |
|
15 | 2 | if (!empty($node->$property)) { |
|
16 | 2 | foreach ($node->$property as $definition) { |
|
17 | 2 | $fieldConfig = TypeNode::toConfig($definition) + DescriptionNode::toConfig($definition); |
|
18 | |||
19 | 2 | if (!empty($definition->arguments)) { |
|
20 | 2 | $fieldConfig['args'] = self::toConfig($definition, 'arguments'); |
|
21 | } |
||
22 | |||
23 | 2 | if (!empty($definition->defaultValue)) { |
|
24 | 1 | $fieldConfig['defaultValue'] = AST::valueFromASTUntyped($definition->defaultValue); |
|
25 | } |
||
26 | |||
27 | 2 | $directiveConfig = DirectiveNode::toConfig($definition); |
|
28 | 2 | if (isset($directiveConfig['deprecationReason'])) { |
|
29 | 1 | $fieldConfig['deprecationReason'] = $directiveConfig['deprecationReason']; |
|
30 | } |
||
31 | |||
32 | 2 | $config[$definition->name->value] = $fieldConfig; |
|
33 | } |
||
34 | } |
||
35 | |||
36 | 2 | return $config; |
|
37 | } |
||
39 |