Code Duplication    Length = 81-81 lines in 3 locations

src/Payment/CashCoupon/CashCoupon.php 1 location

@@ 10-90 (lines=81) @@
7
/**
8
 * Class LuckyMoney.
9
 */
10
class CashCoupon
11
{
12
    /**
13
     * @var API
14
     */
15
    protected $api;
16
17
    /**
18
     * Merchant instance.
19
     *
20
     * @var \EntWeChat\Payment\Merchant
21
     */
22
    protected $merchant;
23
24
    /**
25
     * Constructor.
26
     *
27
     * @param Merchant $merchant
28
     */
29
    public function __construct(Merchant $merchant)
30
    {
31
        $this->merchant = $merchant;
32
    }
33
34
    /**
35
     * Merchant setter.
36
     *
37
     * @param Merchant $merchant
38
     */
39
    public function setMerchant(Merchant $merchant)
40
    {
41
        $this->merchant = $merchant;
42
    }
43
44
    /**
45
     * Merchant getter.
46
     *
47
     * @return Merchant
48
     */
49
    public function getMerchant()
50
    {
51
        return $this->merchant;
52
    }
53
54
    /**
55
     * API setter.
56
     *
57
     * @param API $api
58
     */
59
    public function setAPI(API $api)
60
    {
61
        $this->api = $api;
62
    }
63
64
    /**
65
     * Return API instance.
66
     *
67
     * @return API
68
     */
69
    public function getAPI()
70
    {
71
        return $this->api ?: $this->api = new API($this->getMerchant());
72
    }
73
74
    /**
75
     * Magic call.
76
     *
77
     * @param string $method
78
     * @param array  $args
79
     *
80
     * @return mixed
81
     *
82
     * @codeCoverageIgnore
83
     */
84
    public function __call($method, $args)
85
    {
86
        if (is_callable([$this->getAPI(), $method])) {
87
            return call_user_func_array([$this->api, $method], $args);
88
        }
89
    }
90
}
91

src/Payment/LuckyMoney/LuckyMoney.php 1 location

@@ 10-90 (lines=81) @@
7
/**
8
 * Class LuckyMoney.
9
 */
10
class LuckyMoney
11
{
12
    /**
13
     * @var API
14
     */
15
    protected $api;
16
17
    /**
18
     * Merchant instance.
19
     *
20
     * @var \EntWeChat\Payment\Merchant
21
     */
22
    protected $merchant;
23
24
    /**
25
     * Constructor.
26
     *
27
     * @param Merchant $merchant
28
     */
29
    public function __construct(Merchant $merchant)
30
    {
31
        $this->merchant = $merchant;
32
    }
33
34
    /**
35
     * Merchant setter.
36
     *
37
     * @param Merchant $merchant
38
     */
39
    public function setMerchant(Merchant $merchant)
40
    {
41
        $this->merchant = $merchant;
42
    }
43
44
    /**
45
     * Merchant getter.
46
     *
47
     * @return Merchant
48
     */
49
    public function getMerchant()
50
    {
51
        return $this->merchant;
52
    }
53
54
    /**
55
     * API setter.
56
     *
57
     * @param API $api
58
     */
59
    public function setAPI(API $api)
60
    {
61
        $this->api = $api;
62
    }
63
64
    /**
65
     * Return API instance.
66
     *
67
     * @return API
68
     */
69
    public function getAPI()
70
    {
71
        return $this->api ?: $this->api = new API($this->getMerchant());
72
    }
73
74
    /**
75
     * Magic call.
76
     *
77
     * @param string $method
78
     * @param array  $args
79
     *
80
     * @return mixed
81
     *
82
     * @codeCoverageIgnore
83
     */
84
    public function __call($method, $args)
85
    {
86
        if (is_callable([$this->getAPI(), $method])) {
87
            return call_user_func_array([$this->api, $method], $args);
88
        }
89
    }
90
}
91

src/Payment/MerchantPay/MerchantPay.php 1 location

@@ 10-90 (lines=81) @@
7
/**
8
 * Class MerchantPay.
9
 */
10
class MerchantPay
11
{
12
    /**
13
     * @var API
14
     */
15
    protected $api;
16
17
    /**
18
     * Merchant instance.
19
     *
20
     * @var \EntWeChat\Payment\Merchant
21
     */
22
    protected $merchant;
23
24
    /**
25
     * Constructor.
26
     *
27
     * @param Merchant $merchant
28
     */
29
    public function __construct(Merchant $merchant)
30
    {
31
        $this->merchant = $merchant;
32
    }
33
34
    /**
35
     * Merchant setter.
36
     *
37
     * @param Merchant $merchant
38
     */
39
    public function setMerchant(Merchant $merchant)
40
    {
41
        $this->merchant = $merchant;
42
    }
43
44
    /**
45
     * Merchant getter.
46
     *
47
     * @return Merchant
48
     */
49
    public function getMerchant()
50
    {
51
        return $this->merchant;
52
    }
53
54
    /**
55
     * API setter.
56
     *
57
     * @param API $api
58
     */
59
    public function setAPI(API $api)
60
    {
61
        $this->api = $api;
62
    }
63
64
    /**
65
     * Return API instance.
66
     *
67
     * @return API
68
     */
69
    public function getAPI()
70
    {
71
        return $this->api ?: $this->api = new API($this->getMerchant());
72
    }
73
74
    /**
75
     * Magic call.
76
     *
77
     * @param string $method
78
     * @param array  $args
79
     *
80
     * @return mixed
81
     *
82
     * @codeCoverageIgnore
83
     */
84
    public function __call($method, $args)
85
    {
86
        if (is_callable([$this->getAPI(), $method])) {
87
            return call_user_func_array([$this->api, $method], $args);
88
        }
89
    }
90
}
91