UserToken   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 5
c 1
b 0
f 0
dl 0
loc 19
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getCredentials() 0 3 1
1
<?php
2
3
/*
4
 * This file is part of the TheAlternativeZurich/events project.
5
 *
6
 * (c) Florian Moser <[email protected]>
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 App\Security;
13
14
use App\Entity\User;
15
use Symfony\Component\Security\Core\Authentication\Token\AbstractToken;
16
17
class UserToken extends AbstractToken
18
{
19
    public function __construct(User $user)
20
    {
21
        parent::__construct($user->getRoles());
22
23
        $this->setUser($user->getEmail());
24
        $this->setAuthenticated(true);
25
    }
26
27
    /**
28
     * This is meant to be only an authenticated token, where credentials
29
     * have already been used and are thus cleared.
30
     *
31
     * {@inheritdoc}
32
     */
33
    public function getCredentials()
34
    {
35
        return [];
36
    }
37
}
38