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 (#23)
by Jérémiah
13:51 queued 05:06
created

FieldDefinition   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 9
c 2
b 1
f 0
lcom 1
cbo 2
dl 0
loc 64
ccs 25
cts 25
cp 1
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getDefinition() 0 9 1
A createMap() 0 12 3
A create() 0 6 1
A __construct() 0 6 2
A getComplexityFn() 0 4 1
A defaultComplexity() 0 4 1
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;
13
14
use GraphQL\Type\Definition\Config;
15
use GraphQL\Type\Definition\FieldDefinition as BaseFieldDefinition;
16
17
class FieldDefinition extends BaseFieldDefinition
18
{
19
    const DEFAULT_COMPLEXITY_FN = '\Overblog\GraphQLBundle\Definition\FieldDefinition::defaultComplexity';
20
21
    /**
22
     * @var callable
23
     */
24
    private $complexityFn;
25
26 38
    public static function getDefinition()
27
    {
28 38
        return array_merge(
29 38
            parent::getDefinition(),
30
            [
31 38
                'complexity' => Config::CALLBACK,
32
            ]
33 38
        );
34
    }
35
36 37
    public static function createMap(array $fields)
37
    {
38 37
        $map = [];
39 37
        foreach ($fields as $name => $field) {
40 37
            if (!isset($field['name'])) {
41 37
                $field['name'] = $name;
42 37
            }
43 37
            $map[$name] = static::create($field);
44 37
        }
45
46 37
        return $map;
47
    }
48
49
    /**
50
     * @param array $field
51
     *
52
     * @return FieldDefinition
53
     */
54 37
    public static function create($field)
55
    {
56 37
        Config::validate($field, static::getDefinition());
57
58 37
        return new static($field);
59
    }
60
61 37
    protected function __construct(array $config)
62
    {
63 37
        parent::__construct($config);
64
65 37
        $this->complexityFn = isset($config['complexity']) ? $config['complexity'] : static::DEFAULT_COMPLEXITY_FN;
66 37
    }
67
68
    /**
69
     * @return callable|\Closure
70
     */
71 10
    public function getComplexityFn()
72
    {
73 10
        return $this->complexityFn;
74
    }
75
76 12
    public static function defaultComplexity($childrenComplexity)
77
    {
78 12
        return $childrenComplexity + 1;
79
    }
80
}
81