Conditions | 6 |
Paths | 6 |
Total Lines | 24 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
9 | public function getStatusAsEmojiAttribute(): string |
||
10 | { |
||
11 | if ($this->status === CheckStatus::SUCCESS) { |
||
|
|||
12 | return '✅'; |
||
13 | } |
||
14 | |||
15 | if ($this->status === CheckStatus::FAILED) { |
||
16 | return '❌'; |
||
17 | } |
||
18 | |||
19 | if ($this->status === CheckStatus::WARNING) { |
||
20 | return '⚠️'; |
||
21 | } |
||
22 | |||
23 | if ($this->status === CheckStatus::NOT_YET_CHECKED) { |
||
24 | return ''; |
||
25 | } |
||
26 | |||
27 | if (is_null($this->status)) { |
||
28 | return '❓'; |
||
29 | } |
||
30 | |||
31 | return ''; |
||
32 | } |
||
33 | |||
67 |
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: