VisibilityTrait   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
c 1
b 0
f 0
lcom 1
cbo 0
dl 0
loc 31
rs 10
ccs 11
cts 11
cp 1

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getVisibility() 0 4 1
A isPublic() 0 4 1
A isProtected() 0 4 1
A isPrivate() 0 4 1
A setVisibility() 0 6 1
1
<?php
2
3
namespace Benoth\StaticReflection\Reflection\Parts;
4
5
use Benoth\StaticReflection\Reflection\Reflection;
6
7
trait VisibilityTrait
8
{
9
    protected $visibility = Reflection::IS_PUBLIC;
10
11 180
    public function getVisibility()
12
    {
13 180
        return $this->visibility;
14
    }
15
16 84
    public function isPublic()
17
    {
18 84
        return $this->getVisibility() === self::IS_PUBLIC;
19
    }
20
21 69
    public function isProtected()
22
    {
23 69
        return $this->getVisibility() === self::IS_PROTECTED;
24
    }
25
26 66
    public function isPrivate()
27
    {
28 66
        return $this->getVisibility() === self::IS_PRIVATE;
29
    }
30
31 1062
    public function setVisibility($visibility)
32
    {
33 1062
        $this->visibility = (int) $visibility;
34
35 1062
        return $this;
36
    }
37
}
38