| Conditions | 2 |
| Paths | 1 |
| Total Lines | 16 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | public function __construct(string $name, ObjectType $type, ?ObjectType $subType, RecursiveTypeMapperInterface $typeMapper) |
||
| 19 | { |
||
| 20 | parent::__construct([ |
||
| 21 | 'name' => $name, |
||
| 22 | 'fields' => function() use ($type) { |
||
| 23 | return $type->getFields(); |
||
| 24 | }, |
||
| 25 | 'description' => $type->description, |
||
| 26 | 'resolveType' => function($value) use ($typeMapper, $subType) { |
||
| 27 | if (!is_object($value)) { |
||
| 28 | throw new \InvalidArgumentException('Expected object for resolveType. Got: "'.gettype($value).'"'); |
||
| 29 | } |
||
| 30 | |||
| 31 | $className = get_class($value); |
||
| 32 | |||
| 33 | return $typeMapper->mapClassToType($className, $subType); |
||
| 34 | } |
||
| 38 |