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    public array $availableDays = [];
15
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    public function toArray(): array
30    {
31        return [
32            'availableDays' => $this->availableDays,
33        ];
34    }
35
36    #[\Override]
37    public function jsonSerialize(): mixed
38    {
39        return $this->toArray();
40    }
41}