Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
90.57% |
48 / 53 |
|
73.68% |
14 / 19 |
CRAP | |
0.00% |
0 / 1 |
ThinnedScope | |
90.57% |
48 / 53 |
|
73.68% |
14 / 19 |
20.34 | |
0.00% |
0 / 1 |
__construct | |
100.00% |
17 / 17 |
|
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 | |||
toArray | |
100.00% |
18 / 18 |
|
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 | |
32 | 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) |
33 | { |
34 | $this->id = $id; |
35 | $this->provider = $provider; |
36 | $this->shortName = $shortName; |
37 | $this->emailFrom = $emailFrom; |
38 | $this->emailRequired = $emailRequired; |
39 | $this->telephoneActivated = $telephoneActivated; |
40 | $this->telephoneRequired = $telephoneRequired; |
41 | $this->customTextfieldActivated = $customTextfieldActivated; |
42 | $this->customTextfieldRequired = $customTextfieldRequired; |
43 | $this->customTextfieldLabel = $customTextfieldLabel; |
44 | $this->customTextfield2Activated = $customTextfield2Activated; |
45 | $this->customTextfield2Required = $customTextfield2Required; |
46 | $this->customTextfield2Label = $customTextfield2Label; |
47 | $this->captchaActivatedRequired = $captchaActivatedRequired; |
48 | $this->displayInfo = $displayInfo; |
49 | $this->slotsPerAppointment = $slotsPerAppointment; |
50 | $this->ensureValid(); |
51 | } |
52 | |
53 | private function ensureValid() |
54 | { |
55 | if (!$this->testValid()) { |
56 | throw new InvalidArgumentException("The provided data is invalid according to the schema."); |
57 | } |
58 | } |
59 | |
60 | public function getProvider(): ?ThinnedProvider |
61 | { |
62 | return $this->provider; |
63 | } |
64 | |
65 | public function getShortName(): ?string |
66 | { |
67 | return $this->shortName; |
68 | } |
69 | |
70 | public function getEmailFrom(): ?string |
71 | { |
72 | return $this->emailFrom; |
73 | } |
74 | |
75 | public function getEmailRequired(): ?bool |
76 | { |
77 | return $this->emailRequired; |
78 | } |
79 | |
80 | public function getTelephoneActivated(): ?bool |
81 | { |
82 | return $this->telephoneActivated; |
83 | } |
84 | |
85 | public function getTelephoneRequired(): ?bool |
86 | { |
87 | return $this->telephoneRequired; |
88 | } |
89 | |
90 | public function getCustomTextfieldActivated(): ?bool |
91 | { |
92 | return $this->customTextfieldActivated; |
93 | } |
94 | |
95 | public function getCustomTextfieldRequired(): ?bool |
96 | { |
97 | return $this->customTextfieldRequired; |
98 | } |
99 | |
100 | public function getCustomTextfieldLabel(): ?string |
101 | { |
102 | return $this->customTextfieldLabel; |
103 | } |
104 | |
105 | public function getCustomTextfield2Activated(): ?bool |
106 | { |
107 | return $this->customTextfield2Activated; |
108 | } |
109 | |
110 | public function getCustomTextfield2Required(): ?bool |
111 | { |
112 | return $this->customTextfield2Required; |
113 | } |
114 | |
115 | public function getCustomTextfield2Label(): ?string |
116 | { |
117 | return $this->customTextfield2Label; |
118 | } |
119 | |
120 | public function getCaptchaActivatedRequired(): ?bool |
121 | { |
122 | return $this->captchaActivatedRequired; |
123 | } |
124 | |
125 | public function getDisplayInfo(): ?string |
126 | { |
127 | return $this->displayInfo; |
128 | } |
129 | |
130 | public function getSlotsPerAppointment(): ?string |
131 | { |
132 | return $this->slotsPerAppointment; |
133 | } |
134 | |
135 | public function toArray(): array |
136 | { |
137 | return [ |
138 | 'id' => $this->id, |
139 | 'provider' => $this->provider, |
140 | 'shortName' => $this->shortName, |
141 | 'emailFrom' => $this->emailFrom, |
142 | 'emailRequired' => $this->emailRequired, |
143 | 'telephoneActivated' => $this->telephoneActivated, |
144 | 'telephoneRequired' => $this->telephoneRequired, |
145 | 'customTextfieldActivated' => $this->customTextfieldActivated, |
146 | 'customTextfieldRequired' => $this->customTextfieldRequired, |
147 | 'customTextfieldLabel' => $this->customTextfieldLabel, |
148 | 'customTextfield2Activated' => $this->customTextfield2Activated, |
149 | 'customTextfield2Required' => $this->customTextfield2Required, |
150 | 'customTextfield2Label' => $this->customTextfield2Label, |
151 | 'captchaActivatedRequired' => $this->captchaActivatedRequired, |
152 | 'displayInfo' => $this->displayInfo, |
153 | 'slotsPerAppointment' => $this->slotsPerAppointment, |
154 | ]; |
155 | } |
156 | |
157 | public function jsonSerialize(): mixed |
158 | { |
159 | return $this->toArray(); |
160 | } |
161 | } |