. */ declare(strict_types=1); namespace SP\Domain\Common\Adapters; use SP\Domain\Core\Exceptions\SPException; /** * Trait PrintableTrait */ trait PrintableTrait { /** * Convert the model to its string representation. * * @return string * @throws SPException */ public function __toString() { return $this->toJson(); } /** * Convert the model instance to JSON. * * @param int $options * * @return string * @throws SPException */ public function toJson(int $options = 0): string { return Serde::serializeJson($this, $options); } }