Code Duplication    Length = 18-19 lines in 2 locations

src/Repositories/AccessTokenRepository.php 1 location

@@ 36-53 (lines=18) @@
33
        return $accessToken;
34
    }
35
36
    public function persistNewAccessToken(AccessTokenEntityInterface $accessTokenEntity)
37
    {
38
        /** @var AccessToken $accessToken */
39
        $accessToken = $this->makeModel(false);
40
41
        $accessToken->forceFill([
42
            'id' => $accessTokenEntity->getIdentifier(),
43
            'expires_at' => $accessTokenEntity->getExpiryDateTime(),
44
            'user_id' => $accessTokenEntity->getUserIdentifier(),
45
            'client_id' => $accessTokenEntity->getClient()->getIdentifier()
46
        ]);
47
48
        array_map([$accessToken, 'addScope'], $accessTokenEntity->getScopes());
49
50
        $accessToken->save();
51
52
        return $accessToken;
53
    }
54
55
    public function revokeAccessToken($tokenId)
56
    {

src/Repositories/AuthCodeRepository.php 1 location

@@ 24-42 (lines=19) @@
21
        return $this->makeModel(false);
22
    }
23
24
    public function persistNewAuthCode(AuthCodeEntityInterface $authCodeEntity)
25
    {
26
        /** @var AuthCode $authCode */
27
        $authCode = $this->makeModel(false);
28
29
        $authCode->forceFill([
30
            'id' => $authCodeEntity->getIdentifier(),
31
            'expires_at' => $authCodeEntity->getExpiryDateTime(),
32
            'client_id' => $authCodeEntity->getClient()->getIdentifier(),
33
            'user_id' => $authCodeEntity->getUserIdentifier(),
34
            'redirect_uri' => $authCodeEntity->getRedirectUri()
35
        ]);
36
37
        array_map([$authCode, 'addScope'], $authCodeEntity->getScopes());
38
39
        $authCode->save();
40
41
        return $authCode;
42
    }
43
44
    public function revokeAuthCode($codeId)
45
    {