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
22:38 queued 19:05
created

Helper::getToken()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 1
crap 2
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 9
    private static function getToken(GlobalVariables $globalVariable)
16
    {
17 9
        if (!$globalVariable->get('container')->has('security.token_storage')) {
18 1
            return;
19
        }
20
21 8
        return $globalVariable->get('container')->get('security.token_storage')->getToken();
22
    }
23
24 9
    public static function getUser(GlobalVariables $globalVariable)
25
    {
26 9
        if (!$token = self::getToken($globalVariable)) {
27 2
            return;
28
        }
29
30 7
        $user = $token->getUser();
31 7
        if (!is_object($user)) {
32 4
            return;
33
        }
34
35 3
        return $user;
36
    }
37
}
38