Code Duplication    Length = 18-18 lines in 2 locations

src/Client.php 2 locations

@@ 116-133 (lines=18) @@
113
     * @return array
114
     * @throws ApiException
115
     */
116
    public function getAccessToken($code)
117
    {
118
        try {
119
            $response = $this->httpClient->post(self::TOKEN_ENDPOINT, [
120
                'form_params' => [
121
                    'grant_type'    => 'authorization_code',
122
                    'client_id'     => $this->clientId,
123
                    'client_secret' => $this->clientSecret,
124
                    'redirect_uri'  => $this->redirectUrl,
125
                    'code'          => $code
126
                ]
127
            ]);
128
129
            return json_decode((string) $response->getBody(), true);
130
        } catch (BadResponseException $e) {
131
            throw ApiException::fromBadResponseException($e);
132
        }
133
    }
134
135
    /**
136
     * @param string $refreshToken
@@ 141-158 (lines=18) @@
138
     * @return array
139
     * @throws ApiException
140
     */
141
    public function refreshAccessToken($refreshToken)
142
    {
143
        try {
144
            $response = $this->httpClient->post(self::TOKEN_ENDPOINT, [
145
                'form_params' => [
146
                    'grant_type'    => 'refresh_token',
147
                    'client_id'     => $this->clientId,
148
                    'client_secret' => $this->clientSecret,
149
                    'redirect_uri'  => $this->redirectUrl,
150
                    'refresh_token' => $refreshToken
151
                ]
152
            ]);
153
154
            return json_decode((string) $response->getBody(), true);
155
        } catch (BadResponseException $e) {
156
            throw ApiException::fromBadResponseException($e);
157
        }
158
    }
159
160
    /**
161
     * @param string $accessToken