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

AccessTokenRepository::getAccessToken()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 8

Duplication

Lines 13
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 13
loc 13
ccs 0
cts 11
cp 0
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 8
nc 2
nop 1
crap 6

1 Method

Rating   Name   Duplication   Size   Complexity  
A AccessTokenRepository::revokeAccessToken() 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
}