Conditions | 4 |
Paths | 4 |
Total Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
48 | public function getNextRunDiffAttribute(): string |
||
49 | { |
||
50 | if (! $this->next_run_in_minutes) { |
||
51 | return 'As soon as possible'; |
||
52 | } |
||
53 | |||
54 | if (! $this->last_ran_at) { |
||
55 | return 'As soon as possible'; |
||
56 | } |
||
57 | |||
58 | $nextRun = $this->last_ran_at->addMinutes($this->next_run_in_minutes); |
||
59 | |||
60 | if ($nextRun->isPast()) { |
||
61 | return 'As soon as possible'; |
||
62 | } |
||
63 | |||
64 | return $this->last_ran_at->addMinutes($this->next_run_in_minutes)->diffForHumans(); |
||
65 | } |
||
66 | } |
||
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: