| Total Complexity | 7 |
| Total Lines | 33 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | final class ResolveType |
||
| 11 | { |
||
| 12 | 7 | public function __construct( |
|
| 13 | private readonly TypeRegistryInterface $typeRegistry, |
||
| 14 | ) { |
||
| 15 | 7 | } |
|
| 16 | |||
| 17 | 6 | public function __invoke(mixed $value, mixed $context, Webonyx\ResolveInfo $info): ?Webonyx\ObjectType |
|
| 18 | { |
||
| 19 | 6 | if (! \is_object($value)) { |
|
| 20 | 2 | return null; |
|
| 21 | } |
||
| 22 | |||
| 23 | 4 | return $this->getObjectType(new \ReflectionClass($value)); |
|
| 24 | } |
||
| 25 | |||
| 26 | 4 | private function getObjectType(\ReflectionClass $class): ?Webonyx\ObjectType |
|
| 43 | } |
||
| 44 | } |
||
| 45 |