Completed
Push — master ( 158640...6228b6 )
by Carlos
02:38 queued 01:15
created

Client   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 50 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 18
loc 36
ccs 0
cts 15
cp 0
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A info() 9 9 1
A send() 9 9 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
/*
4
 * This file is part of the overtrue/wechat.
5
 *
6
 * (c) overtrue <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace EasyWeChat\Payment\Transfer;
13
14
use EasyWeChat\Payment\Kernel\BaseClient;
15
16
/**
17
 * Class Client.
18
 *
19
 * @author AC <[email protected]>
20
 */
21
class Client extends BaseClient
22
{
23
    /**
24
     * Query MerchantPay.
25
     *
26
     * @param array $params
27
     *
28
     * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string
29
     */
30 View Code Duplication
    public function info(array $params)
31
    {
32
        $base = [
33
            'appid' => $this->app['config']->app_id,
34
            'mch_id' => $this->app['config']->mch_id,
35
        ];
36
37
        return $this->safeRequest('mmpaymkttransfers/gettransferinfo', array_merge($base, $params));
38
    }
39
40
    /**
41
     * Send MerchantPay.
42
     *
43
     * @param array $params
44
     *
45
     * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string
46
     */
47 View Code Duplication
    public function send(array $params)
48
    {
49
        $base = [
50
            'mchid' => $this->app['config']->mch_id,
51
            'mch_appid' => $this->app['config']->app_id,
52
        ];
53
54
        return $this->safeRequest('mmpaymkttransfers/promotion/transfers', array_merge($base, $params));
55
    }
56
}
57