ActiveMenu   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 1

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getInstance() 0 7 2
A setActive() 0 4 1
A getActive() 0 4 1
A isActive() 0 6 2
A activeClass() 0 6 2
1
<?php
2
3
/**
4
 * ActiveMenu
5
 * @copyright Copyright (c) 2011 - 2014 Aleksandr Torosh (http://wezoom.com.ua)
6
 * @author Aleksandr Torosh <[email protected]>
7
 */
8
9
namespace Application\Mvc\Helper;
10
11
class ActiveMenu extends \Phalcon\Mvc\User\Component
12
{
13
14
    private static $instance;
15
    private $active = null;
16
17
    public static function getInstance()
18
    {
19
        if (!self::$instance) {
20
            self::$instance = new ActiveMenu();
21
        }
22
        return self::$instance;
23
    }
24
25
    public function setActive($value)
26
    {
27
        $this->active = $value;
28
    }
29
30
    public function getActive()
31
    {
32
        return $this->active;
33
    }
34
35
    public function isActive($value)
36
    {
37
        if ($this->active == $value) {
38
            return true;
39
        }
40
    }
41
42
    public function activeClass($value)
43
    {
44
        if ($this->isActive($value)) {
45
            return ' active';
46
        }
47
    }
48
49
}
50