Code Duplication    Length = 13-14 lines in 2 locations

src/Client/AccessTokenFactory.php 2 locations

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