Gateway   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 28
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getBaseUrl() 0 3 1
A requestInternal() 0 3 1
A requestCommands() 0 3 1
A getVersion() 0 3 1
1
<?php
2
/**
3
 * @link https://github.com/vuongxuongminh/yii2-gateway-clients
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
}