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

Passed
Pull Request — master (#536)
by
unknown
19:25 queued 15:32
created

GlobalID   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 7
eloc 10
c 0
b 0
f 0
dl 0
loc 22
ccs 12
cts 12
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A isTypeNameEmpty() 0 3 4
A __construct() 0 13 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Overblog\GraphQLBundle\ExpressionLanguage\ExpressionFunction\GraphQL\Relay;
6
7
use Overblog\GraphQLBundle\ExpressionLanguage\ExpressionFunction;
8
use Overblog\GraphQLBundle\Relay\Node\GlobalId as GlobalIdHelper;
9
10
final class GlobalID extends ExpressionFunction
11
{
12 135
    public function __construct()
13
    {
14 135
        parent::__construct(
15 135
            'globalId',
16
            function (string $id, string $typeName = null): string {
17 1
                $typeName = $this->isTypeNameEmpty($typeName) ? '$info->parentType->name' : $typeName;
18
19 1
                return \sprintf('\%s::toGlobalId(%s, %s)', GlobalIdHelper::class, $typeName, $id);
20 135
            },
21
            function ($arguments, $id, $typeName = null) {
22 1
                $typeName = empty($typeName) ? $arguments['info']->parentType->name : $typeName;
23
24 1
                return GlobalIdHelper::toGlobalId($typeName, $id);
25 135
            }
26
        );
27 135
    }
28
29 1
    private function isTypeNameEmpty($typeName): bool
30
    {
31 1
        return null === $typeName || '""' === $typeName || 'null' === $typeName || 'false' === $typeName;
32
    }
33
}
34