Completed
Push — master ( 5ac6b4...cc61cd )
by Vuong
02:04
created

BankProvider::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 1
1
<?php
2
/**
3
 * @link https://github.com/yiiviet/yii2-payment
4
 * @copyright Copyright (c) 2017 Yii Viet
5
 * @license [New BSD License](http://www.opensource.org/licenses/bsd-license.php)
6
 */
7
8
9
namespace yiiviet\payment;
10
11
use yii\base\BaseObject;
12
use yii\base\NotSupportedException;
13
14
/**
15
 * Mẫu trừu tượng BankProviderInterface cung cấp các phương thức lấy thông tin ngân hàng như tên, logo, id.
16
 *
17
 * @author Vuong Minh <[email protected]>
18
 * @since 1.0.3
19
 */
20
abstract class BankProvider extends BaseObject
21
{
22
23
    /**
24
     * @var PaymentGatewayInterface xem phương thức [[__construct()]].
25
     * @see [[__construct()]]
26
     */
27
    protected $gateway;
28
29
    /**
30
     * BankProvider constructor.
31
     *
32
     * @param PaymentGatewayInterface $gateway đối tượng kết nối đến cổng thanh toán để cung cấp các thông tin cần thiết khi lấy danh sách ngân hàng.
33
     * @param array $config mảng thiết lập.
34
     */
35 3
    public function __construct(PaymentGatewayInterface $gateway, array $config = [])
36
    {
37 3
        $this->gateway = $gateway;
38 3
        parent::__construct($config);
39 3
    }
40
41
    /**
42
     * Phương thức hổ trợ lấy danh sách ngân hàng.
43
     *
44
     * @return array có khóa là mã ngân hàng và giá trị là tên ngân hàng.
45
     */
46
    abstract public function banks(): array;
47
48
49
    /**
50
     * Phương thức hổ trợ lấy logo ngân hàng thông qua id.
51
     *
52
     * @param mixed $bankId của ngân hàng.
53
     * @return string url logo absolute
54
     * @throws NotSupportedException
55
     */
56
    public function getBankLogo($bankId): string
57
    {
58
        throw new NotSupportedException('This method doesn\'t supported by default!');
59
    }
60
61
}
62