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 |
||
0 ignored issues
–
show
The function
get_alipay_config() has been defined more than once; this definition is ignored, only the first definition in this file (L14-21) is considered.
This check looks for functions that have already been defined in the same file. Some Codebases, like WordPress, make a practice of defining functions multiple times. This
may lead to problems with the detection of function parameters and types. If you really
need to do this, you can mark the duplicate definition with the /**
* @ignore
*/
function getUser() {
}
function getUser($id, $realm) {
}
See also the PhpDoc documentation for @ignore.
Loading history...
|
|||
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.