Code Duplication    Length = 13-14 lines in 2 locations

src/AccessTokenFactory.php 2 locations

@@ 29-42 (lines=14) @@
26
        $this->clientSecret = $clientSecret;
27
    }
28
29
    public function getFromUserLogin(string $username, string $password): AccessToken
30
    {
31
        $options = [
32
            'form_params' => [
33
                'grant_type' => self::API_ACCESS_TOKEN_PASSWORD_GRANT,
34
                'client_id' => $this->clientId,
35
                'client_secret' => $this->clientSecret,
36
                'username' => $username,
37
                'password' => $password
38
            ],
39
        ];
40
41
        return $this->getAccessTokenFromData($this->makeRequest(self::API_ACCESS_TOKEN_REQUEST_URL, $options));
42
    }
43
44
    public function refresh(AccessToken $accessToken): AccessToken
45
    {
@@ 44-56 (lines=13) @@
41
        return $this->getAccessTokenFromData($this->makeRequest(self::API_ACCESS_TOKEN_REQUEST_URL, $options));
42
    }
43
44
    public function refresh(AccessToken $accessToken): AccessToken
45
    {
46
        $options = [
47
            'form_params' => [
48
                'grant_type' => self::API_ACCESS_TOKEN_REFRESH_TOKEN_GRANT,
49
                'client_id' => $this->clientId,
50
                'client_secret' => $this->clientSecret,
51
                'refresh_token' => $accessToken->getRefreshToken()
52
            ],
53
        ];
54
55
        return $this->getAccessTokenFromData($this->makeRequest(self::API_ACCESS_TOKEN_REFRESH_TOKEN_URL, $options));
56
    }
57
58
    private function makeRequest($url, $options): array
59
    {