Code Duplication    Length = 11-13 lines in 3 locations

src/Entity/OAuth/Repository/AccessTokenRepository.php 1 location

@@ 16-28 (lines=13) @@
13
     * @param $oauthToken
14
     * @return null|array
15
     */
16
    public function getAccessToken($oauthToken)
17
    {
18
        /** @var AccessToken $token */
19
        $token = $this->findOneBy(['token' => $oauthToken]);
20
        if ($token instanceof AccessToken) {
21
            $array = (array) $token->toArray();
22
            /** @var DateTime $date */
23
            $date = $array['expires'];
24
            $array['expires'] = $date->getTimestamp();
25
            return $array;
26
        }
27
        return null;
28
    }
29
30
    /**
31
     * @param string $oauthToken

src/Entity/OAuth/Repository/AuthCodeRepository.php 1 location

@@ 16-27 (lines=12) @@
13
     * @param $code
14
     * @return null|array
15
     */
16
    public function getAuthorizationCode($code)
17
    {
18
        $authCode = $this->findOneBy(['code' => $code]);
19
        if ($authCode) {
20
            $authCode = $authCode->toArray();
21
            /** @var DateTime $date */
22
            $date = $authCode['expires'];
23
            $authCode['expires'] = $date->getTimestamp();
24
            return $authCode;
25
        }
26
        return null;
27
    }
28
29
    /**
30
     * @param $code

src/Entity/OAuth/Repository/RefreshTokenRepository.php 1 location

@@ 12-22 (lines=11) @@
9
10
class RefreshTokenRepository extends EntityRepository implements RefreshTokenInterface
11
{
12
    public function getRefreshToken($refreshToken)
13
    {
14
        $refreshToken = $this->findOneBy(['refresh_token' => $refreshToken]);
15
        if ($refreshToken) {
16
            $refreshToken = $refreshToken->toArray();
17
            /** @var DateTime $date */
18
            $date = $refreshToken['expires'];
19
            $refreshToken['expires'] = $date->getTimestamp();
20
        }
21
        return $refreshToken;
22
    }
23
24
    public function setRefreshToken($refreshToken, $clientIdentifier, $userEmail, $expires, $scope = null)
25
    {