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 (#40)
by Jérémiah
13:22
created

AuthorizationExpressionProvider   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 77
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 4
Bugs 2 Features 2
Metric Value
wmc 1
c 4
b 2
f 2
lcom 0
cbo 1
dl 0
loc 77
ccs 45
cts 45
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getFunctions() 0 74 1
1
<?php
2
3
/*
4
 * This file is part of the OverblogGraphQLBundle package.
5
 *
6
 * (c) Overblog <http://github.com/overblog/>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Overblog\GraphQLBundle\ExpressionLanguage;
13
14
use Symfony\Component\ExpressionLanguage\ExpressionFunction;
15
use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface;
16
17
class AuthorizationExpressionProvider implements ExpressionFunctionProviderInterface
18
{
19 24
    public function getFunctions()
20
    {
21
        return [
22 24
            new ExpressionFunction(
23 24
                'hasRole',
24
                function ($role) {
25 2
                    return sprintf('$container->get(\'security.authorization_checker\')->isGranted(%s)', $role);
26 24
                },
27
                function () {}
28 24
            ),
29
30 24
            new ExpressionFunction(
31 24
                'hasAnyRole',
32
                function ($roles) {
33 1
                    $code = sprintf('array_reduce(%s, function ($isGranted, $role) use ($container) { return $isGranted || $container->get(\'security.authorization_checker\')->isGranted($role); }, false)', $roles);
34
35 1
                    return $code;
36 24
                },
37
                function () {}
38 24
            ),
39
40 24
            new ExpressionFunction(
41 24
                'isAnonymous',
42
                function () {
43 1
                    return '$container->get(\'security.authorization_checker\')->isGranted(\'IS_AUTHENTICATED_ANONYMOUSLY\')';
44 24
                },
45
                function () {}
46 24
            ),
47
48 24
            new ExpressionFunction(
49 24
                'isRememberMe',
50
                function () {
51 1
                    return '$container->get(\'security.authorization_checker\')->isGranted(\'IS_AUTHENTICATED_REMEMBERED\')';
52 24
                },
53
                function () {}
54 24
            ),
55
56 24
            new ExpressionFunction(
57 24
                'isFullyAuthenticated',
58
                function () {
59 2
                    return '$container->get(\'security.authorization_checker\')->isGranted(\'IS_AUTHENTICATED_FULLY\')';
60 24
                },
61
                function () {}
62 24
            ),
63
64 24
            new ExpressionFunction(
65 24
                'isAuthenticated',
66
                function () {
67 1
                    return '$container->get(\'security.authorization_checker\')->isGranted(\'IS_AUTHENTICATED_REMEMBERED\') || $container->get(\'security.authorization_checker\')->isGranted(\'IS_AUTHENTICATED_FULLY\')';
68 24
                },
69
                function () {}
70 24
            ),
71
72 24
            new ExpressionFunction(
73 24
                'hasPermission',
74
                function ($object, $permission) {
75 1
                    $code = sprintf('$container->get(\'security.authorization_checker\')->isGranted(%s, %s)', $permission, $object);
76
77 1
                    return $code;
78 24
                },
79
                function () {}
80 24
            ),
81
82 24
            new ExpressionFunction(
83 24
                'hasAnyPermission',
84
                function ($object, $permissions) {
85 1
                    $code = sprintf('array_reduce(%s, function ($isGranted, $permission) use ($container, $object) { return $isGranted || $container->get(\'security.authorization_checker\')->isGranted($permission, %s); }, false)', $permissions, $object);
86
87 1
                    return $code;
88 24
                },
89
                function () {}
90 24
            ),
91 24
        ];
92
    }
93
}
94