1 | <?php |
||
4 | trait UserPresenter |
||
5 | { |
||
6 | /** |
||
7 | * Get the account first name. |
||
8 | * |
||
9 | * @return string |
||
10 | */ |
||
11 | public function getFirstNameAttribute(): string |
||
15 | |||
16 | /** |
||
17 | * Get the account last name. |
||
18 | * |
||
19 | * @return string |
||
20 | */ |
||
21 | public function getLastNameAttribute(): string |
||
25 | |||
26 | /** |
||
27 | * Get the account full name. |
||
28 | * |
||
29 | * @return string |
||
30 | */ |
||
31 | public function getFullNameAttribute(): string |
||
35 | |||
36 | /** |
||
37 | * Get the account facebook. |
||
38 | * |
||
39 | * @return string |
||
40 | */ |
||
41 | public function getFacebookAttribute(): string |
||
45 | |||
46 | /** |
||
47 | * Get the account twitter. |
||
48 | * |
||
49 | * @return string |
||
50 | */ |
||
51 | public function getTwitterAttribute(): string |
||
55 | |||
56 | /** |
||
57 | * Get the account biography. |
||
58 | * |
||
59 | * @return string |
||
60 | */ |
||
61 | public function getBiographyAttribute(): string |
||
65 | |||
66 | /** |
||
67 | * Get the account signature. |
||
68 | * |
||
69 | * @return string |
||
70 | */ |
||
71 | public function getSignatureAttribute(): string |
||
75 | |||
76 | /** |
||
77 | * Parse an attribute and return its value or empty if null. |
||
78 | * |
||
79 | * @param string|null $attribute The attribute to parse. |
||
80 | * |
||
81 | * @return string |
||
82 | */ |
||
83 | protected function parse($attribute): string |
||
91 | } |
||
92 |
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: