Test Setup Failed
Push — oauth2 ( 63c070 )
by Herberto
11:43 queued 07:12
created

OauthRefreshToken   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A isRevoked() 0 4 1
A revoke() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Explicit Architecture POC,
7
 * which is created on top of the Symfony Demo application.
8
 *
9
 * (c) Herberto Graça <[email protected]>
10
 *
11
 * For the full copyright and license information, please view the LICENSE
12
 * file that was distributed with this source code.
13
 */
14
15
namespace Acme\App\Infrastructure\Auth\Authentication\Oauth;
16
17
use League\OAuth2\Server\Entities\RefreshTokenEntityInterface;
18
use League\OAuth2\Server\Entities\Traits\EntityTrait;
19
use League\OAuth2\Server\Entities\Traits\RefreshTokenTrait;
20
21
/**
22
 * Class OauthRefreshToken
23
 *
24
 * @method OauthAccessToken getAccessToken()
25
 */
26
class OauthRefreshToken implements RefreshTokenEntityInterface
27
{
28
    use EntityTrait;
29
    use RefreshTokenTrait;
30
31
    /**
32
     * @var bool
33
     */
34
    private $revoked = false;
35
36
    public function __construct()
37
    {
38
        $this->setIdentifier(new OauthRefreshTokenId());
39
    }
40
41
    public function isRevoked(): bool
42
    {
43
        return $this->revoked;
44
    }
45
46
    public function revoke(): void
47
    {
48
        $this->revoked = true;
49
    }
50
}
51