Completed
Push — master ( de901a...efbe60 )
by Derek Stephen
04:42
created

AccessTokenRepository::getNewToken()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 7
nc 2
nop 3
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\Entities\Traits\EntityTrait;
9
use League\OAuth2\Server\Entities\Traits\TokenEntityTrait;
10
use OAuth\AccessToken;
11
12
class AccessTokenRepository
13
{
14
    /**
15
     * {@inheritdoc}
16
     */
17
    public function persistNewAccessToken(AccessTokenEntityInterface $accessTokenEntity)
0 ignored issues
show
Unused Code introduced by
The parameter $accessTokenEntity is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
18
    {
19
        // Some logic here to save the access token to a database
20
    }
21
    /**
22
     * {@inheritdoc}
23
     */
24
    public function revokeAccessToken($tokenId)
0 ignored issues
show
Unused Code introduced by
The parameter $tokenId is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
25
    {
26
        // Some logic here to revoke the access token
27
    }
28
    /**
29
     * {@inheritdoc}
30
     */
31
    public function isAccessTokenRevoked($tokenId)
0 ignored issues
show
Unused Code introduced by
The parameter $tokenId is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
32
    {
33
        return false; // Access token hasn't been revoked
34
    }
35
    /**
36
     * {@inheritdoc}
37
     */
38
    public function getNewToken(ClientEntityInterface $clientEntity, array $scopes, $userIdentifier = null)
39
    {
40
        $accessToken = new AccessToken();
41
        $accessToken->setClient($clientEntity);
42
        foreach ($scopes as $scope) {
43
            $accessToken->addScope($scope);
44
        }
45
        $accessToken->setUserIdentifier($userIdentifier);
46
        return $accessToken;
47
    }
48
}