Completed
Push — master ( 56c44b...57c31b )
by Songda
05:33 queued 11s
created

WapPayPlugin   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 17
loc 17
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yansongda\Pay\Plugin\Alipay\Trade;
6
7
use Closure;
8
use Yansongda\Pay\Contract\PluginInterface;
9
use Yansongda\Pay\Packer\ResponsePacker;
10
use Yansongda\Pay\Rocket;
11
12
class WapPayPlugin implements PluginInterface
13
{
14
    public function assembly(Rocket $rocket, Closure $next): Rocket
15
    {
16
        $rocket->setDirection(ResponsePacker::class)
17
            ->mergePayload([
18
            'method' => 'alipay.trade.wap.pay',
19
            'biz_content' => array_merge(
20
                [
21
                    'product_code' => 'QUICK_WAP_PAY',
22
                ],
23
                $rocket->getParams(),
24
            ),
0 ignored issues
show
Bug introduced by
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected ')'
Loading history...
25
        ]);
26
27
        return $next($rocket);
28
    }
29
}
30