| Conditions | 4 |
| Paths | 3 |
| Total Lines | 14 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | public function lastActivityDate(): string |
||
| 16 | { |
||
| 17 | if ($this->last_activity === null || $this->last_activity->year === -1) { |
||
| 18 | return fragment('back.users.neverLoggedIn'); |
||
| 19 | } |
||
| 20 | |||
| 21 | $lastActivityDate = diff_date_for_humans($this->last_activity); |
||
| 22 | |||
| 23 | if (str_contains($lastActivityDate, 'second')) { |
||
| 24 | $lastActivityDate = fragment('back.users.justNow'); |
||
| 25 | } |
||
| 26 | |||
| 27 | return $lastActivityDate; |
||
| 28 | } |
||
| 29 | } |
||
| 30 |
Since your code implements the magic getter
_get, this function will be called for any read access on an undefined variable. You can add the@propertyannotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.