Completed
Push — master ( 2239ff...052c46 )
by zacksleo
17:01 queued 11:28
created

AdminLteAsset   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 35
rs 10
c 0
b 0
f 0
wmc 4
lcom 1
cbo 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A init() 0 11 4
1
<?php
2
namespace zacksleo\yii2\backend\assets;
3
4
use yii\base\Exception;
5
use yii\web\AssetBundle;
6
7
/**
8
 * AdminLte AssetBundle
9
 * @since 0.1
10
 */
11
class AdminLteAsset extends AssetBundle
12
{
13
    public $sourcePath = '@vendor/zacksleo/adminlte-assets';
14
    public $css = [
15
        'css/AdminLTE.min.css',
16
    ];
17
    public $js = [
18
        'js/adminlte.min.js'
19
    ];
20
    public $depends = [
21
        'yii\web\YiiAsset',
22
        'yii\bootstrap\BootstrapAsset',
23
        'yii\bootstrap\BootstrapPluginAsset',
24
        'zacksleo\yii2\backend\assets\FontAwesomeAsset'
25
    ];
26
    /**
27
     * @var string|bool Choose skin color, eg. `'skin-blue'` or set `false` to disable skin loading
28
     * @see https://almsaeedstudio.com/themes/AdminLTE/documentation/index.html#layout
29
     */
30
    public $skin = '_all-skins';
31
    /**
32
     * @inheritdoc
33
     */
34
    public function init()
35
    {
36
        // Append skin color file if specified
37
        if ($this->skin) {
38
            if (('_all-skins' !== $this->skin) && (strpos($this->skin, 'skin-') !== 0)) {
39
                throw new Exception('Invalid skin specified');
40
            }
41
            $this->css[] = sprintf('css/skins/%s.min.css', $this->skin);
42
        }
43
        parent::init();
44
    }
45
}
46