# Cloud Text-to-Speech V1 Client - Class SafetySetting (2.8.0)

2.8.0 (latest) 2.7.0 2.6.0 2.5.1 2.4.0 2.3.0 2.2.2 2.0.1 1.12.2 1.11.0 1.10.0 1.9.1 1.8.5 1.7.2 1.6.1 1.5.6 1.4.5 Reference documentation and code samples for the Cloud Text-to-Speech V1 Client class SafetySetting.

Safety setting for a single harm category.

Generated from protobuf message `google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySetting`

## Namespace

Google \\ Cloud \\ TextToSpeech \\ V1 \\ AdvancedVoiceOptions

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ category` | `int` The harm category to apply the safety setting to. |
| `↳ threshold` | `int` The harm block threshold for the safety setting. |

### getCategory

The harm category to apply the safety setting to.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [HarmCategory](https://docs.cloud.google.com/php/docs/reference/cloud-text-to-speech/latest/V1.AdvancedVoiceOptions.HarmCategory). |

### setCategory

The harm category to apply the safety setting to.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [HarmCategory](https://docs.cloud.google.com/php/docs/reference/cloud-text-to-speech/latest/V1.AdvancedVoiceOptions.HarmCategory). |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getThreshold

The harm block threshold for the safety setting.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [HarmBlockThreshold](https://docs.cloud.google.com/php/docs/reference/cloud-text-to-speech/latest/V1.AdvancedVoiceOptions.HarmBlockThreshold). |

### setThreshold

The harm block threshold for the safety setting.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [HarmBlockThreshold](https://docs.cloud.google.com/php/docs/reference/cloud-text-to-speech/latest/V1.AdvancedVoiceOptions.HarmBlockThreshold). |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |