Code Duplication    Length = 15-15 lines in 2 locations

src/Functions.php 2 locations

@@ 10-24 (lines=15) @@
7
use Yansongda\Supports\Config;
8
use Yansongda\Supports\Str;
9
10
if (!function_exists('get_alipay_config')) {
11
    /**
12
     * @throws \Yansongda\Pay\Exception\ContainerDependencyException
13
     * @throws \Yansongda\Pay\Exception\ContainerException
14
     * @throws \Yansongda\Pay\Exception\ServiceNotFoundException
15
     */
16
    function get_alipay_config(array $params): Config
17
    {
18
        $alipay = Pay::get(ConfigInterface::class)->get('alipay');
19
20
        $config = $params['_config'] ?? 'default';
21
22
        return new Config($alipay[$config] ?? []);
23
    }
24
}
25
26
if (!function_exists('get_alipay_cert')) {
27
    /**
@@ 48-62 (lines=15) @@
45
    }
46
}
47
48
if (!function_exists('get_wechat_config')) {
49
    /**
50
     * @throws \Yansongda\Pay\Exception\ContainerDependencyException
51
     * @throws \Yansongda\Pay\Exception\ContainerException
52
     * @throws \Yansongda\Pay\Exception\ServiceNotFoundException
53
     */
54
    function get_wechat_config(array $params): Config
55
    {
56
        $wechat = Pay::get(ConfigInterface::class)->get('wechat');
57
58
        $config = $params['_config'] ?? 'default';
59
60
        return new Config($wechat[$config] ?? []);
61
    }
62
}
63