Skip to content

Commit 4940158

Browse files
committed
style ci
1 parent 8ffcf62 commit 4940158

28 files changed

+157
-116
lines changed

.github/workflows/tests.yml

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,54 @@ jobs:
99
strategy:
1010
fail-fast: true
1111
matrix:
12-
php: [ '7.1','7.2', '7.3', '7.4', '8.0', '8.1' ]
13-
stability: [ prefer-stable ]
12+
php: [ '7.1','7.2', '7.3', '7.4', '8.0', '8.1', '8.2' ]
1413

15-
name: PHP ${{ matrix.php }} - ${{ matrix.stability }}
14+
name: PHP ${{ matrix.php }}
15+
16+
env:
17+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, fileinfo
18+
key: cache-v1 # can be any string, change to clear the extension cache.
1619

1720
steps:
1821
- name: Checkout code
19-
uses: actions/checkout@v2
22+
uses: actions/checkout@v3
23+
24+
- name: Setup cache environment
25+
id: extcache
26+
uses: shivammathur/cache-extensions@v1
27+
with:
28+
php-version: ${{ matrix.php }}
29+
extensions: ${{ env.extensions }}
30+
key: ${{ env.key }}
31+
32+
- name: Cache extensions
33+
uses: actions/cache@v3
34+
with:
35+
path: ${{ steps.extcache.outputs.dir }}
36+
key: ${{ steps.extcache.outputs.key }}
37+
restore-keys: ${{ steps.extcache.outputs.key }}
2038

2139
- name: Setup PHP
2240
uses: shivammathur/setup-php@v2
2341
with:
2442
php-version: ${{ matrix.php }}
25-
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, gd, redis, memcached
43+
extensions: ${{ env.extensions }}
2644
tools: composer:v2
27-
coverage: none
45+
coverage: xdebug
2846

29-
- name: Install dependencies
30-
uses: nick-invision/retry@v1
47+
- name: Get Composer Cache Directory
48+
id: composer-cache
49+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
50+
51+
- name: Cache Composer dependencies
52+
uses: actions/cache@v3
3153
with:
32-
timeout_minutes: 5
33-
max_attempts: 5
34-
command: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress ${{ matrix.flags }}
54+
path: ${{ steps.composer-cache.outputs.dir }}
55+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
56+
restore-keys: ${{ runner.os }}-composer-
57+
58+
- name: Install Composer dependencies
59+
run: composer install --prefer-dist --no-interaction --no-progress
3560

3661
- name: Execute tests
37-
continue-on-error: ${{ matrix.php <= 7.0 }}
38-
run: vendor/bin/phpunit --verbose
62+
run: vendor/bin/phpunit --testdox --verbose

src/Gateway.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
/**
1717
* Skeleton Gateway.
18+
*
1819
* @method RequestInterface authorize(array $options = [])
1920
* @method RequestInterface completeAuthorize(array $options = [])
2021
* @method RequestInterface capture(array $options = [])
@@ -43,7 +44,7 @@ public function getDefaultParameters()
4344
}
4445

4546
/**
46-
* @param array $options
47+
* @param array $options
4748
* @return RequestInterface
4849
*/
4950
public function purchase(array $options = [])
@@ -52,7 +53,7 @@ public function purchase(array $options = [])
5253
}
5354

5455
/**
55-
* @param array $options
56+
* @param array $options
5657
* @return RequestInterface
5758
*/
5859
public function completePurchase(array $options = [])
@@ -61,7 +62,7 @@ public function completePurchase(array $options = [])
6162
}
6263

6364
/**
64-
* @param array $options
65+
* @param array $options
6566
* @return RequestInterface|NotificationInterface
6667
*/
6768
public function acceptNotification(array $options = [])
@@ -70,7 +71,7 @@ public function acceptNotification(array $options = [])
7071
}
7172

7273
/**
73-
* @param array $options
74+
* @param array $options
7475
* @return RequestInterface
7576
*/
7677
public function fetchTransaction(array $options = [])
@@ -79,7 +80,7 @@ public function fetchTransaction(array $options = [])
7980
}
8081

8182
/**
82-
* @param array $options
83+
* @param array $options
8384
* @return RequestInterface
8485
*/
8586
public function refund(array $options = [])

src/Message/AcceptNotificationRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
class AcceptNotificationRequest extends CompletePurchaseRequest implements NotificationInterface
88
{
99
/**
10-
* @param array $data
10+
* @param array $data
1111
* @return AcceptNotificationResponse
1212
*/
1313
public function sendData($data)

src/Message/CompletePurchaseRequest.php

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function getPaymentDate()
3030
}
3131

3232
/**
33-
* @param string $value
33+
* @param string $value
3434
* @return $this
3535
*/
3636
public function setPaymentDate($value)
@@ -47,7 +47,7 @@ public function getPaymentType()
4747
}
4848

4949
/**
50-
* @param string $value
50+
* @param string $value
5151
* @return $this
5252
*/
5353
public function setPaymentType($value)
@@ -64,7 +64,7 @@ public function getPaymentTypeChargeFee()
6464
}
6565

6666
/**
67-
* @param string $value
67+
* @param string $value
6868
* @return $this
6969
*/
7070
public function setPaymentTypeChargeFee($value)
@@ -81,7 +81,7 @@ public function getRtnCode()
8181
}
8282

8383
/**
84-
* @param string $value
84+
* @param string $value
8585
* @return $this
8686
*/
8787
public function setRtnCode($value)
@@ -98,7 +98,7 @@ public function getRtnMsg()
9898
}
9999

100100
/**
101-
* @param string $value
101+
* @param string $value
102102
* @return $this
103103
*/
104104
public function setRtnMsg($value)
@@ -115,7 +115,7 @@ public function getSimulatePaid()
115115
}
116116

117117
/**
118-
* @param string $value
118+
* @param string $value
119119
* @return $this
120120
*/
121121
public function setSimulatePaid($value)
@@ -132,7 +132,7 @@ public function getTradeAmt()
132132
}
133133

134134
/**
135-
* @param string $value
135+
* @param string $value
136136
* @return $this
137137
*/
138138
public function setTradeAmt($value)
@@ -149,7 +149,7 @@ public function getTradeDate()
149149
}
150150

151151
/**
152-
* @param string $value
152+
* @param string $value
153153
* @return $this
154154
*/
155155
public function setTradeDate($value)
@@ -166,7 +166,7 @@ public function getTradeNo()
166166
}
167167

168168
/**
169-
* @param string $value
169+
* @param string $value
170170
* @return $this
171171
*/
172172
public function setTradeNo($value)
@@ -183,7 +183,7 @@ public function getCheckMacValue()
183183
}
184184

185185
/**
186-
* @param string $value
186+
* @param string $value
187187
* @return $this
188188
*/
189189
public function setCheckMacValue($value)
@@ -193,6 +193,7 @@ public function setCheckMacValue($value)
193193

194194
/**
195195
* @return array
196+
*
196197
* @throws InvalidRequestException
197198
* @throws InvalidResponseException
198199
*/
@@ -222,8 +223,9 @@ public function getData()
222223
}
223224

224225
/**
225-
* @param array $data
226+
* @param array $data
226227
* @return CompletePurchaseResponse
228+
*
227229
* @throws InvalidResponseException
228230
*/
229231
public function sendData($data)
@@ -238,8 +240,9 @@ public function sendData($data)
238240
}
239241

240242
/**
241-
* @param array $data
243+
* @param array $data
242244
* @return array
245+
*
243246
* @throws InvalidResponseException
244247
*/
245248
private function checkMacValue($data)

src/Message/FetchTransactionRequest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class FetchTransactionRequest extends AbstractRequest
1616
use HasMerchantTradeNo;
1717

1818
protected $liveEndpoint = 'https://payment.ecpay.com.tw/Cashier/QueryTradeInfo/V5';
19+
1920
protected $testEndpoint = 'https://payment-stage.ecpay.com.tw/Cashier/QueryTradeInfo/V5';
2021

2122
/**
@@ -27,7 +28,7 @@ public function getTimestamp()
2728
}
2829

2930
/**
30-
* @param int $value
31+
* @param int $value
3132
* @return FetchTransactionRequest
3233
*/
3334
public function setTimestamp($value)
@@ -37,6 +38,7 @@ public function setTimestamp($value)
3738

3839
/**
3940
* @return array
41+
*
4042
* @throws InvalidRequestException
4143
*/
4244
public function getData()
@@ -58,6 +60,7 @@ public function sendData($data)
5860
/**
5961
* @param $data
6062
* @return array
63+
*
6164
* @throws RtnException
6265
*/
6366
protected function getTradeInfo($data)

src/Message/PurchaseRequest.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class PurchaseRequest extends AbstractRequest
3434
use HasATMOrCVSOrBARCODEFields;
3535

3636
protected $liveEndpoint = 'https://payment.ecpay.com.tw/Cashier/AioCheckOut/V5';
37+
3738
protected $testEndpoint = 'https://payment-stage.ecpay.com.tw/Cashier/AioCheckOut/V5';
3839

3940
/**
@@ -46,6 +47,7 @@ public function getEndpoint()
4647

4748
/**
4849
* @return array
50+
*
4951
* @throws InvalidRequestException
5052
*/
5153
public function getData()
@@ -104,7 +106,7 @@ public function getData()
104106
}
105107

106108
/**
107-
* @param array $data
109+
* @param array $data
108110
* @return PurchaseResponse
109111
*/
110112
public function sendData($data)
@@ -114,6 +116,7 @@ public function sendData($data)
114116

115117
/**
116118
* @return array
119+
*
117120
* @throws InvalidRequestException
118121
*/
119122
private function prepareItems()
@@ -141,7 +144,7 @@ private function prepareItems()
141144
}
142145

143146
/**
144-
* @param array $sendFields
147+
* @param array $sendFields
145148
* @return array
146149
*/
147150
private function getSendExtend($sendFields)
@@ -155,7 +158,7 @@ private function getSendExtend($sendFields)
155158
}
156159

157160
/**
158-
* @param string $choosePayment
161+
* @param string $choosePayment
159162
* @return array
160163
*/
161164
private function getCreditFields($choosePayment)
@@ -177,7 +180,7 @@ private function getCreditFields($choosePayment)
177180
}
178181

179182
/**
180-
* @param string $choosePayment
183+
* @param string $choosePayment
181184
* @return array
182185
*/
183186
private function getATMFields($choosePayment)
@@ -190,7 +193,7 @@ private function getATMFields($choosePayment)
190193
}
191194

192195
/**
193-
* @param string $choosePayment
196+
* @param string $choosePayment
194197
* @return array
195198
*/
196199
private function getCvsFields($choosePayment)
@@ -207,7 +210,7 @@ private function getCvsFields($choosePayment)
207210
}
208211

209212
/**
210-
* @param string $invoiceMark
213+
* @param string $invoiceMark
211214
* @return array
212215
*/
213216
private function getInvoiceFields($invoiceMark)

src/Message/PurchaseResponse.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public function getRedirectMethod()
5656
* Gets the redirect form data array, if the redirect method is POST.
5757
*
5858
* @return array
59+
*
5960
* @throws InvalidRequestException
6061
*/
6162
public function getRedirectData()
@@ -71,7 +72,7 @@ public function getRedirectData()
7172
}
7273

7374
/**
74-
* @param string $html
75+
* @param string $html
7576
* @return array
7677
*/
7778
private static function htmlToArray($html)

src/Message/RefundRequest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ public function sendData($data)
4444
}
4545

4646
/**
47-
* @param array $data
47+
* @param array $data
4848
* @return array
49+
*
4950
* @throws RtnException
5051
*/
5152
protected function doAction($data)

src/Traits/HasATMFields.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ trait HasATMFields
1111
* 注意事項:
1212
* 以天為單位
1313
*
14-
* @param int $value
14+
* @param int $value
1515
* @return $this
1616
*/
1717
public function setExpireDate($value)

0 commit comments

Comments
 (0)