Code Duplication    Length = 13-15 lines in 2 locations

src/Auth/Auth.php 1 location

@@ 118-132 (lines=15) @@
115
    /**
116
     * @return void
117
     */
118
    private function auth(): void
119
    {
120
        $this->setClientCredentials();
121
122
        //TODO: Add auth for username and password
123
        $body = [
124
            'grant_type' => $this->grantType,
125
            'client_secret' => $this->clientSecret,
126
            'client_id' => $this->clientId
127
        ];
128
129
        $response = Http::asForm()->post($this->loginUrl, $body)->throw()->json();
130
        $this->token = $response['access_token'];
131
        $this->tokenExpiry = now()->addSeconds($response['expires_in'])->unix();
132
    }
133
}
134

src/Bankly.php 1 location

@@ 695-707 (lines=13) @@
692
     * @param string $grant_type Default sets to 'client_credentials'
693
     * @throws RequestException
694
     */
695
    private function auth($grant_type = 'client_credentials'): void
696
    {
697
        //TODO: Add auth for username and password
698
        $body = [
699
            'grant_type' => $grant_type,
700
            'client_secret' => $this->client_secret,
701
            'client_id' => $this->client_id
702
        ];
703
704
        $response = Http::asForm()->post($this->login_url, $body)->throw()->json();
705
        $this->token = $response['access_token'];
706
        $this->token_expiry = now()->addSeconds($response['expires_in'])->unix();
707
    }
708
}
709