Completed
Push — master ( 24ab37...36f73c )
by Derek Stephen
01:35
created

AccessTokenRepository   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
c 0
b 0
f 0
lcom 1
cbo 3
dl 0
loc 34
ccs 0
cts 10
cp 0
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A revokeAccessToken() 0 4 1
A isAccessTokenRevoked() 0 4 1
A persistNewAccessToken() 0 6 1
A getNewToken() 0 4 1
1
<?php
2
3
namespace OAuth\Repository;
4
5
use Doctrine\ORM\EntityRepository;
6
use League\OAuth2\Server\Entities\AccessTokenEntityInterface;
7
use League\OAuth2\Server\Entities\ClientEntityInterface;
8
use League\OAuth2\Server\Repositories\AccessTokenRepositoryInterface;
9
use OAuth\AccessToken;
10
11
class AccessTokenRepository extends EntityRepository implements AccessTokenRepositoryInterface
12
{
13
    /**
14
     * {@inheritdoc}
15
     */
16
    public function persistNewAccessToken(AccessTokenEntityInterface $accessTokenEntity)
17
    {
18
        $this->_em->persist($accessTokenEntity);
19
        $this->_em->flush();
20
        return $accessTokenEntity;
21
    }
22
    /**
23
     * {@inheritdoc}
24
     */
25
    public function revokeAccessToken($tokenId)
26
    {
27
        // Some logic here to revoke the access token
28
    }
29
    /**
30
     * {@inheritdoc}
31
     */
32
    public function isAccessTokenRevoked($tokenId)
33
    {
34
        return false; // Access token hasn't been revoked
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function getNewToken(ClientEntityInterface $clientEntity, array $scopes, $userIdentifier = null)
41
    {
42
        return new AccessToken();
43
    }
44
}