Passed
Push — master ( 248ab7...5ed1ac )
by Vuong
14:10
created

Gateway::requestInternal()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * @link https://github.com/vuongxuongminh/yii2-gatewayclients
4
 * @copyright Copyright (c) 2018 Vuong Xuong Minh
5
 * @license [New BSD License](http://www.opensource.org/licenses/bsd-license.php)
6
 */
7
8
9
namespace vxm\examples\gatewayclients;
10
11
use yii\httpclient\Client as HttpClient;
12
13
use vxm\gatewayclients\BaseGateway;
14
15
/**
16
 * Class Gateway
17
 *
18
 * @property Client $client
19
 *
20
 * @author Vuong Minh <[email protected]>
21
 * @since 1.0
22
 */
23
class Gateway extends BaseGateway
24
{
25
26
    public $responseDataConfig = ['class' => ResponseData::class];
27
28
    public $requestDataConfig = ['class' => RequestData::class];
29
30
    public $clientConfig = ['class' => Client::class];
31
32
33
    public function getVersion(): string
34
    {
35
        return '1.0';
36
    }
37
38
    public function getBaseUrl(): string
39
    {
40
        return 'http://test.app';
41
    }
42
43
    public function requestCommands(): array
44
    {
45
        return ['charge', 'refund'];
46
    }
47
48
    protected function requestInternal(\vxm\gatewayclients\RequestData $requestData, HttpClient $httpClient): array
49
    {
50
        return $httpClient->post('', $requestData->get())->getData();
51
    }
52
53
}