Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
91.53% |
54 / 59 |
|
76.19% |
16 / 21 |
CRAP | |
0.00% |
0 / 1 |
ThinnedScope | |
91.53% |
54 / 59 |
|
76.19% |
16 / 21 |
22.29 | |
0.00% |
0 / 1 |
__construct | |
100.00% |
19 / 19 |
|
100.00% |
1 / 1 |
1 | |||
ensureValid | |
50.00% |
1 / 2 |
|
0.00% |
0 / 1 |
2.50 | |||
getProvider | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getShortName | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getEmailFrom | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getEmailRequired | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getTelephoneActivated | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getTelephoneRequired | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getCustomTextfieldActivated | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getCustomTextfieldRequired | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getCustomTextfieldLabel | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getCustomTextfield2Activated | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getCustomTextfield2Required | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getCustomTextfield2Label | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getCaptchaActivatedRequired | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getDisplayInfo | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getSlotsPerAppointment | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getAppointmentsPerMail | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getWhitelistedMails | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
toArray | |
100.00% |
20 / 20 |
|
100.00% |
1 / 1 |
1 | |||
jsonSerialize | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | declare(strict_types=1); |
4 | |
5 | namespace BO\Zmscitizenapi\Models; |
6 | |
7 | use BO\Zmscitizenapi\Models\ThinnedProvider; |
8 | use BO\Zmsentities\Schema\Entity; |
9 | use InvalidArgumentException; |
10 | use JsonSerializable; |
11 | |
12 | class ThinnedScope extends Entity implements JsonSerializable |
13 | { |
14 | public static $schema = 'citizenapi/thinnedScope.json'; |
15 | public int $id; |
16 | public ?ThinnedProvider $provider; |
17 | public ?string $shortName; |
18 | public ?string $emailFrom; |
19 | public ?bool $emailRequired; |
20 | public ?bool $telephoneActivated; |
21 | public ?bool $telephoneRequired; |
22 | public ?bool $customTextfieldActivated; |
23 | public ?bool $customTextfieldRequired; |
24 | public ?string $customTextfieldLabel; |
25 | public ?bool $customTextfield2Activated; |
26 | public ?bool $customTextfield2Required; |
27 | public ?string $customTextfield2Label; |
28 | public ?bool $captchaActivatedRequired; |
29 | public ?string $displayInfo; |
30 | public ?string $slotsPerAppointment; |
31 | public ?string $appointmentsPerMail; |
32 | public ?string $whitelistedMails; |
33 | |
34 | public function __construct(int $id = 0, ?ThinnedProvider $provider = null, ?string $shortName = null, ?string $emailFrom = null, ?bool $emailRequired = null, ?bool $telephoneActivated = null, ?bool $telephoneRequired = null, ?bool $customTextfieldActivated = null, ?bool $customTextfieldRequired = null, ?string $customTextfieldLabel = null, ?bool $customTextfield2Activated = null, ?bool $customTextfield2Required = null, ?string $customTextfield2Label = null, ?bool $captchaActivatedRequired = null, ?string $displayInfo = null, ?string $slotsPerAppointment = null, ?string $appointmentsPerMail = null, ?string $whitelistedMails = null) |
35 | { |
36 | $this->id = $id; |
37 | $this->provider = $provider; |
38 | $this->shortName = $shortName; |
39 | $this->emailFrom = $emailFrom; |
40 | $this->emailRequired = $emailRequired; |
41 | $this->telephoneActivated = $telephoneActivated; |
42 | $this->telephoneRequired = $telephoneRequired; |
43 | $this->customTextfieldActivated = $customTextfieldActivated; |
44 | $this->customTextfieldRequired = $customTextfieldRequired; |
45 | $this->customTextfieldLabel = $customTextfieldLabel; |
46 | $this->customTextfield2Activated = $customTextfield2Activated; |
47 | $this->customTextfield2Required = $customTextfield2Required; |
48 | $this->customTextfield2Label = $customTextfield2Label; |
49 | $this->captchaActivatedRequired = $captchaActivatedRequired; |
50 | $this->displayInfo = $displayInfo; |
51 | $this->slotsPerAppointment = $slotsPerAppointment; |
52 | $this->appointmentsPerMail = $appointmentsPerMail; |
53 | $this->whitelistedMails = $whitelistedMails; |
54 | $this->ensureValid(); |
55 | } |
56 | |
57 | private function ensureValid() |
58 | { |
59 | if (!$this->testValid()) { |
60 | throw new InvalidArgumentException("The provided data is invalid according to the schema."); |
61 | } |
62 | } |
63 | |
64 | public function getProvider(): ?ThinnedProvider |
65 | { |
66 | return $this->provider; |
67 | } |
68 | |
69 | public function getShortName(): ?string |
70 | { |
71 | return $this->shortName; |
72 | } |
73 | |
74 | public function getEmailFrom(): ?string |
75 | { |
76 | return $this->emailFrom; |
77 | } |
78 | |
79 | public function getEmailRequired(): ?bool |
80 | { |
81 | return $this->emailRequired; |
82 | } |
83 | |
84 | public function getTelephoneActivated(): ?bool |
85 | { |
86 | return $this->telephoneActivated; |
87 | } |
88 | |
89 | public function getTelephoneRequired(): ?bool |
90 | { |
91 | return $this->telephoneRequired; |
92 | } |
93 | |
94 | public function getCustomTextfieldActivated(): ?bool |
95 | { |
96 | return $this->customTextfieldActivated; |
97 | } |
98 | |
99 | public function getCustomTextfieldRequired(): ?bool |
100 | { |
101 | return $this->customTextfieldRequired; |
102 | } |
103 | |
104 | public function getCustomTextfieldLabel(): ?string |
105 | { |
106 | return $this->customTextfieldLabel; |
107 | } |
108 | |
109 | public function getCustomTextfield2Activated(): ?bool |
110 | { |
111 | return $this->customTextfield2Activated; |
112 | } |
113 | |
114 | public function getCustomTextfield2Required(): ?bool |
115 | { |
116 | return $this->customTextfield2Required; |
117 | } |
118 | |
119 | public function getCustomTextfield2Label(): ?string |
120 | { |
121 | return $this->customTextfield2Label; |
122 | } |
123 | |
124 | public function getCaptchaActivatedRequired(): ?bool |
125 | { |
126 | return $this->captchaActivatedRequired; |
127 | } |
128 | |
129 | public function getDisplayInfo(): ?string |
130 | { |
131 | return $this->displayInfo; |
132 | } |
133 | |
134 | public function getSlotsPerAppointment(): ?string |
135 | { |
136 | return $this->slotsPerAppointment; |
137 | } |
138 | |
139 | public function getAppointmentsPerMail(): ?string |
140 | { |
141 | return $this->appointmentsPerMail; |
142 | } |
143 | |
144 | public function getWhitelistedMails(): ?string |
145 | { |
146 | return $this->whitelistedMails; |
147 | } |
148 | |
149 | public function toArray(): array |
150 | { |
151 | return [ |
152 | 'id' => $this->id, |
153 | 'provider' => $this->provider, |
154 | 'shortName' => $this->shortName, |
155 | 'emailFrom' => $this->emailFrom, |
156 | 'emailRequired' => $this->emailRequired, |
157 | 'telephoneActivated' => $this->telephoneActivated, |
158 | 'telephoneRequired' => $this->telephoneRequired, |
159 | 'customTextfieldActivated' => $this->customTextfieldActivated, |
160 | 'customTextfieldRequired' => $this->customTextfieldRequired, |
161 | 'customTextfieldLabel' => $this->customTextfieldLabel, |
162 | 'customTextfield2Activated' => $this->customTextfield2Activated, |
163 | 'customTextfield2Required' => $this->customTextfield2Required, |
164 | 'customTextfield2Label' => $this->customTextfield2Label, |
165 | 'captchaActivatedRequired' => $this->captchaActivatedRequired, |
166 | 'displayInfo' => $this->displayInfo, |
167 | 'slotsPerAppointment' => $this->slotsPerAppointment, |
168 | 'appointmentsPerMail' => $this->appointmentsPerMail, |
169 | 'whitelistedMails' => $this->whitelistedMails, |
170 | ]; |
171 | } |
172 | |
173 | public function jsonSerialize(): mixed |
174 | { |
175 | return $this->toArray(); |
176 | } |
177 | } |