ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
Data.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21namespace ILIAS\User\Profile;
22
25
26class Data
27{
28 private array $system_information;
29
30 public function __construct(
31 private ?int $id = null,
32 private string $alias = '',
33 private ?ResourceIdentification $avatar_rid = null,
34 private string $firstname = '',
35 private string $lastname = '',
36 private string $title = '',
37 private ?Genders $gender = null,
38 private ?\DateTimeImmutable $birthday = null,
39 private string $institution = '',
40 private string $department = '',
41 private string $street = '',
42 private string $city = '',
43 private string $zipcode = '',
44 private string $country = '',
45 private string $email = '',
46 private ?string $second_email = null,
47 private string $phone_office = '',
48 private string $phone_home = '',
49 private string $phone_mobile = '',
50 private string $fax = '',
51 private string $matriculation = '',
52 private string $hobby = '',
53 private string $referral_comment = '',
54 private array $geo_coordinates = [],
55 private array $additional_fields = []
56 ) {
57 }
58
59 public function getId(): int
60 {
61 return $this->id;
62 }
63
64 public function withId(int $id): self
65 {
66 $clone = clone $this;
67 $clone->id = $id;
68 return $clone;
69 }
70
71 public function getAlias(): string
72 {
73 return $this->alias;
74 }
75
76 public function withAlias(string $alias): self
77 {
78 $clone = clone $this;
79 $clone->alias = $alias;
80 return $clone;
81 }
82
84 {
85 return $this->avatar_rid;
86 }
87
88 public function withAvatarRid(?ResourceIdentification $avatar_rid): self
89 {
90 $clone = clone $this;
91 $clone->avatar_rid = $this->avatar_rid;
92 return $clone;
93 }
94
95 public function getFirstname(): string
96 {
97 return $this->firstname;
98 }
99
100 public function withFirstname(string $firstname): self
101 {
102 $clone = clone $this;
103 $clone->firstname = $firstname;
104 return $clone;
105 }
106
107 public function getLastname(): string
108 {
109 return $this->lastname;
110 }
111
112 public function withLastname(string $lastname): self
113 {
114 $clone = clone $this;
115 $clone->lastname = $lastname;
116 return $clone;
117 }
118
119 public function getTitle(): string
120 {
121 return $this->title;
122 }
123
124 public function withTitle(string $title): self
125 {
126 $clone = clone $this;
127 $clone->title = $title;
128 return $clone;
129 }
130
131 public function getGender(): ?Genders
132 {
133 return $this->gender;
134 }
135
136 public function withGender(?Genders $gender): self
137 {
138 $clone = clone $this;
139 $clone->gender = $gender;
140 return $clone;
141 }
142
143 public function getBirthday(): ?\DateTimeImmutable
144 {
145 return $this->birthday;
146 }
147
148 public function withBirthday(?\DateTimeImmutable $birthday): self
149 {
150 $clone = clone $this;
151 $clone->birthday = $birthday;
152 return $clone;
153 }
154
155 public function getInstitution(): string
156 {
157 return $this->institution;
158 }
159
160 public function withInstitution(string $institution): self
161 {
162 $clone = clone $this;
163 $clone->institution = $institution;
164 return $clone;
165 }
166
167 public function getDepartment(): string
168 {
169 return $this->department;
170 }
171
172 public function withDepartment(string $department): self
173 {
174 $clone = clone $this;
175 $clone->department = $department;
176 return $clone;
177 }
178
179 public function getStreet(): string
180 {
181 return $this->street;
182 }
183
184 public function withStreet(string $street): self
185 {
186 $clone = clone $this;
187 $clone->street = $street;
188 return $clone;
189 }
190
191 public function getCity(): string
192 {
193 return $this->city;
194 }
195
196 public function withCity(string $city): self
197 {
198 $clone = clone $this;
199 $clone->city = $city;
200 return $clone;
201 }
202
203 public function getZipcode(): string
204 {
205 return $this->zipcode;
206 }
207
208 public function withZipcode(string $zipcode): self
209 {
210 $clone = clone $this;
211 $clone->zipcode = $zipcode;
212 return $clone;
213 }
214
215 public function getCountry(): string
216 {
217 return $this->country;
218 }
219
220 public function withCountry(string $country): self
221 {
222 $clone = clone $this;
223 $clone->country = $country;
224 return $clone;
225 }
226
227 public function getEmail(): string
228 {
229 return $this->email;
230 }
231
232 public function withEmail(string $email): self
233 {
234 $clone = clone $this;
235 $clone->email = $email;
236 return $clone;
237 }
238
239 public function getSecondEmail(): ?string
240 {
241 return $this->second_email;
242 }
243
244 public function withSecondEmail(?string $email): self
245 {
246 $clone = clone $this;
247 $clone->second_email = $email;
248 return $clone;
249 }
250
251 public function getPhoneOffice(): string
252 {
253 return $this->phone_office;
254 }
255
256 public function withPhoneOffice(string $phone): self
257 {
258 $clone = clone $this;
259 $clone->phone_office = $phone;
260 return $clone;
261 }
262
263 public function getPhoneHome(): string
264 {
265 return $this->phone_home;
266 }
267
268 public function withPhoneHome(string $phone): self
269 {
270 $clone = clone $this;
271 $clone->phone_home = $phone;
272 return $clone;
273 }
274
275 public function getPhoneMobile(): string
276 {
277 return $this->phone_mobile;
278 }
279
280 public function withPhoneMobile(string $phone): self
281 {
282 $clone = clone $this;
283 $clone->phone_mobile = $phone;
284 return $clone;
285 }
286
287 public function getFax(): string
288 {
289 return $this->fax;
290 }
291
292 public function withFax(string $fax): self
293 {
294 $clone = clone $this;
295 $clone->fax = $fax;
296 return $clone;
297 }
298
299 public function getMatriculation(): string
300 {
301 return $this->matriculation;
302 }
303
304 public function withMatriculation(string $matriculation): self
305 {
306 $clone = clone $this;
307 $clone->matriculation = $matriculation;
308 return $clone;
309 }
310
311 public function getHobby(): string
312 {
313 return $this->hobby;
314 }
315
316 public function withHobby(string $hobby): self
317 {
318 $clone = clone $this;
319 $clone->hobby = $hobby;
320 return $clone;
321 }
322
323 public function getReferralComment(): string
324 {
325 return $this->referral_comment;
326 }
327
328 public function withReferralComment(string $comment): self
329 {
330 $clone = clone $this;
331 $clone->referral_comment = $comment;
332 return $clone;
333 }
334
335 public function getGeoCoordinates(): array
336 {
337 return $this->geo_coordinates;
338 }
339
340 public function withGeoCoordinates(array $coordinates): self
341 {
342 $clone = clone $this;
343 $clone->geo_coordinates = $coordinates;
344 return $clone;
345 }
346
347 public function getAdditionalFieldByIdentifier(string $identifier): mixed
348 {
349 return $this->additional_fields[$identifier] ?? null;
350 }
351
352 public function withAdditionalFieldByIdentifier(string $identifier, mixed $value): self
353 {
354 $clone = clone $this;
355 $clone->additional_fields[$identifier] = $value;
356 return $clone;
357 }
358
360 {
361 return rtrim(
362 array_reduce(
363 array_keys($this->additional_fields),
364 fn(string $c, string $field_id) => $c . array_reduce(
365 $this->additional_fields[$field_id],
366 fn(string $ci, string $value) => $ci . "({$db->quote($this->id, \ilDBConstants::T_INTEGER)}, "
367 . "{$db->quote($field_id, \ilDBConstants::T_TEXT)}, {$db->quote($value, \ilDBConstants::T_TEXT)}),",
368 ''
369 ),
370 ''
371 ),
372 ','
373 );
374 }
375
376 public function getSystemInformation(): array
377 {
379 }
380
381 public function withSystemInformation(array $system_information): self
382 {
383 $clone = clone $this;
384 $clone->system_information = $system_information;
385 return $clone;
386 }
387}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
$comment
Definition: buildRTE.php:72
withDepartment(string $department)
Definition: Data.php:172
withGender(?Genders $gender)
Definition: Data.php:136
withAlias(string $alias)
Definition: Data.php:76
withZipcode(string $zipcode)
Definition: Data.php:208
withCity(string $city)
Definition: Data.php:196
withAvatarRid(?ResourceIdentification $avatar_rid)
Definition: Data.php:88
withFax(string $fax)
Definition: Data.php:292
withAdditionalFieldByIdentifier(string $identifier, mixed $value)
Definition: Data.php:352
withStreet(string $street)
Definition: Data.php:184
getAdditionalFieldByIdentifier(string $identifier)
Definition: Data.php:347
withCountry(string $country)
Definition: Data.php:220
withHobby(string $hobby)
Definition: Data.php:316
withGeoCoordinates(array $coordinates)
Definition: Data.php:340
getAdditionalFieldsStorageValues(\ilDBInterface $db)
Definition: Data.php:359
withReferralComment(string $comment)
Definition: Data.php:328
withEmail(string $email)
Definition: Data.php:232
withInstitution(string $institution)
Definition: Data.php:160
withSecondEmail(?string $email)
Definition: Data.php:244
withBirthday(?\DateTimeImmutable $birthday)
Definition: Data.php:148
withPhoneOffice(string $phone)
Definition: Data.php:256
withSystemInformation(array $system_information)
Definition: Data.php:381
__construct(private ?int $id=null, private string $alias='', private ?ResourceIdentification $avatar_rid=null, private string $firstname='', private string $lastname='', private string $title='', private ?Genders $gender=null, private ?\DateTimeImmutable $birthday=null, private string $institution='', private string $department='', private string $street='', private string $city='', private string $zipcode='', private string $country='', private string $email='', private ?string $second_email=null, private string $phone_office='', private string $phone_home='', private string $phone_mobile='', private string $fax='', private string $matriculation='', private string $hobby='', private string $referral_comment='', private array $geo_coordinates=[], private array $additional_fields=[])
Definition: Data.php:30
withPhoneHome(string $phone)
Definition: Data.php:268
withLastname(string $lastname)
Definition: Data.php:112
withPhoneMobile(string $phone)
Definition: Data.php:280
withFirstname(string $firstname)
Definition: Data.php:100
array $system_information
Definition: Data.php:28
withTitle(string $title)
Definition: Data.php:124
withMatriculation(string $matriculation)
Definition: Data.php:304
$c
Definition: deliver.php:25
Interface ilDBInterface.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...