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

AuthCodeRepository   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 persistNewAuthCode() 0 4 1
A revokeAuthCode() 0 4 1
A isAuthCodeRevoked() 0 4 1
A getNewAuthCode() 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\AuthCodeEntityInterface;
13
use League\OAuth2\Server\Repositories\AuthCodeRepositoryInterface;
14
use OAuth2ServerExamples\Entities\AuthCodeEntity;
15
16
class AuthCodeRepository implements AuthCodeRepositoryInterface
17
{
18
    /**
19
     * {@inheritdoc}
20
     */
21
    public function persistNewAuthCode(AuthCodeEntityInterface $authCodeEntity)
22
    {
23
        // Some logic to persist the auth code to a database
24
    }
25
26
    /**
27
     * {@inheritdoc}
28
     */
29
    public function revokeAuthCode($codeId)
30
    {
31
        // Some logic to revoke the auth code in a database
32
    }
33
34
    /**
35
     * {@inheritdoc}
36
     */
37
    public function isAuthCodeRevoked($codeId)
38
    {
39
        return false; // The auth code has not been revoked
40
    }
41
42
    /**
43
     * {@inheritdoc}
44
     */
45
    public function getNewAuthCode()
46
    {
47
        return new AuthCodeEntity();
48
    }
49
}
50