BaseClient   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 28
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getGateway() 0 3 1
A __construct() 0 5 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
namespace vxm\gatewayclients;
9
10
use yii\base\Component;
11
12
use GatewayClients\ClientInterface;
13
use GatewayClients\GatewayInterface;
14
15
/**
16
 * Class BaseClient a base class that implements the [[ClientInterface]].
17
 * It is an abstraction layer, implements classes will be add more properties to support create request to gateway server api.
18
 *
19
 * @property BaseGateway $gateway
20
 *
21
 * @author Vuong Minh <[email protected]>
22
 * @since 1.0
23
 */
24
abstract class BaseClient extends Component implements ClientInterface
25
{
26
27
    /**
28
     * Constructor.
29
     *
30
     * @param BaseGateway $gateway the gateway object of this client.
31
     * @param array $config configurations to be applied to the newly created client object.
32
     */
33 11
    public function __construct(BaseGateway $gateway, array $config = [])
34
    {
35 11
        $this->_gateway = $gateway;
36
37 11
        parent::__construct($config);
38 11
    }
39
40
    /**
41
     * @var BaseGateway|GatewayInterface the gateway object of this client.
42
     */
43
    private $_gateway;
44
45
    /**
46
     * @inheritdoc
47
     * @return BaseGateway|GatewayInterface
48
     */
49 1
    public function getGateway(): GatewayInterface
50
    {
51 1
        return $this->_gateway;
52
    }
53
54
55
}
56