Completed
Pull Request — master (#221)
by personal
04:09
created

Attribute   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 63
rs 10
c 1
b 0
f 0
wmc 5
lcom 1
cbo 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getName() 0 4 1
A getVisibility() 0 4 1
A isPublic() 0 4 1
A isStatic() 0 4 1
1
<?php
2
3
/*
4
 * (c) Jean-François Lépine <https://twitter.com/Halleck45>
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace Hal\Component\Reflected;
11
12
13
use Hal\Component\Token\Token;
14
15
class Attribute
16
{
17
18
    /**
19
     * @var string
20
     */
21
    private $name;
22
23
    /**
24
     * @var string
25
     */
26
    private $visibility;
27
28
    /**
29
     * @var boolean
30
     */
31
    private $isStatic;
32
33
    /**
34
     * Attribute constructor.
35
     * @param string $name
36
     * @param string $visibility
37
     * @param bool $isStatic
38
     */
39
    public function __construct($name, $visibility = Token::T_VISIBILITY_PUBLIC, $isStatic = false)
40
    {
41
        $this->name = $name;
42
        $this->visibility = $visibility;
43
        $this->isStatic = $isStatic;
44
    }
45
46
    /**
47
     * @return string
48
     */
49
    public function getName()
50
    {
51
        return $this->name;
52
    }
53
54
    /**
55
     * @return string
56
     */
57
    public function getVisibility()
58
    {
59
        return $this->visibility;
60
    }
61
62
    /**
63
     * @return bool
64
     */
65
    public function isPublic()
66
    {
67
        return Token::T_VISIBILITY_PUBLIC === $this->getVisibility();
68
    }
69
70
    /**
71
     * @return boolean
72
     */
73
    public function isStatic()
74
    {
75
        return $this->isStatic;
76
    }
77
}