These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | use Yansongda\Pay\Contract\ConfigInterface; |
||
6 | use Yansongda\Pay\Pay; |
||
7 | |||
8 | View Code Duplication | if (!function_exists('get_alipay_config')) { |
|
0 ignored issues
–
show
|
|||
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 | View Code Duplication | if (!function_exists('get_wechat_config')) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
|
|||
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 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.