Total Complexity | 4 |
Total Lines | 22 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
10 | trait WithVisibility |
||
11 | { |
||
12 | private readonly Visibility $modifier; |
||
|
|||
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 | } |
||
34 |