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 (#277)
by Jérémiah
20:41
created

Helper   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 2
dl 0
loc 30
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getToken() 0 8 2
A getUser() 0 13 3
1
<?php
2
3
namespace Overblog\GraphQLBundle\ExpressionLanguage\ExpressionFunction\Security;
4
5
use Overblog\GraphQLBundle\Definition\GlobalVariables;
6
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
7
8
final class Helper
9
{
10
    /**
11
     * @param GlobalVariables $globalVariable
12
     *
13
     * @return null|TokenInterface
14
     */
15
    private static function getToken(GlobalVariables $globalVariable)
16
    {
17
        if (!$globalVariable->get('container')->has('security.token_storage')) {
18
            return;
19
        }
20
21
        return $globalVariable->get('container')->get('security.token_storage')->getToken();
22
    }
23
24
    public static function getUser(GlobalVariables $globalVariable)
25
    {
26
        if (!$token = self::getToken($globalVariable)) {
27
            return;
28
        }
29
30
        $user = $token->getUser();
31
        if (!is_object($user)) {
32
            return;
33
        }
34
35
        return $user;
36
    }
37
}
38