Conditions | 5 |
Paths | 5 |
Total Lines | 20 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
11 | public function getStatusAsEmojiAttribute(): string |
||
12 | { |
||
13 | if ($this->status === CheckStatus::SUCCESS) { |
||
|
|||
14 | return Emoji::ok(); |
||
15 | } |
||
16 | |||
17 | if ($this->status === CheckStatus::FAILED) { |
||
18 | return Emoji::notOk(); |
||
19 | } |
||
20 | |||
21 | if ($this->status === CheckStatus::WARNING) { |
||
22 | return Emoji::warning(); |
||
23 | } |
||
24 | |||
25 | if ($this->status === CheckStatus::NOT_YET_CHECKED) { |
||
26 | return Emoji::unknown(); |
||
27 | } |
||
28 | |||
29 | return ''; |
||
30 | } |
||
31 | |||
55 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: