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:46
created

HasAnyRole::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1.0028

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 11
ccs 6
cts 7
cp 0.8571
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1.0028
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Overblog\GraphQLBundle\ExpressionLanguage\ExpressionFunction\Security;
6
7
use Overblog\GraphQLBundle\ExpressionLanguage\ExpressionFunction;
8
use Overblog\GraphQLBundle\Generator\TypeGenerator;
9
use function sprintf;
10
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
11
12
final class HasAnyRole extends ExpressionFunction
13
{
14 130
    public function __construct(AuthorizationCheckerInterface $authorizationChecker)
15
    {
16 130
        parent::__construct(
17 130
            'hasAnyRole',
18
            function ($roles): string {
19 1
                $code = sprintf('array_reduce(%s, function ($isGranted, $role) use (%s) { return $isGranted || $globalVariable->get(\'container\')->get(\'security.authorization_checker\')->isGranted($role); }, false)', $roles, TypeGenerator::USE_FOR_CLOSURES);
20
21 1
                return $code;
22 130
            },
23
            function ($arguments, $roles) use ($authorizationChecker): bool {
24
                return $authorizationChecker->isGranted($roles);
25 130
            }
26
        );
27 130
    }
28
}
29