• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

overblog / GraphQLBundle / 8491707837

30 Mar 2024 03:26PM UTC coverage: 98.361% (-0.05%) from 98.411%
8491707837

push

github

web-flow
Merge pull request #1172 from sparklink-pro/master

Cleanup Input default value and Fix #1171

53 of 56 new or added lines in 7 files covered. (94.64%)

1 existing line in 1 file now uncovered.

4321 of 4393 relevant lines covered (98.36%)

39.59 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

85.71
/src/Resolver/InterfaceTypeResolver.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Overblog\GraphQLBundle\Resolver;
6

7
use GraphQL\Type\Definition\Type;
8

9
class InterfaceTypeResolver
10
{
11
    private TypeResolver $typeResolver;
12
    private array $interfacesMap;
13

14
    public function __construct(TypeResolver $typeResolver, array $interfacesMap = [])
15
    {
16
        $this->typeResolver = $typeResolver;
1✔
17
        $this->interfacesMap = $interfacesMap;
1✔
18
    }
1✔
19

20
    public function resolveType(string $interfaceType, mixed $value): ?Type
21
    {
22
        if (!isset($this->interfacesMap[$interfaceType])) {
1✔
NEW
23
            throw new UnresolvableException(sprintf('Default interface type resolver was unable to find interface with name "%s"', $interfaceType));
×
24
        }
25

26
        $gqlType = null;
1✔
27
        $types = $this->interfacesMap[$interfaceType];
1✔
28
        foreach ($types as $className => $type) {
1✔
29
            if ($value instanceof $className) {
1✔
30
                $gqlType = $type;
1✔
31
                break;
1✔
32
            }
33
        }
34

35
        if (null === $gqlType) {
1✔
NEW
36
            throw new UnresolvableException(sprintf('Default interface type resolver with interface "%s" did not find a matching instance in: %s', $interfaceType, implode(', ', array_keys($types))));
×
37
        }
38

39
        return $this->typeResolver->resolve($gqlType);
1✔
40
    }
41
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc