. */ namespace SP\Domain\Common\Models; use SP\Domain\Core\Exceptions\SPException; /** * Interface HydratableModel */ interface HydratableModel { /** * Deserialize the hydratable property and returns the object. * * @template THydrate * @param class-string $class * * @return THydrate|null * @throws SPException */ public function hydrate(string $class): ?object; /** * Serialize the object in the hydratable property * * @param object $object * @return static|null A new instance of the model with the serialized property or null if the property * couldn't be serialized */ public function dehydrate(object $object): static|null; }