| Conditions | 4 |
| Paths | 3 |
| Total Lines | 14 |
| Code Lines | 7 |
| Lines | 14 |
| Ratio | 100 % |
| 1 | <?php |
||
| 20 | View Code Duplication | public function lastActivityDate() : string |
|
| 21 | { |
||
| 22 | if ($this->last_activity === null || $this->last_activity->year === -1) { |
||
| 23 | return fragment('back.users.neverLoggedIn'); |
||
| 24 | } |
||
| 25 | |||
| 26 | $lastActivityDate = diff_date_for_humans($this->last_activity); |
||
| 27 | |||
| 28 | if (str_contains($lastActivityDate, 'second')) { |
||
| 29 | $lastActivityDate = fragment('back.users.justNow'); |
||
| 30 | } |
||
| 31 | |||
| 32 | return $lastActivityDate; |
||
| 33 | } |
||
| 34 | } |
||
| 35 |
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.