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 ( 5c920d...e34953 )
by Jérémiah
05:53 queued 24s
created

AuthorizationExpressionProvider   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 85
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 83.33%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 85
ccs 45
cts 54
cp 0.8333
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B getFunctions() 0 82 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 25
    public function getFunctions()
20
    {
21
        return [
22 25
            new ExpressionFunction(
23 25
                'hasRole',
24
                function ($role) {
25 2
                    return sprintf('$container->get(\'security.authorization_checker\')->isGranted(%s)', $role);
26 25
                },
27
                function () {
28
                }
29 25
            ),
30
31 25
            new ExpressionFunction(
32 25
                'hasAnyRole',
33
                function ($roles) {
34 1
                    $code = sprintf('array_reduce(%s, function ($isGranted, $role) use ($container) { return $isGranted || $container->get(\'security.authorization_checker\')->isGranted($role); }, false)', $roles);
35
36 1
                    return $code;
37 25
                },
38
                function () {
39
                }
40 25
            ),
41
42 25
            new ExpressionFunction(
43 25
                'isAnonymous',
44
                function () {
45 1
                    return '$container->get(\'security.authorization_checker\')->isGranted(\'IS_AUTHENTICATED_ANONYMOUSLY\')';
46 25
                },
47
                function () {
48
                }
49 25
            ),
50
51 25
            new ExpressionFunction(
52 25
                'isRememberMe',
53
                function () {
54 1
                    return '$container->get(\'security.authorization_checker\')->isGranted(\'IS_AUTHENTICATED_REMEMBERED\')';
55 25
                },
56
                function () {
57
                }
58 25
            ),
59
60 25
            new ExpressionFunction(
61 25
                'isFullyAuthenticated',
62
                function () {
63 2
                    return '$container->get(\'security.authorization_checker\')->isGranted(\'IS_AUTHENTICATED_FULLY\')';
64 25
                },
65
                function () {
66
                }
67 25
            ),
68
69 25
            new ExpressionFunction(
70 25
                'isAuthenticated',
71
                function () {
72 1
                    return '$container->get(\'security.authorization_checker\')->isGranted(\'IS_AUTHENTICATED_REMEMBERED\') || $container->get(\'security.authorization_checker\')->isGranted(\'IS_AUTHENTICATED_FULLY\')';
73 25
                },
74
                function () {
75
                }
76 25
            ),
77
78 25
            new ExpressionFunction(
79 25
                'hasPermission',
80
                function ($object, $permission) {
81 1
                    $code = sprintf('$container->get(\'security.authorization_checker\')->isGranted(%s, %s)', $permission, $object);
82
83 1
                    return $code;
84 25
                },
85
                function () {
86
                }
87 25
            ),
88
89 25
            new ExpressionFunction(
90 25
                'hasAnyPermission',
91
                function ($object, $permissions) {
92 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);
93
94 1
                    return $code;
95 25
                },
96
                function () {
97
                }
98 25
            ),
99 25
        ];
100
    }
101
}
102