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 (#536)
by
unknown
21:14
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 Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
10
11
final class HasAnyRole extends ExpressionFunction
12
{
13 131
    public function __construct(AuthorizationCheckerInterface $authorizationChecker)
14
    {
15 131
        parent::__construct(
16 131
            'hasAnyRole',
17
            function ($roles): string {
18 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);
19
20 1
                return $code;
21 131
            },
22
            function ($arguments, $roles) use ($authorizationChecker): bool {
23
                return $authorizationChecker->isGranted($roles);
24 131
            }
25
        );
26 131
    }
27
}
28