Conditions | 7 |
Paths | 6 |
Total Lines | 16 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 7 |
Changes | 0 |
1 | <?php |
||
20 | 8 | public function getFields(): iterable |
|
21 | { |
||
22 | 8 | foreach ($this->fields as $name => $field) { |
|
23 | 8 | if ($field instanceof Webonyx\InputObjectField || $field instanceof InputObjectFieldInterface) { |
|
24 | 2 | yield $field; |
|
25 | 6 | } elseif (is_string($field)) { |
|
26 | 2 | yield new InputObjectField($name, $field); |
|
27 | 4 | } elseif (is_array($field)) { |
|
28 | 3 | if (is_string($name)) { |
|
29 | 2 | $field['name'] ??= $name; |
|
30 | } |
||
31 | |||
32 | 3 | yield $this->extract($field, InputObjectField::class); |
|
33 | } else { |
||
34 | 1 | throw new CantResolveInputObjectFieldException( |
|
35 | 1 | 'Can\'t resolve InputObjectField configuration: unknown field configuration', |
|
36 | 1 | ); |
|
41 |