Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
92.00% covered (success)
92.00%
46 / 50
50.00% covered (danger)
50.00%
4 / 8
CRAP
0.00% covered (danger)
0.00%
0 / 1
ThinnedProcess
92.00% covered (success)
92.00%
46 / 50
50.00% covered (danger)
50.00%
4 / 8
9.04
0.00% covered (danger)
0.00%
0 / 1
 __construct
100.00% covered (success)
100.00%
21 / 21
100.00% covered (success)
100.00%
1 / 1
1
 toArray
100.00% covered (success)
100.00%
22 / 22
100.00% covered (success)
100.00%
1 / 1
1
 setCaptchaToken
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getCaptchaToken
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setIcsContent
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getIcsContent
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 ensureValid
50.00% covered (danger)
50.00%
1 / 2
0.00% covered (danger)
0.00%
0 / 1
2.50
 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\ThinnedScope;
8use BO\Zmsentities\Schema\Entity;
9use InvalidArgumentException;
10use JsonSerializable;
11
12class 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    public function getCaptchaToken(): ?string
93    {
94        return $this->captchaToken;
95    }
96
97    public function setIcsContent(string $icsContent): void
98    {
99        $this->icsContent = $icsContent;
100    }
101
102    public function getIcsContent(): ?string
103    {
104        return $this->icsContent;
105    }
106
107    private function ensureValid()
108    {
109        if (!$this->testValid()) {
110            throw new InvalidArgumentException("The provided data is invalid according to the schema.");
111        }
112    }
113
114    #[\Override]
115    public function jsonSerialize(): mixed
116    {
117        return $this->toArray();
118    }
119}