SelectizeDropDownList::run()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 7
cts 7
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 6
nc 2
nop 0
crap 2
1
<?php
2
/**
3
 * @link https://github.com/2amigos/yii2-selectize-widget
4
 * @copyright Copyright (c) 2013-2017 2amigOS! Consulting Group LLC
5
 * @license http://opensource.org/licenses/BSD-3-Clause
6
 */
7
8
namespace dosamigos\selectize;
9
10
use yii\helpers\Html;
11
12
/**
13
 * SelectizeDropDownList
14
 *
15
 * @author 2amigos.us <[email protected]>
16
 */
17
class SelectizeDropDownList extends InputWidget
18
{
19
    /**
20
     * @var array
21
     */
22
    public $items = [];
23
24
    /**
25
     * @inheritdoc
26
     */
27 3
    public function run()
28
    {
29 3
        if ($this->hasModel()) {
30 3
            echo Html::activeDropDownList($this->model, $this->attribute, $this->items, $this->options);
31 1
        } else {
32 3
            echo Html::dropDownList($this->name, $this->value, $this->items, $this->options);
33
        }
34
35 3
        parent::run();
36 3
    }
37
}
38