AuthCodeRepository   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 3
c 0
b 0
f 0
dl 0
loc 32
rs 10
wmc 4

4 Methods

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