| Code Coverage | ||||||||||
| Lines | Functions and Methods | Classes and Traits | ||||||||
| Total |  | 91.67% | 44 / 48 |  | 50.00% | 4 / 8 | CRAP |  | 0.00% | 0 / 1 | 
| ThinnedProcess |  | 91.67% | 44 / 48 |  | 50.00% | 4 / 8 | 9.05 |  | 0.00% | 0 / 1 | 
| __construct |  | 100.00% | 20 / 20 |  | 100.00% | 1 / 1 | 1 | |||
| toArray |  | 100.00% | 21 / 21 |  | 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 | |||
| 1 | <?php | 
| 2 | |
| 3 | declare(strict_types=1); | 
| 4 | |
| 5 | namespace BO\Zmscitizenapi\Models; | 
| 6 | |
| 7 | use BO\Zmscitizenapi\Models\ThinnedScope; | 
| 8 | use BO\Zmsentities\Schema\Entity; | 
| 9 | use InvalidArgumentException; | 
| 10 | use JsonSerializable; | 
| 11 | |
| 12 | class ThinnedProcess extends Entity implements JsonSerializable | 
| 13 | { | 
| 14 | public static $schema = "citizenapi/thinnedProcess.json"; | 
| 15 | /** @var int|null */ | 
| 16 | public ?int $processId; | 
| 17 | /** @var string|null */ | 
| 18 | public ?string $timestamp; | 
| 19 | /** @var string|null */ | 
| 20 | public ?string $authKey; | 
| 21 | /** @var string|null */ | 
| 22 | public ?string $familyName; | 
| 23 | /** @var string|null */ | 
| 24 | public ?string $customTextfield; | 
| 25 | /** @var string|null */ | 
| 26 | public ?string $customTextfield2; | 
| 27 | /** @var string|null */ | 
| 28 | public ?string $email; | 
| 29 | /** @var string|null */ | 
| 30 | public ?string $telephone; | 
| 31 | /** @var string|null */ | 
| 32 | public ?string $officeName; | 
| 33 | /** @var int|null */ | 
| 34 | public ?int $officeId; | 
| 35 | /** @var ThinnedScope|null */ | 
| 36 | public ?ThinnedScope $scope; | 
| 37 | /** @var array */ | 
| 38 | public array $subRequestCounts; | 
| 39 | /** @var int|null */ | 
| 40 | public ?int $serviceId; | 
| 41 | /** @var string|null */ | 
| 42 | public ?string $serviceName; | 
| 43 | /** @var int */ | 
| 44 | public int $serviceCount; | 
| 45 | /** @var string|null */ | 
| 46 | public ?string $status; | 
| 47 | /** @var string|null */ | 
| 48 | public ?string $captchaToken; | 
| 49 | /** @var int|null */ | 
| 50 | public ?int $slotCount; | 
| 51 | /** @var string|null */ | 
| 52 | public ?string $icsContent; | 
| 53 | |
| 54 | 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 $icsContent = null) | 
| 55 | { | 
| 56 | $this->processId = $processId; | 
| 57 | $this->timestamp = $timestamp; | 
| 58 | $this->authKey = $authKey; | 
| 59 | $this->familyName = $familyName; | 
| 60 | $this->customTextfield = $customTextfield; | 
| 61 | $this->customTextfield2 = $customTextfield2; | 
| 62 | $this->email = $email; | 
| 63 | $this->telephone = $telephone; | 
| 64 | $this->officeName = $officeName; | 
| 65 | $this->officeId = $officeId; | 
| 66 | $this->scope = $scope; | 
| 67 | $this->subRequestCounts = $subRequestCounts; | 
| 68 | $this->serviceId = $serviceId; | 
| 69 | $this->serviceName = $serviceName; | 
| 70 | $this->serviceCount = $serviceCount; | 
| 71 | $this->status = $status; | 
| 72 | $this->captchaToken = $captchaToken; | 
| 73 | $this->slotCount = $slotCount; | 
| 74 | $this->icsContent = $icsContent; | 
| 75 | $this->ensureValid(); | 
| 76 | } | 
| 77 | |
| 78 | /** | 
| 79 | * Convert the ThinnedProcess object to an array. | 
| 80 | * | 
| 81 | * @return array | 
| 82 | */ | 
| 83 | public function toArray(): array | 
| 84 | { | 
| 85 | return [ | 
| 86 | 'processId' => $this->processId ?? null, | 
| 87 | 'timestamp' => $this->timestamp ?? null, | 
| 88 | 'authKey' => $this->authKey ?? null, | 
| 89 | 'familyName' => $this->familyName ?? null, | 
| 90 | 'customTextfield' => $this->customTextfield ?? null, | 
| 91 | 'customTextfield2' => $this->customTextfield2 ?? null, | 
| 92 | 'email' => $this->email ?? null, | 
| 93 | 'telephone' => $this->telephone ?? null, | 
| 94 | 'officeName' => $this->officeName ?? null, | 
| 95 | 'officeId' => $this->officeId ?? null, | 
| 96 | 'scope' => $this->scope ?? null, | 
| 97 | 'subRequestCounts' => $this->subRequestCounts, | 
| 98 | 'serviceId' => $this->serviceId ?? null, | 
| 99 | 'serviceName' => $this->serviceName ?? null, | 
| 100 | 'serviceCount' => $this->serviceCount, | 
| 101 | 'status' => $this->status ?? null, | 
| 102 | 'captchaToken' => $this->captchaToken ?? null, | 
| 103 | 'slotCount' => $this->slotCount ?? null, | 
| 104 | 'icsContent' => $this->icsContent ?? null | 
| 105 | ]; | 
| 106 | } | 
| 107 | |
| 108 | public function setCaptchaToken(string $token): void | 
| 109 | { | 
| 110 | $this->captchaToken = $token; | 
| 111 | } | 
| 112 | |
| 113 | public function getCaptchaToken(): ?string | 
| 114 | { | 
| 115 | return $this->captchaToken; | 
| 116 | } | 
| 117 | |
| 118 | public function setIcsContent(string $icsContent): void | 
| 119 | { | 
| 120 | $this->icsContent = $icsContent; | 
| 121 | } | 
| 122 | |
| 123 | public function getIcsContent(): ?string | 
| 124 | { | 
| 125 | return $this->icsContent; | 
| 126 | } | 
| 127 | |
| 128 | private function ensureValid() | 
| 129 | { | 
| 130 | if (!$this->testValid()) { | 
| 131 | throw new InvalidArgumentException("The provided data is invalid according to the schema."); | 
| 132 | } | 
| 133 | } | 
| 134 | |
| 135 | public function jsonSerialize(): mixed | 
| 136 | { | 
| 137 | return $this->toArray(); | 
| 138 | } | 
| 139 | } |