Activate::setActive()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
crap 1
1
<?php namespace NukaCode\Menu\Traits;
2
3
4
/**
5
 * Class Activate
6
 *
7
 * @package NukaCode\Menu\Traits
8
 */
9
trait Activate {
10
11
    /**
12
     * Is the link active.
13
     *
14
     * @var bool
15
     */
16
    public $active;
17
18
    /**
19
     * Set this link as active.
20
     *
21
     * @param bool $bool
22
     *
23
     * @return $this
24
     */
25 4
    public function setActive($bool = true)
26
    {
27 4
        $this->active = $bool;
28
29 4
        return $this;
30
    }
31
32
    /**
33
     * Check if the link is active or not.
34
     *
35
     * @return bool
36
     */
37 2
    public function isActive()
38
    {
39 2
        return $this->active;
40
    }
41
}