GetManagerTrait   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setManager() 0 4 1
A getManager() 0 8 2
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 hiqdev\yii2\collection\Manager;
14
use Yii;
15
16
trait GetManagerTrait
17
{
18
    protected $_manager = 'themeManager';
19
20
    /**
21
     * Setter for manager.
22
     *
23
     * @var string|Manager component name of the theme manager object
24
     */
25
    public function setManager($manager)
26
    {
27
        $this->_manager = $manager;
28
    }
29
30
    /**
31
     * Getter for manager.
32
     *
33
     * @return ThemeManager
34
     */
35
    public function getManager()
36
    {
37
        if (!is_object($this->_manager)) {
38
            $this->_manager = Yii::$app->get($this->_manager);
39
        }
40
41
        return $this->_manager;
42
    }
43
}
44