Property   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 25
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A __toString() 0 6 1
A references() 0 3 1
1
<?php declare(strict_types=1);
2
/**
3
 * This source file is subject to the license that is bundled with this package in the file LICENSE.
4
 */
5
6
namespace PhUml\Code\Properties;
7
8
use PhUml\Code\Modifiers\CanBeStatic;
9
use PhUml\Code\Modifiers\HasVisibility;
10
use PhUml\Code\Modifiers\Visibility;
0 ignored issues
show
Bug introduced by
The type PhUml\Code\Modifiers\Visibility was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use PhUml\Code\Modifiers\WithStaticModifier;
12
use PhUml\Code\Modifiers\WithVisibility;
13
use PhUml\Code\Name;
14
use PhUml\Code\Variables\HasType;
15
use PhUml\Code\Variables\Variable;
16
use PhUml\Code\Variables\WithVariable;
17
use Stringable;
18
19
/**
20
 * It represents an instance variable
21
 */
22
final class Property implements HasType, HasVisibility, CanBeStatic, Stringable
23
{
24
    use WithVisibility;
25
    use WithStaticModifier;
26
    use WithVariable;
27
28 51
    public function __construct(Variable $variable, Visibility $visibility, bool $isStatic = false)
29
    {
30 51
        $this->variable = $variable;
0 ignored issues
show
Bug introduced by
The property variable is declared read-only in PhUml\Code\Properties\Property.
Loading history...
31 51
        $this->visibility = $visibility;
0 ignored issues
show
Bug introduced by
The property visibility is declared read-only in PhUml\Code\Properties\Property.
Loading history...
32 51
        $this->isStatic = $isStatic;
33
    }
34
35
    /** @return Name[] */
36 14
    public function references(): array
37
    {
38 14
        return $this->variable->references();
39
    }
40
41 14
    public function __toString(): string
42
    {
43 14
        return sprintf(
44
            '%s%s',
45 14
            $this->visibility->value,
46 14
            $this->variable
47
        );
48
    }
49
}
50