Passed
Push — master ( 30294b...1839bf )
by Alexey
02:13
created

DatePickerAsset   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
dl 0
loc 45
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A init() 0 11 3
1
<?php
2
3
namespace app\assets;
4
5
use yii\web\AssetBundle;
6
7
/**
8
 * Class DatePickerAsset
9
 * @package app\assets
10
 */
11
class DatePickerAsset extends AssetBundle
12
{
13
    /**
14
     * @var string
15
     */
16
    public static $language;
17
18
    /**
19
     * @var string
20
     */
21
    public $sourcePath = '@bower/bootstrap-datepicker/dist';
22
23
    /**
24
     * @var array
25
     */
26
    public $css = [];
27
28
    /**
29
     * @var array
30
     */
31
    public $js = [];
32
33
    /**
34
     * @inheritdoc
35
     */
36
    public function init()
37
    {
38
        parent::init();
39
        $min = YII_ENV_DEV ? '' : '.min';
40
        $language = self::$language ? self::$language : substr(\Yii::$app->language, 0, 2);
41
        $this->css = [
42
            'css/bootstrap-datepicker3' . $min . '.css',
43
        ];
44
        $this->js = [
45
            'js/bootstrap-datepicker' . $min . '.js',
46
            'locales/bootstrap-datepicker.' . $language . '.min.js',
47
        ];
48
    }
49
50
    /**
51
     * @var array
52
     */
53
    public $depends = [
54
        'yii\web\JqueryAsset',
55
        'yii\bootstrap\BootstrapAsset',
56
    ];
57
}
58