XEditableAsset   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 29
c 0
b 0
f 0
ccs 0
cts 7
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A registerAssetFiles() 0 8 2
1
<?php
2
/**
3
 * X-editable extension for Yii2
4
 *
5
 * @link      https://github.com/hiqdev/yii2-x-editable
6
 * @package   yii2-x-editable
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hiqdev\xeditable\assets;
12
13
use yii\web\AssetBundle;
14
15
class XEditableAsset extends AssetBundle
16
{
17
    const LIBRARY_BOOTSTRAP3 = 'bootstrap3';
18
    const LIBRARY_BOOTSTRAP  = 'bootstrap';
19
    const LIBRARY_JQUERYUI   = 'jqueryui';
20
    const LIBRARY_JQUERY     = 'jquery';
21
22
    /**
23
     * @var string library to be used: bootstrap, jqueryui, plain jquery
24
     */
25
    public $library = self::LIBRARY_BOOTSTRAP3;
26
27
    public $sourcePath = '@bower/x-editable/dist';
28
29
    public $depends = [
30
        'yii\web\YiiAsset',
31
        'yii\bootstrap\BootstrapAsset',
32
        'yii\bootstrap\BootstrapPluginAsset',
33
    ];
34
35
    public function registerAssetFiles($view)
36
    {
37
        $nodigitLib  = preg_replace('/[0-9]+/', '', $this->library);
38
        $this->js[]  = $this->library . '-editable/js/' . $nodigitLib . '-editable' . (YII_DEBUG ? '.js' : '.min.js');
39
        $this->css[] = $this->library . '-editable/css/' . $nodigitLib . '-editable.css';
40
41
        parent::registerAssetFiles($view);
42
    }
43
}
44