*/ class ShopperSiteCodeCast implements CastsAttributes { /** @param array $attributes */ public function get(Model $model, string $key, mixed $value, array $attributes): ShopperSiteCode { if ($value === null || ! is_string($value)) { throw new \UnexpectedValueException('ShopperSiteCode must be a string.'); } return new ShopperSiteCode($value); } /** @param array $attributes */ public function set(Model $model, string $key, mixed $value, array $attributes): string { if (is_string($value)) { $value = new ShopperSiteCode($value); } if (! $value instanceof ShopperSiteCode) { throw new \UnexpectedValueException('The given value is not an instance of ShopperSiteCode.'); } return $value->value; } }