Passed
Push — master ( 0701c6...1a3583 )
by Luis
41s queued 12s
created

Attribute   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 11
c 0
b 0
f 0
dl 0
loc 19
ccs 9
cts 9
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A __toString() 0 6 1
1
<?php declare(strict_types=1);
2
/**
3
 * PHP version 7.2
4
 *
5
 * This source file is subject to the license that is bundled with this package in the file LICENSE.
6
 */
7
8
namespace PhUml\Code\Attributes;
9
10
use PhUml\Code\Modifiers\CanBeStatic;
11
use PhUml\Code\Modifiers\HasVisibility;
12
use PhUml\Code\Modifiers\Visibility;
13
use PhUml\Code\Modifiers\WithStaticModifier;
14
use PhUml\Code\Modifiers\WithVisibility;
15
use PhUml\Code\Variables\HasType;
16
use PhUml\Code\Variables\Variable;
17
use PhUml\Code\Variables\WithVariable;
18
19
/**
20
 * It represents an instance variable
21
 */
22
final class Attribute implements HasType, HasVisibility, CanBeStatic
23
{
24
    use WithVisibility;
25 147
    use WithStaticModifier;
26
    use WithVariable;
27 147
28 147
    public function __construct(Variable $variable, Visibility $modifier, bool $isStatic = false)
29 147
    {
30 147
        $this->variable = $variable;
31
        $this->modifier = $modifier;
32 81
        $this->isStatic = $isStatic;
33
    }
34 81
35
    public function __toString()
36
    {
37 84
        return sprintf(
38
            '%s%s',
39 84
            $this->modifier,
40
            $this->variable
41
        );
42 105
    }
43
}
44