Completed
Push — master ( ff92f6...3ef1d3 )
by John
09:08
created

JwtAuthenticationToken   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 27
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getCredentials() 0 4 1
1
<?php declare(strict_types = 1);
2
/*
3
 * This file is part of the KleijnWeb\JwtBundle package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
9
namespace KleijnWeb\JwtBundle\Authentication;
10
11
use Symfony\Component\Security\Core\Authentication\Token\AbstractToken;
12
13
class JwtAuthenticationToken extends AbstractToken
14
{
15
    /**
16
     * @var string
17
     */
18
    private $tokenString;
19
20
    /**
21
     * @param array  $roles
22
     * @param string $tokenString
23
     */
24
    public function __construct(array $roles = [], string $tokenString = null)
25
    {
26
        $this->tokenString = $tokenString;
27
        parent::__construct($roles);
28
29
        $this->setAuthenticated(count($roles) > 0);
30
    }
31
32
    /**
33
     * @return string
34
     */
35
    public function getCredentials()
36
    {
37
        return $this->tokenString;
38
    }
39
}