Total Complexity | 9 |
Total Lines | 169 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 0 |
1 | <?php |
||
12 | final class User |
||
13 | { |
||
14 | /** |
||
15 | * User's remote ID |
||
16 | * |
||
17 | * @var int |
||
18 | */ |
||
19 | protected $remoteId; |
||
20 | |||
21 | /** |
||
22 | * User's name |
||
23 | * |
||
24 | * @var string |
||
25 | */ |
||
26 | protected $name; |
||
27 | |||
28 | /** |
||
29 | * User's email |
||
30 | * |
||
31 | * @var string |
||
32 | */ |
||
33 | protected $email; |
||
34 | |||
35 | /** |
||
36 | * User's encrypted password |
||
37 | * |
||
38 | * @var string |
||
39 | */ |
||
40 | protected $password; |
||
41 | |||
42 | /** |
||
43 | * @var \Carbon\Carbon |
||
44 | */ |
||
45 | protected $updated; |
||
46 | |||
47 | /** |
||
48 | * @var \Carbon\Carbon |
||
49 | */ |
||
50 | protected $created; |
||
51 | |||
52 | /** |
||
53 | * The instance of the user locally |
||
54 | * |
||
55 | * @var \Illuminate\Contracts\Auth\Authenticatable |
||
56 | */ |
||
57 | protected $localUser; |
||
58 | |||
59 | /** |
||
60 | * Whether a user exist only locally |
||
61 | * |
||
62 | * @var bool |
||
63 | */ |
||
64 | protected $isLocal = false; |
||
65 | |||
66 | /** |
||
67 | * The action for a remote sync client |
||
68 | * |
||
69 | * @var string |
||
70 | */ |
||
71 | protected $remoteAction; |
||
72 | |||
73 | /** |
||
74 | * User constructor. |
||
75 | * |
||
76 | * @param int $remoteId |
||
77 | * @param string|null $name |
||
78 | * @param string $email |
||
79 | * @param string|null $password |
||
80 | * @param string|null $updated |
||
81 | * @param string $created |
||
82 | * @param string $action |
||
83 | */ |
||
84 | public function __construct( |
||
85 | int $remoteId, |
||
86 | ?string $name, |
||
87 | string $email, |
||
88 | ?string $password, |
||
89 | ?string $updated, |
||
90 | string $created, |
||
91 | string $action |
||
92 | ) |
||
93 | { |
||
94 | $this->remoteId = $remoteId; |
||
95 | $this->name = $name; |
||
96 | $this->email = $email; |
||
97 | $this->password = $password; |
||
98 | $this->updated = new Carbon($updated); |
||
99 | $this->created = new Carbon($created); |
||
100 | $this->remoteAction = $action; |
||
101 | } |
||
102 | |||
103 | /** |
||
104 | * Get user's name |
||
105 | * |
||
106 | * @return string|null |
||
107 | */ |
||
108 | public function getName() |
||
109 | { |
||
110 | return $this->name; |
||
111 | } |
||
112 | |||
113 | /** |
||
114 | * Get user's email |
||
115 | * |
||
116 | * @return string |
||
117 | */ |
||
118 | public function getEmail(): string |
||
119 | { |
||
120 | return $this->email; |
||
121 | } |
||
122 | |||
123 | /** |
||
124 | * Get user's password |
||
125 | * |
||
126 | * @return string|null |
||
127 | */ |
||
128 | public function getPassword() |
||
129 | { |
||
130 | return $this->password; |
||
131 | } |
||
132 | |||
133 | /** |
||
134 | * Get created_at date |
||
135 | * |
||
136 | * @return Carbon |
||
137 | */ |
||
138 | public function getCreated(): Carbon |
||
139 | { |
||
140 | return $this->created; |
||
141 | } |
||
142 | |||
143 | /** |
||
144 | * Get updated_at date |
||
145 | * |
||
146 | * @return Carbon|null |
||
147 | */ |
||
148 | public function getUpdated() |
||
149 | { |
||
150 | return $this->updated; |
||
151 | } |
||
152 | |||
153 | /** |
||
154 | * Get remote action |
||
155 | * |
||
156 | * @return string |
||
157 | */ |
||
158 | public function getRemoteAction(): string |
||
161 | } |
||
162 | |||
163 | /** |
||
164 | * Get remote user ID |
||
165 | * |
||
166 | * @return int |
||
167 | */ |
||
168 | public function getRemoteId(): int |
||
169 | { |
||
170 | return $this->remoteId; |
||
171 | } |
||
172 | |||
173 | /** |
||
174 | * Reset the password. |
||
175 | * |
||
176 | * @return void |
||
177 | */ |
||
178 | public function resetPassword() |
||
181 | } |
||
182 | } |