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/** @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 $displayNumber;
53/** @var string|null */
54    public ?string $icsContent;
55
56    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)
57    {
58        $this->processId = $processId;
59        $this->timestamp = $timestamp;
60        $this->authKey = $authKey;
61        $this->familyName = $familyName;
62        $this->customTextfield = $customTextfield;
63        $this->customTextfield2 = $customTextfield2;
64        $this->email = $email;
65        $this->telephone = $telephone;
66        $this->officeName = $officeName;
67        $this->officeId = $officeId;
68        $this->scope = $scope;
69        $this->subRequestCounts = $subRequestCounts;
70        $this->serviceId = $serviceId;
71        $this->serviceName = $serviceName;
72        $this->serviceCount = $serviceCount;
73        $this->status = $status;
74        $this->captchaToken = $captchaToken;
75        $this->slotCount = $slotCount;
76        $this->displayNumber = $displayNumber;
77        $this->icsContent = $icsContent;
78        $this->ensureValid();
79    }
80
81    /**
82     * Convert the ThinnedProcess object to an array.
83     *
84     * @return array
85     */
86    public function toArray(): array
87    {
88        return [
89            'processId' => $this->processId ?? null,
90            'timestamp' => $this->timestamp ?? null,
91            'authKey' => $this->authKey ?? null,
92            'familyName' => $this->familyName ?? null,
93            'customTextfield' => $this->customTextfield ?? null,
94            'customTextfield2' => $this->customTextfield2 ?? null,
95            'email' => $this->email ?? null,
96            'telephone' => $this->telephone ?? null,
97            'officeName' => $this->officeName ?? null,
98            'officeId' => $this->officeId ?? null,
99            'scope' => $this->scope ?? null,
100            'subRequestCounts' => $this->subRequestCounts,
101            'serviceId' => $this->serviceId ?? null,
102            'serviceName' => $this->serviceName ?? null,
103            'serviceCount' => $this->serviceCount,
104            'status' => $this->status ?? null,
105            'captchaToken' => $this->captchaToken ?? null,
106            'slotCount' => $this->slotCount ?? null,
107            'displayNumber' => $this->displayNumber ?? null,
108            'icsContent' => $this->icsContent ?? null
109        ];
110    }
111
112    public function setCaptchaToken(string $token): void
113    {
114        $this->captchaToken = $token;
115    }
116
117    public function getCaptchaToken(): ?string
118    {
119        return $this->captchaToken;
120    }
121
122    public function setIcsContent(string $icsContent): void
123    {
124        $this->icsContent = $icsContent;
125    }
126
127    public function getIcsContent(): ?string
128    {
129        return $this->icsContent;
130    }
131
132    private function ensureValid()
133    {
134        if (!$this->testValid()) {
135            throw new InvalidArgumentException("The provided data is invalid according to the schema.");
136        }
137    }
138
139    public function jsonSerialize(): mixed
140    {
141        return $this->toArray();
142    }
143}