Code Duplication    Length = 10-10 lines in 2 locations

src/Plugin/Alipay/LaunchPlugin.php 1 location

@@ 96-105 (lines=10) @@
93
     * @throws \Yansongda\Pay\Exception\ServiceNotFoundException
94
     * @throws \Yansongda\Pay\Exception\InvalidConfigException
95
     */
96
    protected function getAlipayPublicKey(Rocket $rocket)
97
    {
98
        $public = get_alipay_config($rocket->getParams())->get('alipay_public_cert_path');
99
100
        if (is_null($public)) {
101
            throw new InvalidConfigException(InvalidConfigException::ALIPAY_CONFIG_ERROR, 'Missing Alipay Config -- [alipay_public_cert_path]');
102
        }
103
104
        return get_alipay_cert($public);
105
    }
106
}
107

src/Plugin/Alipay/SignPlugin.php 1 location

@@ 45-54 (lines=10) @@
42
     *
43
     * @return false|resource|string
44
     */
45
    protected function getPrivateKey(array $params)
46
    {
47
        $privateKey = get_alipay_config($params)->get('app_secret_cert');
48
49
        if (is_null($privateKey)) {
50
            throw new InvalidConfigException(InvalidConfigException::ALIPAY_CONFIG_ERROR, 'Missing Alipay Config -- [app_secret_cert]');
51
        }
52
53
        return get_alipay_cert($privateKey);
54
    }
55
56
    protected function getSignContent(Collection $payload): string
57
    {