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
23:47
created

GraphQLServices   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 67
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 8
eloc 17
c 2
b 0
f 0
dl 0
loc 67
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 7 2
A __construct() 0 10 1
A query() 0 3 1
A getAll() 0 3 1
A has() 0 3 1
A mutation() 0 3 1
A getType() 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 $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
    /**
48
     * Get all GraphQL services.
49
     */
50
    public function getAll(): array
51
    {
52
        return $this->services;
53
    }
54
55
    public function has(string $name): bool
56
    {
57
        return isset($this->services[$name]);
58
    }
59
60
    /**
61
     * @param mixed ...$args
62
     *
63
     * @return mixed
64
     */
65
    public function query(string $alias, ...$args)
66
    {
67
        return $this->queryResolver->resolve([$alias, $args]);
68
    }
69
70
    /**
71
     * @param mixed ...$args
72
     *
73
     * @return mixed
74
     */
75
    public function mutation(string $alias, ...$args)
76
    {
77
        return $this->mutationResolver->resolve([$alias, $args]);
78
    }
79
80
    public function getType(string $typeName): ?Type
81
    {
82
        return $this->types->resolve($typeName);
83
    }
84
}
85