Lines
92.00%
46 / 50
Methods
50.00%
4 / 8
Classes
0.00%
0 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| __construct | 100.00% | 21 / 21 | 100.00% | 1 / 1 | 1 | ||
| toArray | 100.00% | 22 / 22 | 100.00% | 1 / 1 | 1 | ||
| setCaptchaToken | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| getCaptchaToken | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | ||
| setIcsContent | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | ||
| getIcsContent | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | ||
| ensureValid | 50.00% | 1 / 2 | 0.00% | 0 / 1 | 2.50 | ||
| jsonSerialize | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| 12 | class ThinnedProcess extends Entity implements JsonSerializable | |
| 13 | { | |
| 14 | public static $schema = "citizenapi/thinnedProcess.json"; | |
| 15 | public ?int $processId; | |
| 16 | public ?string $timestamp; | |
| 17 | public ?string $authKey; | |
| 18 | public ?string $familyName; | |
| 19 | public ?string $customTextfield; | |
| 20 | public ?string $customTextfield2; | |
| 21 | public ?string $email; | |
| 22 | public ?string $telephone; | |
| 23 | public ?string $officeName; | |
| 24 | public ?int $officeId; | |
| 25 | public ?ThinnedScope $scope; | |
| 26 | public array $subRequestCounts; | |
| 27 | public ?int $serviceId; | |
| 28 | public ?string $serviceName; | |
| 29 | public int $serviceCount; | |
| 30 | public ?string $status; | |
| 31 | public ?string $captchaToken; | |
| 32 | public ?int $slotCount; | |
| 33 | public ?string $displayNumber; | |
| 34 | public ?string $icsContent; | |
| 35 | ||
| 36 | public function __construct(?int $processId = null, ?string $timestamp = null, ?string $authKey = null, ?string $familyName = null, ?string $customTextfield = null, ?string $customTextfield2 = null, ?string $email = null, ?string $telephone = null, ?string $officeName = null, ?int $officeId = null, ?ThinnedScope $scope = null, array $subRequestCounts = [], ?int $serviceId = null, ?string $serviceName = null, int $serviceCount = 0, ?string $status = null, ?string $captchaToken = null, ?int $slotCount = null, ?string $displayNumber = null, ?string $icsContent = null) | |
| 37 | { | |
| 38 | $this->processId = $processId; | |
| 39 | $this->timestamp = $timestamp; | |
| 40 | $this->authKey = $authKey; | |
| 41 | $this->familyName = $familyName; | |
| 42 | $this->customTextfield = $customTextfield; | |
| 43 | $this->customTextfield2 = $customTextfield2; | |
| 44 | $this->email = $email; | |
| 45 | $this->telephone = $telephone; | |
| 46 | $this->officeName = $officeName; | |
| 47 | $this->officeId = $officeId; | |
| 48 | $this->scope = $scope; | |
| 49 | $this->subRequestCounts = $subRequestCounts; | |
| 50 | $this->serviceId = $serviceId; | |
| 51 | $this->serviceName = $serviceName; | |
| 52 | $this->serviceCount = $serviceCount; | |
| 53 | $this->status = $status; | |
| 54 | $this->captchaToken = $captchaToken; | |
| 55 | $this->slotCount = $slotCount; | |
| 56 | $this->displayNumber = $displayNumber; | |
| 57 | $this->icsContent = $icsContent; | |
| 58 | $this->ensureValid(); | |
| 59 | } | |
| 60 | ||
| 61 | public function toArray(): array | |
| 62 | { | |
| 63 | return [ | |
| 64 | 'processId' => $this->processId ?? null, | |
| 65 | 'timestamp' => $this->timestamp ?? null, | |
| 66 | 'authKey' => $this->authKey ?? null, | |
| 67 | 'familyName' => $this->familyName ?? null, | |
| 68 | 'customTextfield' => $this->customTextfield ?? null, | |
| 69 | 'customTextfield2' => $this->customTextfield2 ?? null, | |
| 70 | 'email' => $this->email ?? null, | |
| 71 | 'telephone' => $this->telephone ?? null, | |
| 72 | 'officeName' => $this->officeName ?? null, | |
| 73 | 'officeId' => $this->officeId ?? null, | |
| 74 | 'scope' => $this->scope ?? null, | |
| 75 | 'subRequestCounts' => $this->subRequestCounts, | |
| 76 | 'serviceId' => $this->serviceId ?? null, | |
| 77 | 'serviceName' => $this->serviceName ?? null, | |
| 78 | 'serviceCount' => $this->serviceCount, | |
| 79 | 'status' => $this->status ?? null, | |
| 80 | 'captchaToken' => $this->captchaToken ?? null, | |
| 81 | 'slotCount' => $this->slotCount ?? null, | |
| 82 | 'displayNumber' => $this->displayNumber ?? null, | |
| 83 | 'icsContent' => $this->icsContent ?? null | |
| 84 | ]; | |
| 85 | } | |
| 86 | ||
| 87 | public function setCaptchaToken(string $token): void | |
| 88 | { | |
| 89 | $this->captchaToken = $token; | |
| 90 | } | |
| 91 | ||
| 92 | /** @psalm-api */ | |
| 93 | public function getCaptchaToken(): ?string | |
| 94 | { | |
| 95 | return $this->captchaToken; | |
| 96 | } | |
| 97 | ||
| 98 | /** @psalm-api */ | |
| 99 | public function setIcsContent(string $icsContent): void | |
| 100 | { | |
| 101 | $this->icsContent = $icsContent; | |
| 102 | } | |
| 103 | ||
| 104 | /** @psalm-api */ | |
| 105 | public function getIcsContent(): ?string | |
| 106 | { | |
| 107 | return $this->icsContent; | |
| 108 | } | |
| 109 | ||
| 110 | /** | |
| 111 | * @return void | |
| 112 | */ | |
| 113 | private function ensureValid() | |
| 114 | { | |
| 115 | if (!$this->testValid()) { | |
| 116 | throw new InvalidArgumentException("The provided data is invalid according to the schema."); | |
| 117 | } | |
| 118 | } | |
| 119 | ||
| 120 | #[\Override] | |
| 121 | public function jsonSerialize(): mixed | |
| 122 | { | |
| 123 | return $this->toArray(); | |
| 124 | } | |
| 125 | } |