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

TypeDefinition   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 79
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 9
c 1
b 1
f 0
lcom 0
cbo 3
dl 0
loc 79
ccs 40
cts 40
cp 1
rs 10

9 Methods

Rating   Name   Duplication   Size   Complexity  
getDefinition() 0 1 ?
A __construct() 0 3 1
A create() 0 4 1
A resolveTypeSection() 0 7 1
A nameSection() 0 14 1
A defaultValueSection() 0 7 1
A descriptionSection() 0 7 1
A deprecationReasonSelection() 0 9 1
A typeSelection() 0 13 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\Config;
13
14
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
15
16
abstract class TypeDefinition
17
{
18
    abstract public function getDefinition();
19
20 15
    protected function __construct()
21
    {
22 15
    }
23
24
    /**
25
     * @return static
26
     */
27 15
    public static function create()
28
    {
29 15
        return new static();
30
    }
31
32 15
    protected function resolveTypeSection()
33
    {
34 15
        $builder = new TreeBuilder();
35 15
        $node = $builder->root('resolveType', 'variable');
36
37 15
        return $node;
38
    }
39
40 15
    protected function nameSection()
41
    {
42 15
        $builder = new TreeBuilder();
43 15
        $node = $builder->root('name', 'scalar');
44 15
        $node->isRequired();
45 15
        $node->validate()
46 15
            ->ifTrue(function ($name) {
47 9
                return !preg_match('/^[_a-z][_0-9a-z]*$/i', $name);
48 15
            })
49 15
                ->thenInvalid('Invalid type name "%s". (see https://facebook.github.io/graphql/#Name)')
50 15
        ->end();
51
52 15
        return $node;
53
    }
54
55 15
    protected function defaultValueSection()
56
    {
57 15
        $builder = new TreeBuilder();
58 15
        $node = $builder->root('defaultValue', 'variable');
59
60 15
        return $node;
61
    }
62
63 15
    protected function descriptionSection()
64
    {
65 15
        $builder = new TreeBuilder();
66 15
        $node = $builder->root('description', 'scalar');
67
68 15
        return $node;
69
    }
70
71 15
    protected function deprecationReasonSelection()
72
    {
73 15
        $builder = new TreeBuilder();
74 15
        $node = $builder->root('deprecationReason', 'scalar');
75
76 15
        $node->info('Text describing why this field is deprecated. When not empty - field will not be returned by introspection queries (unless forced)');
77
78 15
        return $node;
79
    }
80
81 15
    protected function typeSelection($isRequired = false)
82
    {
83 15
        $builder = new TreeBuilder();
84 15
        $node = $builder->root('type', 'scalar');
85
86 15
        $node->info('One of internal or custom types.');
87
88 15
        if ($isRequired) {
89 15
            $node->isRequired();
90 15
        }
91
92 15
        return $node;
93
    }
94
}
95