Completed
Push — master ( 704578...e88511 )
by Alex
32:19
created

RefreshTokenRepository   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 4
c 2
b 1
f 0
lcom 0
cbo 1
dl 0
loc 34
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A persistNewRefreshToken() 0 4 1
A revokeRefreshToken() 0 4 1
A isRefreshTokenRevoked() 0 4 1
A getNewRefreshToken() 0 4 1
1
<?php
2
/**
3
 * @author      Alex Bilbie <[email protected]>
4
 * @copyright   Copyright (c) Alex Bilbie
5
 * @license     http://mit-license.org/
6
 *
7
 * @link        https://github.com/thephpleague/oauth2-server
8
 */
9
10
namespace OAuth2ServerExamples\Repositories;
11
12
use League\OAuth2\Server\Entities\RefreshTokenEntityInterface;
13
use League\OAuth2\Server\Repositories\RefreshTokenRepositoryInterface;
14
use OAuth2ServerExamples\Entities\RefreshTokenEntity;
15
16
class RefreshTokenRepository implements RefreshTokenRepositoryInterface
17
{
18
    /**
19
     * {@inheritdoc}
20
     */
21
    public function persistNewRefreshToken(RefreshTokenEntityInterface $refreshTokenEntityInterface)
22
    {
23
        // Some logic to persist the refresh token in a database
24
    }
25
26
    /**
27
     * {@inheritdoc}
28
     */
29
    public function revokeRefreshToken($tokenId)
30
    {
31
        // Some logic to revoke the refresh token in a database
32
    }
33
34
    /**
35
     * {@inheritdoc}
36
     */
37
    public function isRefreshTokenRevoked($tokenId)
38
    {
39
        return false; // The refresh token has not been revoked
40
    }
41
42
    /**
43
     * {@inheritdoc}
44
     */
45
    public function getNewRefreshToken()
46
    {
47
        return new RefreshTokenEntity();
48
    }
49
}
50