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 | 26 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 14 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | 2 | public static function toConfig(Node $node, $property = 'fields'): array |
|
| 14 | { |
||
| 15 | 2 | $config = []; |
|
| 16 | 2 | if (!empty($node->$property)) { |
|
| 17 | 2 | foreach ($node->$property as $definition) { |
|
| 18 | 2 | $fieldConfig = TypeNode::toConfig($definition) + DescriptionNode::toConfig($definition); |
|
| 19 | |||
| 20 | 2 | if (!empty($definition->arguments)) { |
|
| 21 | 2 | $fieldConfig['args'] = self::toConfig($definition, 'arguments'); |
|
| 22 | } |
||
| 23 | |||
| 24 | 2 | if (!empty($definition->defaultValue)) { |
|
| 25 | 1 | $fieldConfig['defaultValue'] = self::astValueNodeToConfig($definition->defaultValue); |
|
| 26 | } |
||
| 27 | |||
| 28 | 2 | $directiveConfig = DirectiveNode::toConfig($definition); |
|
| 29 | 2 | if (isset($directiveConfig['deprecationReason'])) { |
|
| 30 | 1 | $fieldConfig['deprecationReason'] = $directiveConfig['deprecationReason']; |
|
| 31 | } |
||
| 32 | |||
| 33 | 2 | $config[$definition->name->value] = $fieldConfig; |
|
| 34 | } |
||
| 35 | } |
||
| 36 | |||
| 37 | 2 | return $config; |
|
| 38 | } |
||
| 39 | |||
| 67 |