Code Duplication    Length = 16-16 lines in 2 locations

src/Client.php 2 locations

@@ 201-216 (lines=16) @@
198
     * @return array|mixed
199
     * @throws \Exception
200
     */
201
    public function login($username, $password)
202
    {
203
        $url = $this->salesforceLoginUrl . 'services/oauth2/token';
204
205
        $post_data = [
206
            'grant_type'    => 'password',
207
            'client_id'     => $this->clientId,
208
            'client_secret' => $this->clientSecret,
209
            'username'      => $username,
210
            'password'      => $password
211
        ];
212
213
        $response = $this->makeRequest('post', $url, ['form_params' => $post_data]);
214
215
        return json_decode($response->getBody(), true);
216
    }
217
218
    /**
219
     * Complete the oauth process by confirming the code and returning an access token
@@ 226-241 (lines=16) @@
223
     * @return array|mixed
224
     * @throws \Exception
225
     */
226
    public function authorizeConfirm($code, $redirect_url)
227
    {
228
        $url = $this->salesforceLoginUrl . 'services/oauth2/token';
229
230
        $post_data = [
231
            'grant_type'    => 'authorization_code',
232
            'client_id'     => $this->clientId,
233
            'client_secret' => $this->clientSecret,
234
            'code'          => $code,
235
            'redirect_uri'  => $redirect_url
236
        ];
237
238
        $response = $this->makeRequest('post', $url, ['form_params' => $post_data]);
239
240
        return json_decode($response->getBody(), true);
241
    }
242
243
    /**
244
     * Get the url to redirect users to when setting up a salesforce access token