Conditions | 4 |
Paths | 4 |
Total Lines | 16 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
40 | public function getStatusAttribute(): string |
||
41 | { |
||
42 | if ($this->enabled_checks->count() === 0) { |
||
43 | return HostHealth::WARNING; |
||
44 | } |
||
45 | |||
46 | if ($this->enabled_checks->contains->hasStatus(CheckStatus::FAILED)) { |
||
47 | return HostHealth::UNHEALTHY; |
||
48 | } |
||
49 | |||
50 | if ($this->enabled_checks->every->hasStatus(CheckStatus::SUCCESS)) { |
||
51 | return HostHealth::HEALTHY; |
||
52 | } |
||
53 | |||
54 | return HostHealth::WARNING; |
||
55 | } |
||
56 | } |
||
57 |
Since your code implements the magic getter
_get
, this function will be called for any read access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.