View   A
last analyzed

Complexity

Total Complexity 13

Size/Duplication

Total Lines 69
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 13
lcom 0
cbo 3
dl 0
loc 69
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getBodyClasses() 0 4 1
A __set() 0 8 3
A __get() 0 8 3
A __isset() 0 4 3
A __unset() 0 8 3
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
class View extends \yii\web\View
14
{
15
    use GetManagerTrait;
16
17
    /**
18
     * Returns classes for HTML body.
19
     */
20
    public function getBodyClasses()
21
    {
22
        return $this->getManager()->getSettings()->getBodyClasses();
23
    }
24
25
    /**
26
     * Magic setter.
27
     *
28
     * @param int|string $name
29
     * @param mixed      $value the element value
30
     */
31
    public function __set($name, $value)
32
    {
33
        if ($name && $this->canSetProperty($name)) {
34
            parent::__set($name, $value);
35
        } else {
36
            $this->params[$name] = $value;
37
        }
38
    }
39
40
    /**
41
     * Magic getter.
42
     *
43
     * @param string $name component or property name
44
     *
45
     * @return mixed param or property value
46
     */
47
    public function __get($name)
48
    {
49
        if ($name && $this->canGetProperty($name)) {
50
            return parent::__get($name);
51
        } else {
52
            return $this->params[$name];
53
        }
54
    }
55
56
    /**
57
     * Magic is set checker.
58
     *
59
     * @param string $name the property or param name to check
60
     *
61
     * @return bool whether the value is set
62
     */
63
    public function __isset($name)
64
    {
65
        return ($name && parent::__isset($name)) || isset($this->params[$name]);
66
    }
67
68
    /**
69
     * Magic unsetter.
70
     *
71
     * @param string $name the property or param name to unset
72
     */
73
    public function __unset($name)
74
    {
75
        if ($name && $this->canSetProperty($name)) {
76
            parent::__unset($name);
77
        } else {
78
            unset($this->params[$name]);
79
        }
80
    }
81
}
82