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
21:54
created

GraphQLServices::get()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 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 $queryResolver;
21
    private MutationResolver $mutationResolver;
22
23
    public function __construct(
24
        TypeResolver $typeResolver,
25
        QueryResolver $queryResolver,
26
        MutationResolver $mutationResolver,
27
        array $services = []
28
    ) {
29
        $this->types = $typeResolver;
30
        $this->queryResolver = $queryResolver;
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->queryResolver->resolve([$alias, $args]);
60
    }
61
62
    /**
63
     * @param mixed ...$args
64
     *
65
     * @return mixed
66
     */
67
    public function mutation(string $alias, ...$args)
68
    {
69
        // TODO: remove the following if-block in 1.0
70
        if (1 === count($args) && is_array($args[0])) {
71
            $args = $args[0];
72
        }
73
74
        return $this->mutationResolver->resolve([$alias, $args]);
75
    }
76
77
    public function getType(string $typeName): ?Type
78
    {
79
        return $this->types->resolve($typeName);
80
    }
81
}
82