Code Duplication    Length = 9-9 lines in 2 locations

src/Gateways/Alipay/Support.php 2 locations

@@ 158-166 (lines=9) @@
155
            throw new InvalidConfigException('Missing Alipay Config -- [private_key]');
156
        }
157
158
        if (Str::endsWith($privateKey, '.pem')) {
159
            $privateKey = openssl_pkey_get_private(
160
                Str::startsWith($privateKey, 'file://') ? $privateKey : 'file://'.$privateKey
161
            );
162
        } else {
163
            $privateKey = "-----BEGIN RSA PRIVATE KEY-----\n".
164
                wordwrap($privateKey, 64, "\n", true).
165
                "\n-----END RSA PRIVATE KEY-----";
166
        }
167
168
        openssl_sign(self::getSignContent($params), $sign, $privateKey, OPENSSL_ALGO_SHA256);
169
@@ 202-210 (lines=9) @@
199
            throw new InvalidConfigException('Missing Alipay Config -- [ali_public_key]');
200
        }
201
202
        if (Str::endsWith($publicKey, '.pem')) {
203
            $publicKey = openssl_pkey_get_public(
204
                Str::startsWith($publicKey, 'file://') ? $publicKey : 'file://'.$publicKey
205
            );
206
        } else {
207
            $publicKey = "-----BEGIN PUBLIC KEY-----\n".
208
                wordwrap($publicKey, 64, "\n", true).
209
                "\n-----END PUBLIC KEY-----";
210
        }
211
212
        $sign = $sign ?? $data['sign'];
213