Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 25 |
|
0.00% |
0 / 5 |
CRAP | |
0.00% |
0 / 1 |
| Requeststatistic | |
0.00% |
0 / 25 |
|
0.00% |
0 / 5 |
156 | |
0.00% |
0 / 1 |
| getScopeRequests | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
6 | |||
| getAdditionalDepartmentRequests | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
6 | |||
| getDefaults | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
| addData | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
30 | |||
| jsonSerialize | |
0.00% |
0 / 10 |
|
0.00% |
0 / 1 |
6 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace BO\Zmsentities; |
| 6 | |
| 7 | /** |
| 8 | * @property Collection\RequestList $scopeRequests |
| 9 | * @property Collection\RequestList $additionalDepartmentRequests |
| 10 | */ |
| 11 | class Requeststatistic extends Schema\Entity implements Helper\NoSanitize |
| 12 | { |
| 13 | public static $schema = 'requeststatistic.json'; |
| 14 | |
| 15 | public function getScopeRequests(): Collection\RequestList |
| 16 | { |
| 17 | $value = $this['scopeRequests'] ?? null; |
| 18 | return $value instanceof Collection\RequestList ? $value : new Collection\RequestList(); |
| 19 | } |
| 20 | |
| 21 | public function getAdditionalDepartmentRequests(): Collection\RequestList |
| 22 | { |
| 23 | $value = $this['additionalDepartmentRequests'] ?? null; |
| 24 | return $value instanceof Collection\RequestList ? $value : new Collection\RequestList(); |
| 25 | } |
| 26 | |
| 27 | #[\Override] |
| 28 | public function getDefaults(): array |
| 29 | { |
| 30 | return [ |
| 31 | 'scopeRequests' => new Collection\RequestList(), |
| 32 | 'additionalDepartmentRequests' => new Collection\RequestList(), |
| 33 | ]; |
| 34 | } |
| 35 | |
| 36 | /** |
| 37 | * @param array|object $mergeData |
| 38 | */ |
| 39 | #[\Override] |
| 40 | public function addData($mergeData): static |
| 41 | { |
| 42 | if (isset($mergeData['scopeRequests']) && !$mergeData['scopeRequests'] instanceof Collection\RequestList) { |
| 43 | $mergeData['scopeRequests'] = (new Collection\RequestList())->addData($mergeData['scopeRequests']); |
| 44 | } |
| 45 | if ( |
| 46 | isset($mergeData['additionalDepartmentRequests']) |
| 47 | && !$mergeData['additionalDepartmentRequests'] instanceof Collection\RequestList |
| 48 | ) { |
| 49 | $mergeData['additionalDepartmentRequests'] = (new Collection\RequestList()) |
| 50 | ->addData($mergeData['additionalDepartmentRequests']); |
| 51 | } |
| 52 | |
| 53 | return parent::addData($mergeData); |
| 54 | } |
| 55 | |
| 56 | #[\Override] |
| 57 | public function jsonSerialize(): mixed |
| 58 | { |
| 59 | $serialized = parent::jsonSerialize(); |
| 60 | $scopeRequests = array_values($this->getScopeRequests()->getArrayCopy()); |
| 61 | $additionalDepartmentRequests = array_values($this->getAdditionalDepartmentRequests()->getArrayCopy()); |
| 62 | |
| 63 | if (is_array($serialized)) { |
| 64 | $serialized['scopeRequests'] = $scopeRequests; |
| 65 | $serialized['additionalDepartmentRequests'] = $additionalDepartmentRequests; |
| 66 | return $serialized; |
| 67 | } |
| 68 | |
| 69 | $serialized->scopeRequests = $scopeRequests; |
| 70 | $serialized->additionalDepartmentRequests = $additionalDepartmentRequests; |
| 71 | return $serialized; |
| 72 | } |
| 73 | } |