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 (#494)
by Jérémiah
18:56
created

WrapArgumentConfigProcessor   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 10
eloc 18
dl 0
loc 42
ccs 19
cts 19
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A process() 0 22 5
A wrapFieldsArgument() 0 9 4
A __construct() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Overblog\GraphQLBundle\Definition\ConfigProcessor;
6
7
use Overblog\GraphQLBundle\Definition\ArgumentFactory;
8
use Overblog\GraphQLBundle\Definition\LazyConfig;
9
10
final class WrapArgumentConfigProcessor implements ConfigProcessorInterface
11
{
12
    private $argumentFactory;
13
14 69
    public function __construct(ArgumentFactory $argumentFactory)
15
    {
16 69
        $this->argumentFactory = $argumentFactory;
17 69
    }
18
19 69
    public function process(LazyConfig $lazyConfig): LazyConfig
20
    {
21
        $lazyConfig->addPostLoader(function ($config) {
22 69
            if (isset($config['resolveField']) && \is_callable($config['resolveField'])) {
23 10
                $config['resolveField'] = $this->argumentFactory->wrapResolverArgs($config['resolveField']);
24
            }
25
26 69
            if (isset($config['fields'])) {
27
                $config['fields'] = function () use ($config) {
28 57
                    $fields = $config['fields'];
29 57
                    if (\is_callable($config['fields'])) {
30 57
                        $fields = $config['fields']();
31
                    }
32
33 57
                    return self::wrapFieldsArgument($fields);
0 ignored issues
show
Bug Best Practice introduced by
The method Overblog\GraphQLBundle\D...r::wrapFieldsArgument() is not static, but was called statically. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

33
                    return self::/** @scrutinizer ignore-call */ wrapFieldsArgument($fields);
Loading history...
34
                };
35
            }
36
37 69
            return $config;
38 69
        });
39
40 69
        return $lazyConfig;
41
    }
42
43 57
    private function wrapFieldsArgument(array $fields)
44
    {
45 57
        foreach ($fields as &$field) {
46 57
            if (isset($field['resolve']) && \is_callable($field['resolve'])) {
47 55
                $field['resolve'] = $this->argumentFactory->wrapResolverArgs($field['resolve']);
48
            }
49
        }
50
51 57
        return $fields;
52
    }
53
}
54