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 (#185)
by Jérémiah
07:57
created

SchemaBuilder::create()   B

Complexity

Conditions 2
Paths 2

Size

Total Lines 24
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 16
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 24
ccs 16
cts 16
cp 1
rs 8.9713
c 0
b 0
f 0
cc 2
eloc 16
nc 2
nop 3
crap 2
1
<?php
2
3
/*
4
 * This file is part of the OverblogGraphQLBundle package.
5
 *
6
 * (c) Overblog <http://github.com/overblog/>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Overblog\GraphQLBundle\Definition\Builder;
13
14
use GraphQL\Type\Schema;
15
use Overblog\GraphQLBundle\Resolver\ResolverInterface;
16
17
class SchemaBuilder
18
{
19
    /**
20
     * @var ResolverInterface
21
     */
22
    private $typeResolver;
23
24
    /** @var bool */
25
    private $enableValidation;
26
27 15
    public function __construct(ResolverInterface $typeResolver, $enableValidation = false)
28
    {
29 15
        $this->typeResolver = $typeResolver;
30 15
        $this->enableValidation = $enableValidation;
31 15
    }
32
33
    /**
34
     * @param null|string $queryAlias
35
     * @param null|string $mutationAlias
36
     * @param null|string $subscriptionAlias
37
     *
38
     * @return Schema
39
     */
40 15
    public function create($queryAlias = null, $mutationAlias = null, $subscriptionAlias = null)
41
    {
42 15
        $query = $this->typeResolver->resolve($queryAlias);
43 15
        $mutation = $this->typeResolver->resolve($mutationAlias);
44 15
        $subscription = $this->typeResolver->resolve($subscriptionAlias);
45
46
        $config = [
47 15
            'query' => $query,
48 15
            'mutation' => $mutation,
49 15
            'subscription' => $subscription,
50 15
        ];
51
52 15
        if ($this->enableValidation) {
53
            // right now config.types is required when using "assertValid"
54 14
            $config['types'] = $this->typeResolver->getSolutions();
55 14
            $schema = new Schema($config);
56 14
            $schema->assertValid();
57 14
        } else {
58 1
            $config['typeLoader'] = [$this->typeResolver, 'resolve'];
59 1
            $schema = new Schema($config);
60
        }
61
62 15
        return $schema;
63
    }
64
}
65