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 (#815)
by Timur
24:25
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
use Overblog\GraphQLBundle\Validator\InputValidator;
13
14
/**
15
 * Container for special services to be passed to all generated types.
16
 */
17
final class GraphQLServices
18
{
19
    private array $services;
20
    private TypeResolver $types;
21
    private QueryResolver $queryResolver;
22
    private MutationResolver $mutationResolver;
23
24
    public function __construct(
25
        TypeResolver $typeResolver,
26
        QueryResolver $queryResolver,
27
        MutationResolver $mutationResolver,
28
        array $services = []
29
    ) {
30
        $this->types = $typeResolver;
31
        $this->queryResolver = $queryResolver;
32
        $this->mutationResolver = $mutationResolver;
33
        $this->services = $services;
34
    }
35
36
    /**
37
     * @return mixed
38
     */
39
    public function get(string $name)
40
    {
41
        if (!isset($this->services[$name])) {
42
            throw new LogicException(sprintf('GraphQL service "%s" could not be located. You should define it.', $name));
43
        }
44
45
        return $this->services[$name];
46
    }
47
48
    /**
49
     * Get all GraphQL services.
50
     */
51
    public function getAll(): array
52
    {
53
        return $this->services;
54
    }
55
56
    public function has(string $name): bool
57
    {
58
        return isset($this->services[$name]);
59
    }
60
61
    /**
62
     * @param mixed ...$args
63
     *
64
     * @return mixed
65
     */
66
    public function query(string $alias, ...$args)
67
    {
68
        return $this->queryResolver->resolve([$alias, $args]);
69
    }
70
71
    /**
72
     * @param mixed ...$args
73
     *
74
     * @return mixed
75
     */
76
    public function mutation(string $alias, ...$args)
77
    {
78
        return $this->mutationResolver->resolve([$alias, $args]);
79
    }
80
81
    public function getType(string $typeName): ?Type
82
    {
83
        return $this->types->resolve($typeName);
84
    }
85
86
    /**
87
     * Creates an instance of InputValidator
88
     */
89
    public function createInputValidator(array $resolverArgs): InputValidator
90
    {
91
        return $this->services['input_validator_factory']->create($resolverArgs);
92
    }
93
}
94