Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
90.14% |
64 / 71 |
|
72.00% |
18 / 25 |
CRAP | |
0.00% |
0 / 1 |
| ThinnedScope | |
90.14% |
64 / 71 |
|
72.00% |
18 / 25 |
26.65 | |
0.00% |
0 / 1 |
| __construct | |
100.00% |
23 / 23 |
|
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 | |||
| getInfoForAppointment | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getInfoForAllAppointments | |
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 | |||
| getReservationDuration | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getActivationDuration | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getHint | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| toArray | |
100.00% |
24 / 24 |
|
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 $infoForAppointment; |
| 30 | public ?string $infoForAllAppointments; |
| 31 | public ?string $slotsPerAppointment; |
| 32 | public ?string $appointmentsPerMail; |
| 33 | public ?string $whitelistedMails; |
| 34 | public ?int $reservationDuration; |
| 35 | public ?int $activationDuration; |
| 36 | public ?string $hint; |
| 37 | |
| 38 | 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 $infoForAppointment = null, ?string $infoForAllAppointments = null, ?string $slotsPerAppointment = null, ?string $appointmentsPerMail = null, ?string $whitelistedMails = null, ?int $reservationDuration = null, ?int $activationDuration = null, ?string $hint = null) |
| 39 | { |
| 40 | $this->id = $id; |
| 41 | $this->provider = $provider; |
| 42 | $this->shortName = $shortName; |
| 43 | $this->emailFrom = $emailFrom; |
| 44 | $this->emailRequired = $emailRequired; |
| 45 | $this->telephoneActivated = $telephoneActivated; |
| 46 | $this->telephoneRequired = $telephoneRequired; |
| 47 | $this->customTextfieldActivated = $customTextfieldActivated; |
| 48 | $this->customTextfieldRequired = $customTextfieldRequired; |
| 49 | $this->customTextfieldLabel = $customTextfieldLabel; |
| 50 | $this->customTextfield2Activated = $customTextfield2Activated; |
| 51 | $this->customTextfield2Required = $customTextfield2Required; |
| 52 | $this->customTextfield2Label = $customTextfield2Label; |
| 53 | $this->captchaActivatedRequired = $captchaActivatedRequired; |
| 54 | $this->infoForAppointment = $infoForAppointment; |
| 55 | $this->infoForAllAppointments = $infoForAllAppointments; |
| 56 | $this->slotsPerAppointment = $slotsPerAppointment; |
| 57 | $this->appointmentsPerMail = $appointmentsPerMail; |
| 58 | $this->whitelistedMails = $whitelistedMails; |
| 59 | $this->reservationDuration = $reservationDuration; |
| 60 | $this->activationDuration = $activationDuration; |
| 61 | $this->hint = $hint; |
| 62 | $this->ensureValid(); |
| 63 | } |
| 64 | |
| 65 | private function ensureValid() |
| 66 | { |
| 67 | if (!$this->testValid()) { |
| 68 | throw new InvalidArgumentException("The provided data is invalid according to the schema."); |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | public function getProvider(): ?ThinnedProvider |
| 73 | { |
| 74 | return $this->provider; |
| 75 | } |
| 76 | |
| 77 | public function getShortName(): ?string |
| 78 | { |
| 79 | return $this->shortName; |
| 80 | } |
| 81 | |
| 82 | public function getEmailFrom(): ?string |
| 83 | { |
| 84 | return $this->emailFrom; |
| 85 | } |
| 86 | |
| 87 | public function getEmailRequired(): ?bool |
| 88 | { |
| 89 | return $this->emailRequired; |
| 90 | } |
| 91 | |
| 92 | public function getTelephoneActivated(): ?bool |
| 93 | { |
| 94 | return $this->telephoneActivated; |
| 95 | } |
| 96 | |
| 97 | public function getTelephoneRequired(): ?bool |
| 98 | { |
| 99 | return $this->telephoneRequired; |
| 100 | } |
| 101 | |
| 102 | public function getCustomTextfieldActivated(): ?bool |
| 103 | { |
| 104 | return $this->customTextfieldActivated; |
| 105 | } |
| 106 | |
| 107 | public function getCustomTextfieldRequired(): ?bool |
| 108 | { |
| 109 | return $this->customTextfieldRequired; |
| 110 | } |
| 111 | |
| 112 | public function getCustomTextfieldLabel(): ?string |
| 113 | { |
| 114 | return $this->customTextfieldLabel; |
| 115 | } |
| 116 | |
| 117 | public function getCustomTextfield2Activated(): ?bool |
| 118 | { |
| 119 | return $this->customTextfield2Activated; |
| 120 | } |
| 121 | |
| 122 | public function getCustomTextfield2Required(): ?bool |
| 123 | { |
| 124 | return $this->customTextfield2Required; |
| 125 | } |
| 126 | |
| 127 | public function getCustomTextfield2Label(): ?string |
| 128 | { |
| 129 | return $this->customTextfield2Label; |
| 130 | } |
| 131 | |
| 132 | public function getCaptchaActivatedRequired(): ?bool |
| 133 | { |
| 134 | return $this->captchaActivatedRequired; |
| 135 | } |
| 136 | |
| 137 | public function getInfoForAppointment(): ?string |
| 138 | { |
| 139 | return $this->infoForAppointment; |
| 140 | } |
| 141 | |
| 142 | public function getInfoForAllAppointments(): ?string |
| 143 | { |
| 144 | return $this->infoForAllAppointments; |
| 145 | } |
| 146 | |
| 147 | public function getSlotsPerAppointment(): ?string |
| 148 | { |
| 149 | return $this->slotsPerAppointment; |
| 150 | } |
| 151 | |
| 152 | public function getAppointmentsPerMail(): ?string |
| 153 | { |
| 154 | return $this->appointmentsPerMail; |
| 155 | } |
| 156 | |
| 157 | public function getWhitelistedMails(): ?string |
| 158 | { |
| 159 | return $this->whitelistedMails; |
| 160 | } |
| 161 | |
| 162 | public function getReservationDuration(): ?int |
| 163 | { |
| 164 | return $this->reservationDuration; |
| 165 | } |
| 166 | |
| 167 | public function getActivationDuration(): ?int |
| 168 | { |
| 169 | return $this->activationDuration; |
| 170 | } |
| 171 | |
| 172 | public function getHint(): ?string |
| 173 | { |
| 174 | return $this->hint; |
| 175 | } |
| 176 | |
| 177 | public function toArray(): array |
| 178 | { |
| 179 | return [ |
| 180 | 'id' => $this->id, |
| 181 | 'provider' => $this->provider, |
| 182 | 'shortName' => $this->shortName, |
| 183 | 'emailFrom' => $this->emailFrom, |
| 184 | 'emailRequired' => $this->emailRequired, |
| 185 | 'telephoneActivated' => $this->telephoneActivated, |
| 186 | 'telephoneRequired' => $this->telephoneRequired, |
| 187 | 'customTextfieldActivated' => $this->customTextfieldActivated, |
| 188 | 'customTextfieldRequired' => $this->customTextfieldRequired, |
| 189 | 'customTextfieldLabel' => $this->customTextfieldLabel, |
| 190 | 'customTextfield2Activated' => $this->customTextfield2Activated, |
| 191 | 'customTextfield2Required' => $this->customTextfield2Required, |
| 192 | 'customTextfield2Label' => $this->customTextfield2Label, |
| 193 | 'captchaActivatedRequired' => $this->captchaActivatedRequired, |
| 194 | 'infoForAppointment' => $this->infoForAppointment, |
| 195 | 'infoForAllAppointments' => $this->infoForAllAppointments, |
| 196 | 'slotsPerAppointment' => $this->slotsPerAppointment, |
| 197 | 'appointmentsPerMail' => $this->appointmentsPerMail, |
| 198 | 'whitelistedMails' => $this->whitelistedMails, |
| 199 | 'reservationDuration' => $this->reservationDuration, |
| 200 | 'activationDuration' => $this->activationDuration, |
| 201 | 'hint' => $this->hint |
| 202 | ]; |
| 203 | } |
| 204 | |
| 205 | public function jsonSerialize(): mixed |
| 206 | { |
| 207 | return $this->toArray(); |
| 208 | } |
| 209 | } |