# Google API Common Protos Client - Class MethodPolicy (4.14.0)

4.14.0 (latest) 4.13.0 4.12.5 4.11.0 4.10.0 4.9.0 4.8.3 Reference documentation and code samples for the Google API Common Protos Client class MethodPolicy.

Defines policies applying to an RPC method.

Generated from protobuf message `google.api.MethodPolicy`

## Namespace

Google \\ Api

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ selector` | `string` Selects a method to which these policies should be enforced, for example, "google.pubsub.v1.Subscriber.CreateSubscription". Refer to [selector](https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Api.DocumentationRule#_Google_Api_DocumentationRule__getSelector__) for syntax details. NOTE: This field must not be set in the proto annotation. It will be automatically filled by the service config compiler . |
| `↳ request_policies` | `array<https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Api.FieldPolicy>` Policies that are applicable to the request message. |

### getSelector

Selects a method to which these policies should be enforced, for example,
"google.pubsub.v1.Subscriber.CreateSubscription".

Refer to [selector](https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Api.DocumentationRule#_Google_Api_DocumentationRule__getSelector__) for syntax
details.
NOTE: This field must not be set in the proto annotation. It will be
automatically filled by the service config compiler .

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setSelector

Selects a method to which these policies should be enforced, for example,
"google.pubsub.v1.Subscriber.CreateSubscription".

Refer to [selector](https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Api.DocumentationRule#_Google_Api_DocumentationRule__getSelector__) for syntax
details.
NOTE: This field must not be set in the proto annotation. It will be
automatically filled by the service config compiler .

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

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

### getRequestPolicies

Policies that are applicable to the request message.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Api.FieldPolicy>` |   |

### setRequestPolicies

Policies that are applicable to the request message.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Api.FieldPolicy>` |

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