forked from OS2Forms/os2forms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPatron.php
More file actions
63 lines (58 loc) · 1.98 KB
/
Patron.php
File metadata and controls
63 lines (58 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
namespace Drupal\os2forms_fbs_handler\Client\Model;
/**
* Wrapper class to represent and patron.
*/
final class Patron {
/**
* Default constructor.
*
* @phpstan-param array<mixed>|null $notificationProtocols
* @phpstan-param array<mixed>|null $onHold
* @phpstan-param array<mixed>|null $emailAddresses
*/
public function __construct(
public readonly ?string $patronId = NULL,
public readonly ?bool $receiveSms = FALSE,
public readonly ?bool $receivePostalMail = FALSE,
public readonly ?array $notificationProtocols = NULL,
public readonly ?array $onHold = NULL,
public readonly ?string $preferredLanguage = NULL,
public readonly ?bool $guardianVisibility = NULL,
public readonly ?int $defaultInterestPeriod = NULL,
public readonly ?bool $resident = NULL,
// Allow these properties below to be updatable.
public ?string $phoneNumber = NULL,
public ?array $emailAddresses = NULL,
public ?bool $receiveEmail = NULL,
public ?string $preferredPickupBranch = NULL,
public ?string $personId = NULL,
public ?string $pincode = NULL,
) {
}
/**
* Convert object to array with fields required in FBS.
*
* @return array
* Array with field required by FBS calls.
*
* @phpstan-return array<string, string>
*/
public function toArray(): array {
return [
'patronId' => $this->patronId,
'receiveEmail' => $this->receiveEmail,
'receiveSms' => $this->receiveSms,
'receivePostalMail' => $this->receivePostalMail,
'emailAddresses' => $this->emailAddresses,
'notificationProtocols' => $this->notificationProtocols,
'phoneNumber' => $this->phoneNumber,
'preferredPickupBranch' => $this->preferredPickupBranch,
'onHold' => $this->onHold,
'preferredLanguage' => $this->preferredLanguage,
'guardianVisibility' => $this->guardianVisibility,
'defaultInterestPeriod' => $this->defaultInterestPeriod,
'resident' => $this->resident,
];
}
}