Asset   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 49
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A addPlugins() 0 9 3
A addLanguage() 0 4 1
1
<?php
2
/**
3
 * This file is part of yii2-imperavi-widget.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 *
8
 * @see https://github.com/vova07/yii2-imperavi-widget
9
 */
10
11
namespace vova07\imperavi;
12
13
use yii\web\AssetBundle;
14
15
/**
16
 * Widget asset bundle.
17
 *
18
 * @author Vasile Crudu <[email protected]>
19
 *
20
 * @link https://github.com/vova07/yii2-imperavi-widget
21
 */
22
class Asset extends AssetBundle
23
{
24
    /**
25
     * @inheritdoc
26
     */
27
    public $sourcePath = '@vova07/imperavi/assets';
28
29
    /**
30
     * @inheritdoc
31
     */
32
    public $css = [
33
        'redactor.css',
34
    ];
35
36
    /**
37
     * @inheritdoc
38
     */
39
    public $js = [
40
        'redactor.min.js',
41
    ];
42
43
    /**
44
     * @inheritdoc
45
     */
46
    public $depends = [
47
        'yii\web\JqueryAsset',
48
    ];
49
50
    /**
51
     * @param array $plugins The plugins array to register.
52
     */
53 6
    public function addPlugins($plugins)
54
    {
55 6
        foreach ($plugins as $plugin) {
56 6
            if ($plugin === 'clips') {
57 6
                $this->css[] = 'plugins/' . $plugin . '/' . $plugin . '.css';
58 2
            }
59 6
            $this->js[] = 'plugins/' . $plugin . '/' . $plugin . '.js';
60 2
        }
61 6
    }
62
63
    /**
64
     * @param string $language The language to register.
65
     */
66 9
    public function addLanguage($language)
67
    {
68 9
        $this->js[] = 'lang/' . $language . '.js';
69 9
    }
70
}
71