# Data Loss Prevention V2 Client - Class Condition (2.13.0)

2.13.0 (latest) 2.12.0 2.11.0 2.10.0 2.9.2 2.8.1 2.7.0 2.6.1 2.4.1 2.3.0 2.2.3 2.1.0 2.0.0 1.19.0 1.18.0 1.17.0 1.16.0 1.15.1 1.14.0 1.13.2 1.12.0 1.11.0 1.10.2 1.9.0 1.8.6 Reference documentation and code samples for the Data Loss Prevention V2 Client class Condition.

The field type of `value` and `field` do not need to match to be
considered equal, but not all comparisons are possible.

EQUAL_TO and NOT_EQUAL_TO attempt to compare even with incompatible types,
but all other comparisons are invalid with incompatible types.
A `value` of type:

- `string` can be compared against all other types
- `boolean` can only be compared against other booleans
- `integer` can be compared against doubles or a string if the string value can be parsed as an integer.
- `double` can be compared against integers or a string if the string can be parsed as a double.
- `Timestamp` can be compared against strings in RFC 3339 date string format.
- `TimeOfDay` can be compared against timestamps and strings in the format of 'HH:mm:ss'. If we fail to compare do to type mismatch, a warning will be given and the condition will evaluate to false.

Generated from protobuf message `google.privacy.dlp.v2.RecordCondition.Condition`

## Namespace

Google \\ Cloud \\ Dlp \\ V2 \\ RecordCondition

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ field` | `https://docs.cloud.google.com/php/docs/reference/cloud-dlp/latest/V2.FieldId` Required. Field within the record this condition is evaluated against. |
| `↳ operator` | `int` Required. Operator used to compare the field or infoType to the value. |
| `↳ value` | `https://docs.cloud.google.com/php/docs/reference/cloud-dlp/latest/V2.Value` Value to compare against. \[Mandatory, except for `EXISTS` tests.\] |

### getField

Required. Field within the record this condition is evaluated against.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-dlp/latest/V2.FieldId|null` |   |

### hasField

### clearField

### setField

Required. Field within the record this condition is evaluated against.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-dlp/latest/V2.FieldId` |

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

### getOperator

Required. Operator used to compare the field or infoType to the value.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [RelationalOperator](https://docs.cloud.google.com/php/docs/reference/cloud-dlp/latest/V2.RelationalOperator). |

### setOperator

Required. Operator used to compare the field or infoType to the value.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [RelationalOperator](https://docs.cloud.google.com/php/docs/reference/cloud-dlp/latest/V2.RelationalOperator). |

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

### getValue

Value to compare against. \[Mandatory, except for `EXISTS` tests.\]

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-dlp/latest/V2.Value|null` |   |

### hasValue

### clearValue

### setValue

Value to compare against. \[Mandatory, except for `EXISTS` tests.\]

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-dlp/latest/V2.Value` |

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