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

Completed
Pull Request — master (#9)
by Jérémiah
08:12
created

TypeBuilder::getBaseClassName()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 4
Bugs 1 Features 2
Metric Value
c 4
b 1
f 2
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 9.4285
cc 2
eloc 4
nc 2
nop 1
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\Definition\Type;
15
use Overblog\GraphQLBundle\Resolver\ResolverInterface;
16
17
class TypeBuilder
18
{
19
    private $configResolver;
20
21
    private $mapping = [
22
        'relay-connection' => 'Overblog\\GraphQLBundle\\Relay\\Connection\\ConnectionType',
23
        'relay-node' => 'Overblog\\GraphQLBundle\\Relay\\Node\\NodeInterfaceType',
24
        'relay-mutation-input' => 'Overblog\\GraphQLBundle\\Relay\\Mutation\\InputType',
25
        'relay-mutation-payload' => 'Overblog\\GraphQLBundle\\Relay\\Mutation\\PayloadType',
26
        'object' => 'GraphQL\\Type\\Definition\\ObjectType',
27
        'enum' => 'GraphQL\\Type\\Definition\\EnumType',
28
        'interface' => 'GraphQL\\Type\\Definition\\InterfaceType',
29
        'union' => 'GraphQL\\Type\\Definition\\UnionType',
30
        'input-object' => 'GraphQL\\Type\\Definition\\InputObjectType',
31
    ];
32
33 32
    public function __construct(ResolverInterface $configResolver)
34
    {
35 32
        $this->configResolver = $configResolver;
36 32
    }
37
38
    /**
39
     * @param $type
40
     * @param array $config
41
     *
42
     * @return Type
43
     */
44 32
    public function create($type, array $config)
45
    {
46 32
        $class = $this->getBaseClassName($type);
47
48 31
        return new $class($this->configResolver->resolve($config));
49
    }
50
51 32
    private function getBaseClassName($type)
52
    {
53 32
        if (!isset($this->mapping[$type])) {
54 1
            throw new \RuntimeException(sprintf('Type "%s" is not managed.', $type));
55
        }
56
57 31
        return $this->mapping[$type];
58
    }
59
}
60