Completed
Pull Request — master (#9)
by zacksleo
10:22
created

AdminLteAsset::init()   A

Complexity

Conditions 4
Paths 3

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

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