Conditions | 4 |
Paths | 4 |
Total Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
29 | public function shouldCheckSpace() |
||
30 | { |
||
31 | return |
||
32 | // Never checked before |
||
33 | !$this->space_checked_at |
||
34 | |||
35 | // If we believe storage if full, check again after an hour |
||
36 | || ($this->isFull() && $this->space_checked_at->diffInMinutes(Carbon::now()) > 60) |
||
37 | |||
38 | // Otherwise just periodically check in |
||
39 | || $this->space_checked_at->diffInHours(Carbon::now()) > 24; |
||
40 | } |
||
41 | |||
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: