Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 8
0.00% covered (danger)
0.00%
0 / 4
CRAP
0.00% covered (danger)
0.00%
0 / 1
AvailableDaysByOffice
0.00% covered (danger)
0.00%
0 / 8
0.00% covered (danger)
0.00%
0 / 4
30
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 ensureValid
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
6
 toArray
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 jsonSerialize
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3declare(strict_types=1);
4
5namespace BO\Zmscitizenapi\Models;
6
7use BO\Zmsentities\Schema\Entity;
8use InvalidArgumentException;
9use JsonSerializable;
10
11class AvailableDaysByOffice extends Entity implements JsonSerializable
12{
13    public static $schema = 'citizenapi/availableDaysByOffice.json';
14/** @var array */
15    public array $availableDays = [];
16    public function __construct(array $availableDays = [])
17    {
18        $this->availableDays = $availableDays;
19        $this->ensureValid();
20    }
21
22    private function ensureValid()
23    {
24        if (!$this->testValid()) {
25            throw new InvalidArgumentException("The provided data is invalid according to the schema.");
26        }
27    }
28
29    /**
30     * Converts the model data back into an array for serialization.
31     *
32     * @return array
33     */
34    public function toArray(): array
35    {
36        return [
37            'availableDays' => $this->availableDays,
38        ];
39    }
40
41    public function jsonSerialize(): mixed
42    {
43        return $this->toArray();
44    }
45}