Passed
Pull Request — master (#7)
by Luis
20:14 queued 05:16
created

Attribute::protected()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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