Code Duplication    Length = 9-9 lines in 2 locations

src/Gateways/Alipay/Support.php 2 locations

@@ 176-184 (lines=9) @@
173
            throw new InvalidConfigException('Missing Alipay Config -- [private_key]');
174
        }
175
176
        if (Str::endsWith($privateKey, '.pem')) {
177
            $privateKey = openssl_pkey_get_private(
178
                Str::startsWith($privateKey, 'file://') ? $privateKey : 'file://'.$privateKey
179
            );
180
        } else {
181
            $privateKey = "-----BEGIN RSA PRIVATE KEY-----\n".
182
                wordwrap($privateKey, 64, "\n", true).
183
                "\n-----END RSA PRIVATE KEY-----";
184
        }
185
186
        openssl_sign(self::getSignContent($params), $sign, $privateKey, OPENSSL_ALGO_SHA256);
187
@@ 220-228 (lines=9) @@
217
            throw new InvalidConfigException('Missing Alipay Config -- [ali_public_key]');
218
        }
219
220
        if (Str::endsWith($publicKey, '.pem')) {
221
            $publicKey = openssl_pkey_get_public(
222
                Str::startsWith($publicKey, 'file://') ? $publicKey : 'file://'.$publicKey
223
            );
224
        } else {
225
            $publicKey = "-----BEGIN PUBLIC KEY-----\n".
226
                wordwrap($publicKey, 64, "\n", true).
227
                "\n-----END PUBLIC KEY-----";
228
        }
229
230
        $sign = $sign ?? $data['sign'];
231