Completed
Pull Request — master (#15)
by
unknown
02:55
created

BankWidget   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 75%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 4
dl 0
loc 20
ccs 3
cts 4
cp 0.75
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 10 2
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
namespace nhuluc\payment;
9
10
use yii\helpers\Html;
11
use yii\widgets\InputWidget;
12
13
/**
14
 * Lớp BaseWidget hổ trợ render input danh sách ngân hàng cho user chọn (dropdown list).
15
 *
16
 * @author Nhu Luc <[email protected]>
17
 * @since 1.0.3
18
 */
19
class BankWidget extends InputWidget
20
{
21
22
    use GatewayBankProviderTrait;
23
24
    /**
25
     * @inheritdoc
26
     */
27 3
    public function run()
28
    {
29 3
        if ($this->hasModel()) {
30
31
            return Html::activeDropDownList($this->model, $this->attribute, $this->provider->banks(), $this->options);
32
        } else {
33
34 3
            return Html::dropDownList($this->name, $this->value, $this->provider->banks(), $this->options);
35
        }
36
    }
37
38
}
39