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

AccessTokenRepository::getNewToken()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 3
crap 2
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
}