{$field} = AcrossAI_Sanitizer::cast_tri_state( $this->{$field} ); } // JSON-decode all registered JSON longtext fields. // Registry is extensible via acrossai_abilities_json_fields filter (SC-005). foreach ( self::get_json_fields() as $json_field ) { if ( null !== $this->{$json_field} ) { $decoded = json_decode( $this->{$json_field}, true ); $this->{$json_field} = is_array( $decoded ) ? $decoded : null; } } // Cast integer fields. $this->id = (int) $this->id; $this->created_by = null !== $this->created_by ? (int) $this->created_by : null; $this->updated_by = null !== $this->updated_by ? (int) $this->updated_by : null; } }