Conditions | 5 |
Paths | 5 |
Total Lines | 20 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
10 | public function getCheckStatusAsEmojiAttribute(): string |
||
11 | { |
||
12 | if ($this->status === CheckStatus::SUCCESS) { |
||
|
|||
13 | return Emoji::ok(); |
||
14 | } |
||
15 | |||
16 | if ($this->status === CheckStatus::FAILED) { |
||
17 | return Emoji::notOk(); |
||
18 | } |
||
19 | |||
20 | if ($this->status === CheckStatus::WARNING) { |
||
21 | return Emoji::warning(); |
||
22 | } |
||
23 | |||
24 | if ($this->status === CheckStatus::NOT_YET_CHECKED) { |
||
25 | return Emoji::unknown(); |
||
26 | } |
||
27 | |||
28 | return ''; |
||
29 | } |
||
30 | } |
||
31 |
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: