AssetManager   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 2
dl 0
loc 32
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getConverter() 0 13 6
A setConverter() 0 4 1
1
<?php
2
/**
3
 * Pluggable themes for Yii2
4
 *
5
 * @link      https://github.com/hiqdev/yii2-thememanager
6
 * @package   yii2-thememanager
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hiqdev\thememanager;
12
13
use Yii;
14
15
/**
16
 * Asset Manager.
17
 */
18
class AssetManager extends \yii\web\AssetManager
19
{
20
    /**
21
     * @var string|AssetConverter
22
     */
23
    protected $_ac;
24
25
    /**
26
     * {@inheritdoc}
27
     */
28
    public function getConverter()
29
    {
30
        if ($this->_ac === null) {
31
            $this->_ac = Yii::createObject(AssetConverter::class);
32
        } elseif (is_array($this->_ac) || is_string($this->_ac)) {
33
            if (is_array($this->_ac) && !isset($this->_ac['class'])) {
34
                $this->_ac['class'] = AssetConverter::class;
35
            }
36
            $this->_ac = Yii::createObject($this->_ac);
37
        }
38
39
        return $this->_ac;
40
    }
41
42
    /**
43
     * {@inheritdoc}
44
     */
45
    public function setConverter($value)
46
    {
47
        $this->_ac = $value;
48
    }
49
}
50