Passed
Push — master ( 1416ae...b5a8b1 )
by Luis
54s queued 13s
created

WithVisibility   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 22
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0
wmc 4
1
<?php declare(strict_types=1);
2
/**
3
 * PHP version 8.1
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\Modifiers;
9
10
trait WithVisibility
11
{
12
    private readonly Visibility $modifier;
0 ignored issues
show
Bug introduced by
A parse error occurred: Syntax error, unexpected T_STRING, expecting T_VARIABLE on line 12 at column 21
Loading history...
13
14 6
    public function isPublic(): bool
15
    {
16 6
        return $this->hasVisibility(Visibility::public());
17
    }
18
19 4
    public function isPrivate(): bool
20
    {
21 4
        return $this->hasVisibility(Visibility::private());
22
    }
23
24 4
    public function isProtected(): bool
25
    {
26 4
        return $this->hasVisibility(Visibility::protected());
27
    }
28
29 19
    public function hasVisibility(Visibility $modifier): bool
30
    {
31 19
        return $this->modifier->equals($modifier);
32
    }
33
}
34