Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Passed
Pull Request — master (#786)
by Timur
25:02
created

GraphQLServices   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 7
eloc 16
dl 0
loc 59
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 7 2
A query() 0 3 1
A mutation() 0 3 1
A __construct() 0 10 1
A getType() 0 3 1
A has() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Overblog\GraphQLBundle\Definition;
6
7
use GraphQL\Type\Definition\Type;
8
use LogicException;
9
use Overblog\GraphQLBundle\Resolver\MutationResolver;
10
use Overblog\GraphQLBundle\Resolver\QueryResolver;
11
use Overblog\GraphQLBundle\Resolver\TypeResolver;
12
13
/**
14
 * Container for special services to be passed to all generated types.
15
 */
16
final class GraphQLServices
17
{
18
    private array $services;
19
    private TypeResolver $types;
20
    private QueryResolver $resolverResolver;
21
    private MutationResolver $mutationResolver;
22
23
    public function __construct(
24
        TypeResolver $typeResolver,
25
        QueryResolver $resolverResolver,
26
        MutationResolver $mutationResolver,
27
        array $services = []
28
    ) {
29
        $this->types = $typeResolver;
30
        $this->resolverResolver = $resolverResolver;
31
        $this->mutationResolver = $mutationResolver;
32
        $this->services = $services;
33
    }
34
35
    /**
36
     * @return mixed
37
     */
38
    public function get(string $name)
39
    {
40
        if (!isset($this->services[$name])) {
41
            throw new LogicException(sprintf('GraphQL service "%s" could not be located. You should define it.', $name));
42
        }
43
44
        return $this->services[$name];
45
    }
46
47
    public function has(string $name): bool
48
    {
49
        return isset($this->services[$name]);
50
    }
51
52
    /**
53
     * @param mixed ...$args
54
     *
55
     * @return mixed
56
     */
57
    public function query(string $alias, ...$args)
58
    {
59
        return $this->resolverResolver->resolve([$alias, $args]);
60
    }
61
62
    /**
63
     * @param mixed ...$args
64
     *
65
     * @return mixed
66
     */
67
    public function mutation(string $alias, ...$args)
68
    {
69
        return $this->mutationResolver->resolve([$alias, $args]);
70
    }
71
72
    public function getType(string $typeName): ?Type
73
    {
74
        return $this->types->resolve($typeName);
75
    }
76
}
77