BaseClient::getGateway()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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