JWTUserToken   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
c 1
b 0
f 1
lcom 0
cbo 1
dl 0
loc 35
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setRawToken() 0 4 1
A getCredentials() 0 4 1
A __construct() 0 5 1
1
<?php
2
3
namespace ApiBundle\Security\Authentication\Token;
4
5
use Symfony\Component\Security\Core\Authentication\Token\AbstractToken;
6
7
class JWTUserToken extends AbstractToken
8
{
9
    const KEY_TYPE = OPENSSL_KEYTYPE_RSA;
10
    const ALGO = OPENSSL_ALGO_SHA256;
11
12
    /**
13
     * @var string
14
     */
15
    protected $rawToken;
16
17
    /**
18
     * {@inheritdoc}
19
     */
20
    public function __construct(array $roles = [])
21
    {
22
        parent::__construct($roles);
23
        $this->setAuthenticated(count($roles) > 0);
24
    }
25
26
    /**
27
     * @param string $rawToken
28
     */
29
    public function setRawToken($rawToken)
30
    {
31
        $this->rawToken = $rawToken;
32
    }
33
34
    /**
35
     * {@inheritdoc}
36
     */
37
    public function getCredentials()
38
    {
39
        return $this->rawToken;
40
    }
41
}
42