Completed
Pull Request — master (#9)
by zacksleo
10:22
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
 * 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
}