Completed
Push — master ( 8d88b0...6868b4 )
by Songda
01:30
created

AppGateway   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 52
Duplicated Lines 19.23 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getPayMethod() 0 4 1
A getPayProductCode() 0 4 1
A pay() 10 10 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\Alipay;
4
5
/**
6
 * AppGateway.
7
 */
8
class AppGateway extends Alipay
9
{
10
    /**
11
     * [getMethod description].
12
     *
13
     * @author yansongda <[email protected]>
14
     *
15
     * @version 2017-08-10
16
     *
17
     * @return  [type]     [description]
0 ignored issues
show
Documentation introduced by
The doc-type [type] could not be parsed: Unknown type name "" at position 0. [(view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
18
     */
19
    protected function getPayMethod()
20
    {
21
        return 'alipay.trade.app.pay';
22
    }
23
24
    /**
25
     * [getProductCode description].
26
     *
27
     * @author yansongda <[email protected]>
28
     *
29
     * @version 2017-08-10
30
     *
31
     * @return  [type]     [description]
0 ignored issues
show
Documentation introduced by
The doc-type [type] could not be parsed: Unknown type name "" at position 0. [(view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
32
     */
33
    protected function getPayProductCode()
34
    {
35
        return 'QUICK_MSECURITY_PAY';
36
    }
37
38
    /**
39
     * [pay description].
40
     * 
41
     * @author yansongda <[email protected]>
42
     * 
43
     * @version 2017-08-16
44
     * 
45
     * @param   array      $config_biz 业务参数
46
     * 
47
     * @return  [type]                 [description]
0 ignored issues
show
Documentation introduced by
The doc-type [type] could not be parsed: Unknown type name "" at position 0. [(view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
48
     */
49 View Code Duplication
    public function pay(array $config_biz = [])
1 ignored issue
show
Duplication introduced by
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...
50
    {
51
        $config_biz['product_code'] = $this->getPayProductCode();
52
53
        $this->config['method'] = $this->getPayMethod();
54
        $this->config['biz_content'] = json_encode($config_biz, JSON_UNESCAPED_UNICODE);
55
        $this->config['sign'] = $this->getSign();
56
57
        return http_build_query($this->config);
58
    }
59
}
60