AbstractRequest   A
last analyzed

Complexity

Total Complexity 19

Size/Duplication

Total Lines 135
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 135
ccs 0
cts 70
cp 0
rs 10
wmc 19

18 Methods

Rating   Name   Duplication   Size   Complexity  
A getPaymentType() 0 3 1
A setServerId() 0 3 1
A getAppKey() 0 3 1
A getTradeType() 0 3 1
A setAppKey() 0 3 1
A getItemCode() 0 3 1
A setAccountId() 0 3 1
A getAppId() 0 3 1
A sendData() 0 2 1
A setAmount() 0 3 1
A setPaymentType() 0 3 1
A getServerId() 0 3 1
A setTradeType() 0 3 1
A getAccountId() 0 3 1
A getData() 0 2 1
A setItemCode() 0 3 1
A getEndpoint() 0 4 2
A setAppId() 0 3 1
1
<?php
2
3
4
namespace Omnipay\MyCard\Message;
5
6
7
class AbstractRequest extends \Omnipay\Common\Message\AbstractRequest
8
{
9
10
    // 用戶在廠商端的伺服器編號,不可輸入中文
11
    protected $serverId = '';
12
13
14
    // 用戶在廠商端的會員唯一識別編號
15
    protected $accountId = '';
16
17
18
    // 付費方式: 此參數非必填,參數為空時將依 交易金額(Amount)和幣別 (Currency)判斷可用的付費方式 呈現給用戶選擇
19
    protected $paymentType = '';
20
21
22
    // 品項代碼: 此參數非必填,參數為空時將依 交易金額(Amount)和幣別 (Currency)判斷可用的付費方式 呈現給用戶選擇
23
    protected $itemCode = '';
24
25
26
    protected $endpoint = [
27
        'live' => [
28
            'b2b'      => 'https://b2b.mycard520.com.tw',
29
            'redirect' => 'https://www.mycard520.com.tw',
30
        ],
31
        'test' => [
32
            'b2b'      => 'https://test.b2b.mycard520.com.tw',
33
            'redirect' => 'https://test.mycard520.com.tw',
34
        ]
35
    ];
36
37
38
    public function getEndpoint($type = '')
39
    {
40
        $mode = $this->getTestMode() ? 'test' : 'live';
41
        return $this->endpoint[$mode][$type];
42
    }
43
44
45
    public function getAppId()
46
    {
47
        return $this->getParameter('appId');
48
    }
49
50
51
    public function setAppId($value)
52
    {
53
        return $this->setParameter('appId', $value);
54
    }
55
56
57
    public function getAppKey()
58
    {
59
        return $this->getParameter('appKey');
60
    }
61
62
63
    public function setAppKey($value)
64
    {
65
        return $this->setParameter('appKey', $value);
66
    }
67
68
69
    public function setAmount($value)
70
    {
71
        return $this->setParameter('amount', sprintf('%.2f', $value), $value);
0 ignored issues
show
Unused Code introduced by
The call to Omnipay\Common\Message\A...Request::setParameter() has too many arguments starting with $value. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

71
        return $this->/** @scrutinizer ignore-call */ setParameter('amount', sprintf('%.2f', $value), $value);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
72
    }
73
74
75
    public function getTradeType()
76
    {
77
        return $this->getParameter('tradeType');
78
    }
79
80
81
    public function setTradeType($value)
82
    {
83
        return $this->setParameter('tradeType', $value);
84
    }
85
86
87
    public function getServerId()
88
    {
89
        return $this->getParameter('serverId');
90
    }
91
92
93
    public function setServerId($value)
94
    {
95
        return $this->setParameter('serverId', $value);
96
    }
97
98
99
    public function getAccountId()
100
    {
101
        return $this->getParameter('accountId');
102
    }
103
104
105
    public function setAccountId($value)
106
    {
107
        return $this->setParameter('accountId', $value);
108
    }
109
110
111
    public function getPaymentType()
112
    {
113
        return $this->getParameter('paymentType');
114
    }
115
116
117
    public function setPaymentType($value)
118
    {
119
        return $this->setParameter('paymentType', $value);
120
    }
121
122
123
    public function getItemCode()
124
    {
125
        return $this->getParameter('itemCode');
126
    }
127
128
129
    public function setItemCode($value)
130
    {
131
        return $this->setParameter('itemCode', $value);
132
    }
133
134
135
    public function getData()
136
    {
137
    }
138
139
140
    public function sendData($data)
141
    {
142
    }
143
144
}