| Conditions | 3 |
| Paths | 1 |
| Total Lines | 25 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 22 | public function executeFields(ObjectType $parentType, $rootValue, array $path, array $fields) |
||
| 23 | { |
||
| 24 | return promiseReduce( |
||
| 25 | \array_keys($fields), |
||
| 26 | function ($results, $fieldName) use ($parentType, $rootValue, $path, $fields) { |
||
| 27 | $fieldNodes = $fields[$fieldName]; |
||
| 28 | $fieldPath = $path; |
||
| 29 | $fieldPath[] = $fieldName; |
||
| 30 | |||
| 31 | try { |
||
| 32 | $result = $this->resolveField($parentType, $rootValue, $fieldNodes, $fieldPath); |
||
| 33 | } catch (UndefinedFieldException $exception) { |
||
| 34 | return null; |
||
| 35 | } |
||
| 36 | |||
| 37 | if ($result instanceof PromiseInterface) { |
||
| 38 | return $result->then(function ($resolvedResult) use ($fieldName, $results) { |
||
| 39 | $results[$fieldName] = $resolvedResult; |
||
| 40 | return $results; |
||
| 41 | }); |
||
| 42 | } |
||
| 43 | |||
| 44 | $results[$fieldName] = $result; |
||
| 45 | |||
| 46 | return $results; |
||
| 47 | } |
||
| 51 |