Code Duplication    Length = 15-15 lines in 2 locations

src/Functions.php 2 locations

@@ 8-22 (lines=15) @@
5
use Yansongda\Pay\Contract\ConfigInterface;
6
use Yansongda\Pay\Pay;
7
8
if (!function_exists('get_alipay_config')) {
9
    /**
10
     * @throws \Yansongda\Pay\Exception\ContainerDependencyException
11
     * @throws \Yansongda\Pay\Exception\ContainerException
12
     * @throws \Yansongda\Pay\Exception\ServiceNotFoundException
13
     */
14
    function get_alipay_config(array $params): array
15
    {
16
        $alipay = Pay::get(ConfigInterface::class)->get('alipay');
17
18
        $config = $params['_config'] ?? 'default';
19
20
        return $alipay[$config] ?? [];
21
    }
22
}
23
24
if (!function_exists('get_wechat_config')) {
25
    /**
@@ 24-38 (lines=15) @@
21
    }
22
}
23
24
if (!function_exists('get_wechat_config')) {
25
    /**
26
     * @throws \Yansongda\Pay\Exception\ContainerDependencyException
27
     * @throws \Yansongda\Pay\Exception\ContainerException
28
     * @throws \Yansongda\Pay\Exception\ServiceNotFoundException
29
     */
30
    function get_alipay_config(array $params): array
31
    {
32
        $wechat = Pay::get(ConfigInterface::class)->get('wechat');
33
34
        $config = $params['_config'] ?? 'default';
35
36
        return $wechat[$config] ?? [];
37
    }
38
}
39
40