RefundGateway   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 47
Duplicated Lines 17.02 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 2
dl 8
loc 47
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A find() 8 8 2
A pay() 0 4 1
A getTradeType() 0 4 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
namespace Yansongda\Pay\Gateways\Wechat;
4
5
use Yansongda\Pay\Exceptions\InvalidArgumentException;
6
7
class RefundGateway extends Gateway
8
{
9
    /**
10
     * Find.
11
     *
12
     * @author yansongda <[email protected]>
13
     *
14
     * @param $order
15
     *
16
     * @return array
17
     */
18 View Code Duplication
    public function find($order): array
0 ignored issues
show
Duplication introduced by shaoyu
This method seems to be duplicated in 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...
19
    {
20
        return [
21
            'endpoint' => 'pay/refundquery',
22
            'order' => is_array($order) ? $order : ['out_trade_no' => $order],
23
            'cert' => false,
24
        ];
25
    }
26
27
    /**
28
     * Pay an order.
29
     *
30
     * @author yansongda <[email protected]>
31
     *
32
     * @param string $endpoint
33
     * @param array  $payload
34
     *
35
     * @throws InvalidArgumentException
36
     */
37
    public function pay($endpoint, array $payload)
38
    {
39
        throw new InvalidArgumentException('Not Support Refund In Pay');
40
    }
41
42
    /**
43
     * Get trade type config.
44
     *
45
     * @author yansongda <[email protected]>
46
     *
47
     * @throws InvalidArgumentException
48
     */
49
    protected function getTradeType()
50
    {
51
        throw new InvalidArgumentException('Not Support Refund In Pay');
52
    }
53
}
54