Skip to content

Commit a69993b

Browse files
committed
Extract parsing of interfaces
1 parent 98ea0b9 commit a69993b

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

src/Config/Parser/GraphQL/ASTConverter/ObjectNode.php

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,7 @@ public static function toConfig(Node $node): array
3333
protected static function parseConfig(Node $node): array
3434
{
3535
$config = DescriptionNode::toConfig($node) + static::parseFields($node);
36-
37-
if (!empty($node->interfaces)) {
38-
$interfaces = [];
39-
foreach ($node->interfaces as $interface) {
40-
$interfaces[] = TypeNode::astTypeNodeToString($interface);
41-
}
42-
$config['interfaces'] = $interfaces;
43-
}
36+
$config += static::parseInterfaces($node);
4437

4538
return $config;
4639
}
@@ -54,4 +47,21 @@ protected static function parseFields(Node $node): array
5447
'fields' => FieldsNode::toConfig($node),
5548
];
5649
}
50+
51+
/**
52+
* @return array<string,array<string>>
53+
*/
54+
protected static function parseInterfaces(Node $node): array
55+
{
56+
$config = [];
57+
if (isset($node->interfaces) && !empty($node->interfaces)) {
58+
$interfaces = [];
59+
foreach ($node->interfaces as $interface) {
60+
$interfaces[] = TypeNode::astTypeNodeToString($interface);
61+
}
62+
$config['interfaces'] = $interfaces;
63+
}
64+
65+
return $config;
66+
}
5767
}

0 commit comments

Comments
 (0)