* SPDX-License-Identifier: AGPL-3.0-or-later */ namespace KTXM\ProviderLocalChrono\Providers\Personal; use KTXF\Chrono\Entity\EntityPropertiesMutableAbstract; class EntityProperties extends EntityPropertiesMutableAbstract { public function jsonSerialize(): array { $data = $this->getDataRaw(); if (is_array($data)) { return $data; } return []; } public function jsonDeserialize(array|string $data): static { if (is_string($data)) { $data = json_decode($data, true); } if (is_array($data) && array_key_exists('data', $data)) { $this->setDataRaw($data['data']); return $this; } $this->setDataRaw($data); return $this; } public function fromStore(array $data): static { $this->setDataRaw($data['data'] ?? null); return $this; } public function toStore(): array { return array_filter([ 'data' => $this->getDataRaw(), ], static fn($value) => $value !== null); } }