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
Push — master ( 73cd7f...5ec16c )
by Jérémiah
14s queued 10s
created

WrapArgumentConfigProcessor::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 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 101
    public function __construct(ArgumentFactory $argumentFactory)
15
    {
16 101
        $this->argumentFactory = $argumentFactory;
17 101
    }
18
19 100
    public function process(LazyConfig $lazyConfig): LazyConfig
20
    {
21
        $lazyConfig->addPostLoader(function ($config) {
22 100
            if (isset($config['resolveField']) && \is_callable($config['resolveField'])) {
23 10
                $config['resolveField'] = $this->argumentFactory->wrapResolverArgs($config['resolveField']);
24
            }
25
26 100
            if (isset($config['fields'])) {
27
                $config['fields'] = function () use ($config) {
28 87
                    $fields = $config['fields'];
29 87
                    if (\is_callable($config['fields'])) {
30 87
                        $fields = $config['fields']();
31
                    }
32
33 87
                    return $this->wrapFieldsArgument($fields);
34
                };
35
            }
36
37 100
            return $config;
38 100
        });
39
40 100
        return $lazyConfig;
41
    }
42
43 87
    private function wrapFieldsArgument(array $fields)
44
    {
45 87
        foreach ($fields as &$field) {
46 87
            if (isset($field['resolve']) && \is_callable($field['resolve'])) {
47 79
                $field['resolve'] = $this->argumentFactory->wrapResolverArgs($field['resolve']);
48
            }
49
        }
50
51 87
        return $fields;
52
    }
53
}
54