Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
90.14% covered (success)
90.14%
64 / 71
72.00% covered (warning)
72.00%
18 / 25
CRAP
0.00% covered (danger)
0.00%
0 / 1
ThinnedScope
90.14% covered (success)
90.14%
64 / 71
72.00% covered (warning)
72.00%
18 / 25
26.65
0.00% covered (danger)
0.00%
0 / 1
 __construct
100.00% covered (success)
100.00%
23 / 23
100.00% covered (success)
100.00%
1 / 1
1
 ensureValid
50.00% covered (danger)
50.00%
1 / 2
0.00% covered (danger)
0.00%
0 / 1
2.50
 getProvider
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getShortName
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getEmailFrom
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getEmailRequired
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getTelephoneActivated
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getTelephoneRequired
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getCustomTextfieldActivated
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getCustomTextfieldRequired
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getCustomTextfieldLabel
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getCustomTextfield2Activated
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getCustomTextfield2Required
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getCustomTextfield2Label
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getCaptchaActivatedRequired
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getInfoForAppointment
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getInfoForAllAppointments
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getSlotsPerAppointment
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getAppointmentsPerMail
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getWhitelistedMails
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getReservationDuration
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getActivationDuration
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getHint
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 toArray
100.00% covered (success)
100.00%
24 / 24
100.00% covered (success)
100.00%
1 / 1
1
 jsonSerialize
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace BO\Zmscitizenapi\Models;
6
7use BO\Zmscitizenapi\Models\ThinnedProvider;
8use BO\Zmsentities\Schema\Entity;
9use InvalidArgumentException;
10use JsonSerializable;
11
12class 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    /**
66     * @return void
67     */
68    private function ensureValid()
69    {
70        if (!$this->testValid()) {
71            throw new InvalidArgumentException("The provided data is invalid according to the schema.");
72        }
73    }
74
75    /** @psalm-api */
76    public function getProvider(): ?ThinnedProvider
77    {
78        return $this->provider;
79    }
80
81    /** @psalm-api */
82    public function getShortName(): ?string
83    {
84        return $this->shortName;
85    }
86
87    public function getEmailFrom(): ?string
88    {
89        return $this->emailFrom;
90    }
91
92    public function getEmailRequired(): ?bool
93    {
94        return $this->emailRequired;
95    }
96
97    public function getTelephoneActivated(): ?bool
98    {
99        return $this->telephoneActivated;
100    }
101
102    public function getTelephoneRequired(): ?bool
103    {
104        return $this->telephoneRequired;
105    }
106
107    public function getCustomTextfieldActivated(): ?bool
108    {
109        return $this->customTextfieldActivated;
110    }
111
112    public function getCustomTextfieldRequired(): ?bool
113    {
114        return $this->customTextfieldRequired;
115    }
116
117    public function getCustomTextfieldLabel(): ?string
118    {
119        return $this->customTextfieldLabel;
120    }
121
122    public function getCustomTextfield2Activated(): ?bool
123    {
124        return $this->customTextfield2Activated;
125    }
126
127    public function getCustomTextfield2Required(): ?bool
128    {
129        return $this->customTextfield2Required;
130    }
131
132    public function getCustomTextfield2Label(): ?string
133    {
134        return $this->customTextfield2Label;
135    }
136
137    /** @psalm-api */
138    public function getCaptchaActivatedRequired(): ?bool
139    {
140        return $this->captchaActivatedRequired;
141    }
142
143    /** @psalm-api */
144    public function getInfoForAppointment(): ?string
145    {
146        return $this->infoForAppointment;
147    }
148
149    /** @psalm-api */
150    public function getInfoForAllAppointments(): ?string
151    {
152        return $this->infoForAllAppointments;
153    }
154
155    public function getSlotsPerAppointment(): ?string
156    {
157        return $this->slotsPerAppointment;
158    }
159
160    public function getAppointmentsPerMail(): ?string
161    {
162        return $this->appointmentsPerMail;
163    }
164
165    public function getWhitelistedMails(): ?string
166    {
167        return $this->whitelistedMails;
168    }
169
170    public function getReservationDuration(): ?int
171    {
172        return $this->reservationDuration;
173    }
174
175    public function getActivationDuration(): ?int
176    {
177        return $this->activationDuration;
178    }
179
180    /** @psalm-api */
181    public function getHint(): ?string
182    {
183        return $this->hint;
184    }
185
186    public function toArray(): array
187    {
188        return [
189            'id' => $this->id,
190            'provider' => $this->provider,
191            'shortName' => $this->shortName,
192            'emailFrom' => $this->emailFrom,
193            'emailRequired' => $this->emailRequired,
194            'telephoneActivated' => $this->telephoneActivated,
195            'telephoneRequired' => $this->telephoneRequired,
196            'customTextfieldActivated' => $this->customTextfieldActivated,
197            'customTextfieldRequired' => $this->customTextfieldRequired,
198            'customTextfieldLabel' => $this->customTextfieldLabel,
199            'customTextfield2Activated' => $this->customTextfield2Activated,
200            'customTextfield2Required' => $this->customTextfield2Required,
201            'customTextfield2Label' => $this->customTextfield2Label,
202            'captchaActivatedRequired' => $this->captchaActivatedRequired,
203            'infoForAppointment' => $this->infoForAppointment,
204            'infoForAllAppointments' => $this->infoForAllAppointments,
205            'slotsPerAppointment' => $this->slotsPerAppointment,
206            'appointmentsPerMail' => $this->appointmentsPerMail,
207            'whitelistedMails' => $this->whitelistedMails,
208            'reservationDuration' => $this->reservationDuration,
209            'activationDuration' => $this->activationDuration,
210            'hint' => $this->hint
211        ];
212    }
213
214    #[\Override]
215    public function jsonSerialize(): mixed
216    {
217        return $this->toArray();
218    }
219}