Completed
Pull Request — master (#81)
by
unknown
14:25
created

Asset   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 5
c 2
b 0
f 0
lcom 1
cbo 1
dl 0
loc 57
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B registerAssetFiles() 0 15 5
1
<?php
2
3
namespace the0rist\imperavi;
4
5
use yii\web\AssetBundle;
6
7
/**
8
 * Widget asset bundle
9
 *
10
 * @author Vasile Crudu <[email protected]>
11
 *
12
 * @link https://github.com/the0rist
13
 */
14
class Asset extends AssetBundle
15
{
16
	/**
17
	 * @inheritdoc
18
	 */
19
	public $sourcePath = '@the0rist/imperavi/assets';
20
21
	/**
22
	 * @var string Redactor language
23
	 */
24
	public $language;
25
26
	/**
27
	 * @var array Redactor plugins array
28
	 */
29
	public $plugins = [];
30
31
	/**
32
	 * @inheritdoc
33
	 */
34
	public $css = [
35
		'redactor.css'
36
	];
37
38
	/**
39
	 * @inheritdoc
40
	 */
41
	public $js = [
42
	    'redactor.min.js'
43
	];
44
45
	/**
46
	 * @inheritdoc
47
	 */
48
	public $depends = [
49
		'yii\web\JqueryAsset'
50
	];
51
52
	/**
53
	 * Register asset bundle language files and plugins.
54
	 */
55
	public function registerAssetFiles($view)
56
	{
57
		if ($this->language !== null) {
58
			$this->js[] = 'lang/' . $this->language . '.js';
59
		}
60
		if (!empty($this->plugins)) {
61
			foreach ($this->plugins as $plugin) {
62
				if ($plugin === 'clips') {
63
					$this->css[] = 'plugins/' . $plugin . '/' . $plugin . '.css';
64
				}
65
				$this->js[] = 'plugins/' . $plugin . '/' . $plugin .'.js';
66
			}
67
		}
68
		parent::registerAssetFiles($view);
69
	}
70
}
71