repo
stringlengths 6
63
| path
stringlengths 5
140
| func_name
stringlengths 3
151
| original_string
stringlengths 84
13k
| language
stringclasses 1
value | code
stringlengths 84
13k
| code_tokens
list | docstring
stringlengths 3
47.2k
| docstring_tokens
list | sha
stringlengths 40
40
| url
stringlengths 91
247
| partition
stringclasses 1
value |
---|---|---|---|---|---|---|---|---|---|---|---|
googleapis/google-cloud-php | Monitoring/src/V3/ListNotificationChannelDescriptorsResponse.php | ListNotificationChannelDescriptorsResponse.setChannelDescriptors | public function setChannelDescriptors($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Monitoring\V3\NotificationChannelDescriptor::class);
$this->channel_descriptors = $arr;
return $this;
} | php | public function setChannelDescriptors($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Monitoring\V3\NotificationChannelDescriptor::class);
$this->channel_descriptors = $arr;
return $this;
} | [
"public",
"function",
"setChannelDescriptors",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Monitoring",
"\\",
"V3",
"\\",
"NotificationChannelDescriptor",
"::",
"class",
")",
";",
"$",
"this",
"->",
"channel_descriptors",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | The monitored resource descriptors supported for the specified
project, optionally filtered.
Generated from protobuf field <code>repeated .google.monitoring.v3.NotificationChannelDescriptor channel_descriptors = 1;</code>
@param \Google\Cloud\Monitoring\V3\NotificationChannelDescriptor[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"The",
"monitored",
"resource",
"descriptors",
"supported",
"for",
"the",
"specified",
"project",
"optionally",
"filtered",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Monitoring/src/V3/ListNotificationChannelDescriptorsResponse.php#L76-L82 | train |
googleapis/google-cloud-php | PubSub/src/Topic.php | Topic.reload | public function reload(array $options = [])
{
return $this->info = $this->connection->getTopic($options + [
'topic' => $this->name
]);
} | php | public function reload(array $options = [])
{
return $this->info = $this->connection->getTopic($options + [
'topic' => $this->name
]);
} | [
"public",
"function",
"reload",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"info",
"=",
"$",
"this",
"->",
"connection",
"->",
"getTopic",
"(",
"$",
"options",
"+",
"[",
"'topic'",
"=>",
"$",
"this",
"->",
"name",
"]",
")",
";",
"}"
] | Get topic information from the API.
Currently this resource returns only the topic name, if the topic exists.
It is mostly useful therefore for checking if a topic exists.
Since this method will throw an exception if the topic is not found, you
may find that Topic::exists() is a better fit for a true/false check.
This method will retrieve a new result from the API. To use a previously
cached result, if one exists, use {@see Google\Cloud\Pubsub\Topic::info()}.
Example:
```
$topic->reload();
$info = $topic->info();
echo $info['name']; // projects/my-awesome-project/topics/my-new-topic
```
@see https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics/get Get Topic
@codingStandardsIgnoreStart
@param array $options [optional] Configuration Options
@return array [A representation of a Topic](https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics)
@codingStandardsIgnoreEnd | [
"Get",
"topic",
"information",
"from",
"the",
"API",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/PubSub/src/Topic.php#L269-L274 | train |
googleapis/google-cloud-php | PubSub/src/Topic.php | Topic.publishBatch | public function publishBatch(array $messages, array $options = [])
{
foreach ($messages as &$message) {
$message = $this->formatMessage($message);
}
return $this->connection->publishMessage($options + [
'topic' => $this->name,
'messages' => $messages
]);
} | php | public function publishBatch(array $messages, array $options = [])
{
foreach ($messages as &$message) {
$message = $this->formatMessage($message);
}
return $this->connection->publishMessage($options + [
'topic' => $this->name,
'messages' => $messages
]);
} | [
"public",
"function",
"publishBatch",
"(",
"array",
"$",
"messages",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"foreach",
"(",
"$",
"messages",
"as",
"&",
"$",
"message",
")",
"{",
"$",
"message",
"=",
"$",
"this",
"->",
"formatMessage",
"(",
"$",
"message",
")",
";",
"}",
"return",
"$",
"this",
"->",
"connection",
"->",
"publishMessage",
"(",
"$",
"options",
"+",
"[",
"'topic'",
"=>",
"$",
"this",
"->",
"name",
",",
"'messages'",
"=>",
"$",
"messages",
"]",
")",
";",
"}"
] | Publish multiple messages at once.
Example:
```
$topic->publishBatch([
[
'data' => 'New User Registered',
'attributes' => [
'id' => '1',
'userName' => 'John',
'location' => 'Detroit'
]
], [
'data' => 'New User Registered',
'attributes' => [
'id' => '2',
'userName' => 'Steve',
'location' => 'Mountain View'
]
]
]);
```
@see https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics/publish Publish Message
@param array $messages A list of messages. Each message must be in the correct
[Message Format](https://cloud.google.com/pubsub/docs/reference/rest/v1/PubsubMessage).
@param array $options [optional] Configuration Options
@return array A list of message IDs. | [
"Publish",
"multiple",
"messages",
"at",
"once",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/PubSub/src/Topic.php#L335-L345 | train |
googleapis/google-cloud-php | PubSub/src/Topic.php | Topic.subscribe | public function subscribe($name, array $options = [])
{
$subscription = $this->subscriptionFactory($name);
$subscription->create($options);
return $subscription;
} | php | public function subscribe($name, array $options = [])
{
$subscription = $this->subscriptionFactory($name);
$subscription->create($options);
return $subscription;
} | [
"public",
"function",
"subscribe",
"(",
"$",
"name",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"subscription",
"=",
"$",
"this",
"->",
"subscriptionFactory",
"(",
"$",
"name",
")",
";",
"$",
"subscription",
"->",
"create",
"(",
"$",
"options",
")",
";",
"return",
"$",
"subscription",
";",
"}"
] | Create a subscription to the topic.
Example:
```
$subscription = $topic->subscribe('my-new-subscription');
```
@see https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.subscriptions/create Create Subscription
@param string $name The subscription name
@param array $options [optional] Please see {@see Google\Cloud\PubSub\Subscription::create()}
for configuration details.
@return Subscription | [
"Create",
"a",
"subscription",
"to",
"the",
"topic",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/PubSub/src/Topic.php#L425-L432 | train |
googleapis/google-cloud-php | PubSub/src/Topic.php | Topic.subscriptions | public function subscriptions(array $options = [])
{
$resultLimit = $this->pluck('resultLimit', $options, false);
return new ItemIterator(
new PageIterator(
function ($subscription) {
return $this->subscriptionFactory($subscription);
},
[$this->connection, 'listSubscriptionsByTopic'],
$options + ['topic' => $this->name],
[
'itemsKey' => 'subscriptions',
'resultLimit' => $resultLimit
]
)
);
} | php | public function subscriptions(array $options = [])
{
$resultLimit = $this->pluck('resultLimit', $options, false);
return new ItemIterator(
new PageIterator(
function ($subscription) {
return $this->subscriptionFactory($subscription);
},
[$this->connection, 'listSubscriptionsByTopic'],
$options + ['topic' => $this->name],
[
'itemsKey' => 'subscriptions',
'resultLimit' => $resultLimit
]
)
);
} | [
"public",
"function",
"subscriptions",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"resultLimit",
"=",
"$",
"this",
"->",
"pluck",
"(",
"'resultLimit'",
",",
"$",
"options",
",",
"false",
")",
";",
"return",
"new",
"ItemIterator",
"(",
"new",
"PageIterator",
"(",
"function",
"(",
"$",
"subscription",
")",
"{",
"return",
"$",
"this",
"->",
"subscriptionFactory",
"(",
"$",
"subscription",
")",
";",
"}",
",",
"[",
"$",
"this",
"->",
"connection",
",",
"'listSubscriptionsByTopic'",
"]",
",",
"$",
"options",
"+",
"[",
"'topic'",
"=>",
"$",
"this",
"->",
"name",
"]",
",",
"[",
"'itemsKey'",
"=>",
"'subscriptions'",
",",
"'resultLimit'",
"=>",
"$",
"resultLimit",
"]",
")",
")",
";",
"}"
] | Retrieve a list of active subscriptions to the current topic.
Example:
```
$subscriptions = $topic->subscriptions();
foreach ($subscriptions as $subscription) {
echo $subscription->name();
}
```
@codingStandardsIgnoreStart
@see https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics.subscriptions/list List Topic Subscriptions
@codingStandardsIgnoreEnd
@param array $options [optional] {
Configuration Options
@type int $pageSize Maximum number of subscriptions to return.
@type int $resultLimit Limit the number of results returned in total.
**Defaults to** `0` (return all results).
@type string $pageToken A previously-returned page token used to
resume the loading of results from a specific point.
}
@return ItemIterator<Subscription> | [
"Retrieve",
"a",
"list",
"of",
"active",
"subscriptions",
"to",
"the",
"current",
"topic",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/PubSub/src/Topic.php#L477-L494 | train |
googleapis/google-cloud-php | PubSub/src/Topic.php | Topic.iam | public function iam()
{
if (!$this->iam) {
$iamConnection = new IamTopic($this->connection);
$this->iam = new Iam($iamConnection, $this->name);
}
return $this->iam;
} | php | public function iam()
{
if (!$this->iam) {
$iamConnection = new IamTopic($this->connection);
$this->iam = new Iam($iamConnection, $this->name);
}
return $this->iam;
} | [
"public",
"function",
"iam",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"iam",
")",
"{",
"$",
"iamConnection",
"=",
"new",
"IamTopic",
"(",
"$",
"this",
"->",
"connection",
")",
";",
"$",
"this",
"->",
"iam",
"=",
"new",
"Iam",
"(",
"$",
"iamConnection",
",",
"$",
"this",
"->",
"name",
")",
";",
"}",
"return",
"$",
"this",
"->",
"iam",
";",
"}"
] | Manage the IAM policy for the current Topic.
Example:
```
$iam = $topic->iam();
```
@codingStandardsIgnoreStart
@see https://cloud.google.com/pubsub/access_control PubSub Access Control Documentation
@see https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics/getIamPolicy Get Topic IAM Policy
@see https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics/setIamPolicy Set Topic IAM Policy
@see https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics/testIamPermissions Test Topic Permissions
@codingStandardsIgnoreEnd
@return Iam | [
"Manage",
"the",
"IAM",
"policy",
"for",
"the",
"current",
"Topic",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/PubSub/src/Topic.php#L513-L521 | train |
googleapis/google-cloud-php | PubSub/src/Topic.php | Topic.formatMessage | private function formatMessage(array $message)
{
if (isset($message['data']) && $this->encode) {
$message['data'] = base64_encode($message['data']);
}
if (!array_key_exists('data', $message) &&
!array_key_exists('attributes', $message)) {
throw new InvalidArgumentException('At least one of $data or
$attributes must be specified on each message, but neither
was given.');
}
return $message;
} | php | private function formatMessage(array $message)
{
if (isset($message['data']) && $this->encode) {
$message['data'] = base64_encode($message['data']);
}
if (!array_key_exists('data', $message) &&
!array_key_exists('attributes', $message)) {
throw new InvalidArgumentException('At least one of $data or
$attributes must be specified on each message, but neither
was given.');
}
return $message;
} | [
"private",
"function",
"formatMessage",
"(",
"array",
"$",
"message",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"message",
"[",
"'data'",
"]",
")",
"&&",
"$",
"this",
"->",
"encode",
")",
"{",
"$",
"message",
"[",
"'data'",
"]",
"=",
"base64_encode",
"(",
"$",
"message",
"[",
"'data'",
"]",
")",
";",
"}",
"if",
"(",
"!",
"array_key_exists",
"(",
"'data'",
",",
"$",
"message",
")",
"&&",
"!",
"array_key_exists",
"(",
"'attributes'",
",",
"$",
"message",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'At least one of $data or\n $attributes must be specified on each message, but neither\n was given.'",
")",
";",
"}",
"return",
"$",
"message",
";",
"}"
] | Ensure that the message is in a correct format,
base64_encode the data, and error if the input is too wrong to proceed.
@param array $message
@return array The message data
@throws \InvalidArgumentException | [
"Ensure",
"that",
"the",
"message",
"is",
"in",
"a",
"correct",
"format",
"base64_encode",
"the",
"data",
"and",
"error",
"if",
"the",
"input",
"is",
"too",
"wrong",
"to",
"proceed",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/PubSub/src/Topic.php#L548-L562 | train |
googleapis/google-cloud-php | PubSub/src/Topic.php | Topic.subscriptionFactory | private function subscriptionFactory($name, array $info = [])
{
return new Subscription(
$this->connection,
$this->projectId,
$name,
$this->name,
$this->encode,
$info
);
} | php | private function subscriptionFactory($name, array $info = [])
{
return new Subscription(
$this->connection,
$this->projectId,
$name,
$this->name,
$this->encode,
$info
);
} | [
"private",
"function",
"subscriptionFactory",
"(",
"$",
"name",
",",
"array",
"$",
"info",
"=",
"[",
"]",
")",
"{",
"return",
"new",
"Subscription",
"(",
"$",
"this",
"->",
"connection",
",",
"$",
"this",
"->",
"projectId",
",",
"$",
"name",
",",
"$",
"this",
"->",
"name",
",",
"$",
"this",
"->",
"encode",
",",
"$",
"info",
")",
";",
"}"
] | Create a new subscription instance with the given name and optional
subscription data.
@codingStandardsIgnoreStart
@param string $name
@param array $info [optional] A representation of a
[Subscription](https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.subscriptions#Subscription)
@return Subscription
@codingStandardsIgnoreEnd | [
"Create",
"a",
"new",
"subscription",
"instance",
"with",
"the",
"given",
"name",
"and",
"optional",
"subscription",
"data",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/PubSub/src/Topic.php#L575-L585 | train |
googleapis/google-cloud-php | Dlp/src/V2/RecordCondition/Expressions.php | Expressions.setLogicalOperator | public function setLogicalOperator($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Dlp\V2\RecordCondition_Expressions_LogicalOperator::class);
$this->logical_operator = $var;
return $this;
} | php | public function setLogicalOperator($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Dlp\V2\RecordCondition_Expressions_LogicalOperator::class);
$this->logical_operator = $var;
return $this;
} | [
"public",
"function",
"setLogicalOperator",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dlp",
"\\",
"V2",
"\\",
"RecordCondition_Expressions_LogicalOperator",
"::",
"class",
")",
";",
"$",
"this",
"->",
"logical_operator",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | The operator to apply to the result of conditions. Default and currently
only supported value is `AND`.
Generated from protobuf field <code>.google.privacy.dlp.v2.RecordCondition.Expressions.LogicalOperator logical_operator = 1;</code>
@param int $var
@return $this | [
"The",
"operator",
"to",
"apply",
"to",
"the",
"result",
"of",
"conditions",
".",
"Default",
"and",
"currently",
"only",
"supported",
"value",
"is",
"AND",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/RecordCondition/Expressions.php#L64-L70 | train |
googleapis/google-cloud-php | Spanner/src/V1/CreateSessionRequest.php | CreateSessionRequest.setSession | public function setSession($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\Session::class);
$this->session = $var;
return $this;
} | php | public function setSession($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\Session::class);
$this->session = $var;
return $this;
} | [
"public",
"function",
"setSession",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Spanner",
"\\",
"V1",
"\\",
"Session",
"::",
"class",
")",
";",
"$",
"this",
"->",
"session",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | The session to create.
Generated from protobuf field <code>.google.spanner.v1.Session session = 2;</code>
@param \Google\Cloud\Spanner\V1\Session $var
@return $this | [
"The",
"session",
"to",
"create",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/V1/CreateSessionRequest.php#L92-L98 | train |
googleapis/google-cloud-php | Asset/src/V1beta1/BatchGetAssetsHistoryRequest.php | BatchGetAssetsHistoryRequest.setReadTimeWindow | public function setReadTimeWindow($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Asset\V1beta1\TimeWindow::class);
$this->read_time_window = $var;
return $this;
} | php | public function setReadTimeWindow($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Asset\V1beta1\TimeWindow::class);
$this->read_time_window = $var;
return $this;
} | [
"public",
"function",
"setReadTimeWindow",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Asset",
"\\",
"V1beta1",
"\\",
"TimeWindow",
"::",
"class",
")",
";",
"$",
"this",
"->",
"read_time_window",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Optional. The time window for the asset history. Both start_time and
end_time are optional and if set, it must be after 2018-10-02 UTC. If
end_time is not set, it is default to current timestamp. If start_time is
not set, the snapshot of the assets at end_time will be returned. The
returned results contain all temporal assets whose time window overlap with
read_time_window.
Generated from protobuf field <code>.google.cloud.asset.v1beta1.TimeWindow read_time_window = 4;</code>
@param \Google\Cloud\Asset\V1beta1\TimeWindow $var
@return $this | [
"Optional",
".",
"The",
"time",
"window",
"for",
"the",
"asset",
"history",
".",
"Both",
"start_time",
"and",
"end_time",
"are",
"optional",
"and",
"if",
"set",
"it",
"must",
"be",
"after",
"2018",
"-",
"10",
"-",
"02",
"UTC",
".",
"If",
"end_time",
"is",
"not",
"set",
"it",
"is",
"default",
"to",
"current",
"timestamp",
".",
"If",
"start_time",
"is",
"not",
"set",
"the",
"snapshot",
"of",
"the",
"assets",
"at",
"end_time",
"will",
"be",
"returned",
".",
"The",
"returned",
"results",
"contain",
"all",
"temporal",
"assets",
"whose",
"time",
"window",
"overlap",
"with",
"read_time_window",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Asset/src/V1beta1/BatchGetAssetsHistoryRequest.php#L212-L218 | train |
googleapis/google-cloud-php | VideoIntelligence/src/V1/VideoContext.php | VideoContext.setShotChangeDetectionConfig | public function setShotChangeDetectionConfig($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1\ShotChangeDetectionConfig::class);
$this->shot_change_detection_config = $var;
return $this;
} | php | public function setShotChangeDetectionConfig($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1\ShotChangeDetectionConfig::class);
$this->shot_change_detection_config = $var;
return $this;
} | [
"public",
"function",
"setShotChangeDetectionConfig",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"VideoIntelligence",
"\\",
"V1",
"\\",
"ShotChangeDetectionConfig",
"::",
"class",
")",
";",
"$",
"this",
"->",
"shot_change_detection_config",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Config for SHOT_CHANGE_DETECTION.
Generated from protobuf field <code>.google.cloud.videointelligence.v1.ShotChangeDetectionConfig shot_change_detection_config = 3;</code>
@param \Google\Cloud\VideoIntelligence\V1\ShotChangeDetectionConfig $var
@return $this | [
"Config",
"for",
"SHOT_CHANGE_DETECTION",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/VideoIntelligence/src/V1/VideoContext.php#L166-L172 | train |
googleapis/google-cloud-php | VideoIntelligence/src/V1/VideoContext.php | VideoContext.setExplicitContentDetectionConfig | public function setExplicitContentDetectionConfig($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1\ExplicitContentDetectionConfig::class);
$this->explicit_content_detection_config = $var;
return $this;
} | php | public function setExplicitContentDetectionConfig($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1\ExplicitContentDetectionConfig::class);
$this->explicit_content_detection_config = $var;
return $this;
} | [
"public",
"function",
"setExplicitContentDetectionConfig",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"VideoIntelligence",
"\\",
"V1",
"\\",
"ExplicitContentDetectionConfig",
"::",
"class",
")",
";",
"$",
"this",
"->",
"explicit_content_detection_config",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Config for EXPLICIT_CONTENT_DETECTION.
Generated from protobuf field <code>.google.cloud.videointelligence.v1.ExplicitContentDetectionConfig explicit_content_detection_config = 4;</code>
@param \Google\Cloud\VideoIntelligence\V1\ExplicitContentDetectionConfig $var
@return $this | [
"Config",
"for",
"EXPLICIT_CONTENT_DETECTION",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/VideoIntelligence/src/V1/VideoContext.php#L192-L198 | train |
googleapis/google-cloud-php | VideoIntelligence/src/V1/VideoContext.php | VideoContext.setSpeechTranscriptionConfig | public function setSpeechTranscriptionConfig($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1\SpeechTranscriptionConfig::class);
$this->speech_transcription_config = $var;
return $this;
} | php | public function setSpeechTranscriptionConfig($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1\SpeechTranscriptionConfig::class);
$this->speech_transcription_config = $var;
return $this;
} | [
"public",
"function",
"setSpeechTranscriptionConfig",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"VideoIntelligence",
"\\",
"V1",
"\\",
"SpeechTranscriptionConfig",
"::",
"class",
")",
";",
"$",
"this",
"->",
"speech_transcription_config",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Config for SPEECH_TRANSCRIPTION.
Generated from protobuf field <code>.google.cloud.videointelligence.v1.SpeechTranscriptionConfig speech_transcription_config = 6;</code>
@param \Google\Cloud\VideoIntelligence\V1\SpeechTranscriptionConfig $var
@return $this | [
"Config",
"for",
"SPEECH_TRANSCRIPTION",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/VideoIntelligence/src/V1/VideoContext.php#L244-L250 | train |
googleapis/google-cloud-php | VideoIntelligence/src/V1/VideoContext.php | VideoContext.setTextDetectionConfig | public function setTextDetectionConfig($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1\TextDetectionConfig::class);
$this->text_detection_config = $var;
return $this;
} | php | public function setTextDetectionConfig($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1\TextDetectionConfig::class);
$this->text_detection_config = $var;
return $this;
} | [
"public",
"function",
"setTextDetectionConfig",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"VideoIntelligence",
"\\",
"V1",
"\\",
"TextDetectionConfig",
"::",
"class",
")",
";",
"$",
"this",
"->",
"text_detection_config",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Config for TEXT_DETECTION.
Generated from protobuf field <code>.google.cloud.videointelligence.v1.TextDetectionConfig text_detection_config = 8;</code>
@param \Google\Cloud\VideoIntelligence\V1\TextDetectionConfig $var
@return $this | [
"Config",
"for",
"TEXT_DETECTION",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/VideoIntelligence/src/V1/VideoContext.php#L270-L276 | train |
googleapis/google-cloud-php | Dlp/src/V2/DlpJob.php | DlpJob.setState | public function setState($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Dlp\V2\DlpJob_JobState::class);
$this->state = $var;
return $this;
} | php | public function setState($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Dlp\V2\DlpJob_JobState::class);
$this->state = $var;
return $this;
} | [
"public",
"function",
"setState",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dlp",
"\\",
"V2",
"\\",
"DlpJob_JobState",
"::",
"class",
")",
";",
"$",
"this",
"->",
"state",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | State of a job.
Generated from protobuf field <code>.google.privacy.dlp.v2.DlpJob.JobState state = 3;</code>
@param int $var
@return $this | [
"State",
"of",
"a",
"job",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/DlpJob.php#L173-L179 | train |
googleapis/google-cloud-php | Dlp/src/V2/DlpJob.php | DlpJob.setRiskDetails | public function setRiskDetails($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\AnalyzeDataSourceRiskDetails::class);
$this->writeOneof(4, $var);
return $this;
} | php | public function setRiskDetails($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\AnalyzeDataSourceRiskDetails::class);
$this->writeOneof(4, $var);
return $this;
} | [
"public",
"function",
"setRiskDetails",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dlp",
"\\",
"V2",
"\\",
"AnalyzeDataSourceRiskDetails",
"::",
"class",
")",
";",
"$",
"this",
"->",
"writeOneof",
"(",
"4",
",",
"$",
"var",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Results from analyzing risk of a data source.
Generated from protobuf field <code>.google.privacy.dlp.v2.AnalyzeDataSourceRiskDetails risk_details = 4;</code>
@param \Google\Cloud\Dlp\V2\AnalyzeDataSourceRiskDetails $var
@return $this | [
"Results",
"from",
"analyzing",
"risk",
"of",
"a",
"data",
"source",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/DlpJob.php#L199-L205 | train |
googleapis/google-cloud-php | Dlp/src/V2/DlpJob.php | DlpJob.setInspectDetails | public function setInspectDetails($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\InspectDataSourceDetails::class);
$this->writeOneof(5, $var);
return $this;
} | php | public function setInspectDetails($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\InspectDataSourceDetails::class);
$this->writeOneof(5, $var);
return $this;
} | [
"public",
"function",
"setInspectDetails",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dlp",
"\\",
"V2",
"\\",
"InspectDataSourceDetails",
"::",
"class",
")",
";",
"$",
"this",
"->",
"writeOneof",
"(",
"5",
",",
"$",
"var",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Results from inspecting a data source.
Generated from protobuf field <code>.google.privacy.dlp.v2.InspectDataSourceDetails inspect_details = 5;</code>
@param \Google\Cloud\Dlp\V2\InspectDataSourceDetails $var
@return $this | [
"Results",
"from",
"inspecting",
"a",
"data",
"source",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/DlpJob.php#L225-L231 | train |
googleapis/google-cloud-php | Vision/src/V1/Page.php | Page.setBlocks | public function setBlocks($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\Block::class);
$this->blocks = $arr;
return $this;
} | php | public function setBlocks($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\Block::class);
$this->blocks = $arr;
return $this;
} | [
"public",
"function",
"setBlocks",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Vision",
"\\",
"V1",
"\\",
"Block",
"::",
"class",
")",
";",
"$",
"this",
"->",
"blocks",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | List of blocks of text, images etc on this page.
Generated from protobuf field <code>repeated .google.cloud.vision.v1.Block blocks = 4;</code>
@param \Google\Cloud\Vision\V1\Block[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"List",
"of",
"blocks",
"of",
"text",
"images",
"etc",
"on",
"this",
"page",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Vision/src/V1/Page.php#L176-L182 | train |
googleapis/google-cloud-php | Dialogflow/src/V2/Intent/TrainingPhrase.php | TrainingPhrase.setType | public function setType($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\V2\Intent_TrainingPhrase_Type::class);
$this->type = $var;
return $this;
} | php | public function setType($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\V2\Intent_TrainingPhrase_Type::class);
$this->type = $var;
return $this;
} | [
"public",
"function",
"setType",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dialogflow",
"\\",
"V2",
"\\",
"Intent_TrainingPhrase_Type",
"::",
"class",
")",
";",
"$",
"this",
"->",
"type",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Required. The type of the training phrase.
Generated from protobuf field <code>.google.cloud.dialogflow.v2.Intent.TrainingPhrase.Type type = 2;</code>
@param int $var
@return $this | [
"Required",
".",
"The",
"type",
"of",
"the",
"training",
"phrase",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dialogflow/src/V2/Intent/TrainingPhrase.php#L138-L144 | train |
googleapis/google-cloud-php | Container/src/V1/SetLabelsRequest.php | SetLabelsRequest.setResourceLabels | public function setResourceLabels($var)
{
$arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING);
$this->resource_labels = $arr;
return $this;
} | php | public function setResourceLabels($var)
{
$arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING);
$this->resource_labels = $arr;
return $this;
} | [
"public",
"function",
"setResourceLabels",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkMapField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"STRING",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"STRING",
")",
";",
"$",
"this",
"->",
"resource_labels",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | The labels to set for that cluster.
Generated from protobuf field <code>map<string, string> resource_labels = 4;</code>
@param array|\Google\Protobuf\Internal\MapField $var
@return $this | [
"The",
"labels",
"to",
"set",
"for",
"that",
"cluster",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Container/src/V1/SetLabelsRequest.php#L214-L220 | train |
googleapis/google-cloud-php | Dialogflow/src/V2/SearchAgentsResponse.php | SearchAgentsResponse.setAgents | public function setAgents($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\V2\Agent::class);
$this->agents = $arr;
return $this;
} | php | public function setAgents($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\V2\Agent::class);
$this->agents = $arr;
return $this;
} | [
"public",
"function",
"setAgents",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dialogflow",
"\\",
"V2",
"\\",
"Agent",
"::",
"class",
")",
";",
"$",
"this",
"->",
"agents",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | The list of agents. There will be a maximum number of items returned based
on the page_size field in the request.
Generated from protobuf field <code>repeated .google.cloud.dialogflow.v2.Agent agents = 1;</code>
@param \Google\Cloud\Dialogflow\V2\Agent[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"The",
"list",
"of",
"agents",
".",
"There",
"will",
"be",
"a",
"maximum",
"number",
"of",
"items",
"returned",
"based",
"on",
"the",
"page_size",
"field",
"in",
"the",
"request",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dialogflow/src/V2/SearchAgentsResponse.php#L72-L78 | train |
googleapis/google-cloud-php | Firestore/src/V1beta1/BatchGetDocumentsRequest.php | BatchGetDocumentsRequest.setNewTransaction | public function setNewTransaction($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1beta1\TransactionOptions::class);
$this->writeOneof(5, $var);
return $this;
} | php | public function setNewTransaction($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1beta1\TransactionOptions::class);
$this->writeOneof(5, $var);
return $this;
} | [
"public",
"function",
"setNewTransaction",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Firestore",
"\\",
"V1beta1",
"\\",
"TransactionOptions",
"::",
"class",
")",
";",
"$",
"this",
"->",
"writeOneof",
"(",
"5",
",",
"$",
"var",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Starts a new transaction and reads the documents.
Defaults to a read-only transaction.
The new transaction ID will be returned as the first response in the
stream.
Generated from protobuf field <code>.google.firestore.v1beta1.TransactionOptions new_transaction = 5;</code>
@param \Google\Cloud\Firestore\V1beta1\TransactionOptions $var
@return $this | [
"Starts",
"a",
"new",
"transaction",
"and",
"reads",
"the",
"documents",
".",
"Defaults",
"to",
"a",
"read",
"-",
"only",
"transaction",
".",
"The",
"new",
"transaction",
"ID",
"will",
"be",
"returned",
"as",
"the",
"first",
"response",
"in",
"the",
"stream",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/V1beta1/BatchGetDocumentsRequest.php#L219-L225 | train |
googleapis/google-cloud-php | Talent/src/V4beta1/Skill.php | Skill.setLevel | public function setLevel($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Talent\V4beta1\SkillProficiencyLevel::class);
$this->level = $var;
return $this;
} | php | public function setLevel($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Talent\V4beta1\SkillProficiencyLevel::class);
$this->level = $var;
return $this;
} | [
"public",
"function",
"setLevel",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Talent",
"\\",
"V4beta1",
"\\",
"SkillProficiencyLevel",
"::",
"class",
")",
";",
"$",
"this",
"->",
"level",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Optional.
Skill proficiency level which indicates how proficient the candidate is at
this skill.
Generated from protobuf field <code>.google.cloud.talent.v4beta1.SkillProficiencyLevel level = 3;</code>
@param int $var
@return $this | [
"Optional",
".",
"Skill",
"proficiency",
"level",
"which",
"indicates",
"how",
"proficient",
"the",
"candidate",
"is",
"at",
"this",
"skill",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Talent/src/V4beta1/Skill.php#L178-L184 | train |
googleapis/google-cloud-php | ErrorReporting/src/V1beta1/ErrorGroupStats.php | ErrorGroupStats.setGroup | public function setGroup($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\ErrorReporting\V1beta1\ErrorGroup::class);
$this->group = $var;
return $this;
} | php | public function setGroup($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\ErrorReporting\V1beta1\ErrorGroup::class);
$this->group = $var;
return $this;
} | [
"public",
"function",
"setGroup",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"ErrorReporting",
"\\",
"V1beta1",
"\\",
"ErrorGroup",
"::",
"class",
")",
";",
"$",
"this",
"->",
"group",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Group data that is independent of the filter criteria.
Generated from protobuf field <code>.google.devtools.clouderrorreporting.v1beta1.ErrorGroup group = 1;</code>
@param \Google\Cloud\ErrorReporting\V1beta1\ErrorGroup $var
@return $this | [
"Group",
"data",
"that",
"is",
"independent",
"of",
"the",
"filter",
"criteria",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/ErrorReporting/src/V1beta1/ErrorGroupStats.php#L177-L183 | train |
googleapis/google-cloud-php | ErrorReporting/src/V1beta1/ErrorGroupStats.php | ErrorGroupStats.setAffectedServices | public function setAffectedServices($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\ErrorReporting\V1beta1\ServiceContext::class);
$this->affected_services = $arr;
return $this;
} | php | public function setAffectedServices($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\ErrorReporting\V1beta1\ServiceContext::class);
$this->affected_services = $arr;
return $this;
} | [
"public",
"function",
"setAffectedServices",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"ErrorReporting",
"\\",
"V1beta1",
"\\",
"ServiceContext",
"::",
"class",
")",
";",
"$",
"this",
"->",
"affected_services",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | Service contexts with a non-zero error count for the given filter
criteria. This list can be truncated if multiple services are affected.
Refer to `num_affected_services` for the total count.
Generated from protobuf field <code>repeated .google.devtools.clouderrorreporting.v1beta1.ServiceContext affected_services = 7;</code>
@param \Google\Cloud\ErrorReporting\V1beta1\ServiceContext[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"Service",
"contexts",
"with",
"a",
"non",
"-",
"zero",
"error",
"count",
"for",
"the",
"given",
"filter",
"criteria",
".",
"This",
"list",
"can",
"be",
"truncated",
"if",
"multiple",
"services",
"are",
"affected",
".",
"Refer",
"to",
"num_affected_services",
"for",
"the",
"total",
"count",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/ErrorReporting/src/V1beta1/ErrorGroupStats.php#L377-L383 | train |
googleapis/google-cloud-php | ErrorReporting/src/V1beta1/ErrorGroupStats.php | ErrorGroupStats.setRepresentative | public function setRepresentative($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\ErrorReporting\V1beta1\ErrorEvent::class);
$this->representative = $var;
return $this;
} | php | public function setRepresentative($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\ErrorReporting\V1beta1\ErrorEvent::class);
$this->representative = $var;
return $this;
} | [
"public",
"function",
"setRepresentative",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"ErrorReporting",
"\\",
"V1beta1",
"\\",
"ErrorEvent",
"::",
"class",
")",
";",
"$",
"this",
"->",
"representative",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | An arbitrary event that is chosen as representative for the whole group.
The representative event is intended to be used as a quick preview for
the whole group. Events in the group are usually sufficiently similar
to each other such that showing an arbitrary representative provides
insight into the characteristics of the group as a whole.
Generated from protobuf field <code>.google.devtools.clouderrorreporting.v1beta1.ErrorEvent representative = 9;</code>
@param \Google\Cloud\ErrorReporting\V1beta1\ErrorEvent $var
@return $this | [
"An",
"arbitrary",
"event",
"that",
"is",
"chosen",
"as",
"representative",
"for",
"the",
"whole",
"group",
".",
"The",
"representative",
"event",
"is",
"intended",
"to",
"be",
"used",
"as",
"a",
"quick",
"preview",
"for",
"the",
"whole",
"group",
".",
"Events",
"in",
"the",
"group",
"are",
"usually",
"sufficiently",
"similar",
"to",
"each",
"other",
"such",
"that",
"showing",
"an",
"arbitrary",
"representative",
"provides",
"insight",
"into",
"the",
"characteristics",
"of",
"the",
"group",
"as",
"a",
"whole",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/ErrorReporting/src/V1beta1/ErrorGroupStats.php#L439-L445 | train |
googleapis/google-cloud-php | Dlp/src/V2/QuoteInfo.php | QuoteInfo.setDateTime | public function setDateTime($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\DateTime::class);
$this->writeOneof(2, $var);
return $this;
} | php | public function setDateTime($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\DateTime::class);
$this->writeOneof(2, $var);
return $this;
} | [
"public",
"function",
"setDateTime",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dlp",
"\\",
"V2",
"\\",
"DateTime",
"::",
"class",
")",
";",
"$",
"this",
"->",
"writeOneof",
"(",
"2",
",",
"$",
"var",
")",
";",
"return",
"$",
"this",
";",
"}"
] | The date time indicated by the quote.
Generated from protobuf field <code>.google.privacy.dlp.v2.DateTime date_time = 2;</code>
@param \Google\Cloud\Dlp\V2\DateTime $var
@return $this | [
"The",
"date",
"time",
"indicated",
"by",
"the",
"quote",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/QuoteInfo.php#L53-L59 | train |
googleapis/google-cloud-php | Kms/src/V1/ListCryptoKeyVersionsRequest.php | ListCryptoKeyVersionsRequest.setView | public function setView($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Kms\V1\CryptoKeyVersion_CryptoKeyVersionView::class);
$this->view = $var;
return $this;
} | php | public function setView($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Kms\V1\CryptoKeyVersion_CryptoKeyVersionView::class);
$this->view = $var;
return $this;
} | [
"public",
"function",
"setView",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Kms",
"\\",
"V1",
"\\",
"CryptoKeyVersion_CryptoKeyVersionView",
"::",
"class",
")",
";",
"$",
"this",
"->",
"view",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | The fields to include in the response.
Generated from protobuf field <code>.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView view = 4;</code>
@param int $var
@return $this | [
"The",
"fields",
"to",
"include",
"in",
"the",
"response",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Kms/src/V1/ListCryptoKeyVersionsRequest.php#L197-L203 | train |
googleapis/google-cloud-php | AutoMl/src/V1beta1/Model.php | Model.setImageClassificationModelMetadata | public function setImageClassificationModelMetadata($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\AutoMl\V1beta1\ImageClassificationModelMetadata::class);
$this->writeOneof(13, $var);
return $this;
} | php | public function setImageClassificationModelMetadata($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\AutoMl\V1beta1\ImageClassificationModelMetadata::class);
$this->writeOneof(13, $var);
return $this;
} | [
"public",
"function",
"setImageClassificationModelMetadata",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"AutoMl",
"\\",
"V1beta1",
"\\",
"ImageClassificationModelMetadata",
"::",
"class",
")",
";",
"$",
"this",
"->",
"writeOneof",
"(",
"13",
",",
"$",
"var",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Metadata for image classification models.
Generated from protobuf field <code>.google.cloud.automl.v1beta1.ImageClassificationModelMetadata image_classification_model_metadata = 13;</code>
@param \Google\Cloud\AutoMl\V1beta1\ImageClassificationModelMetadata $var
@return $this | [
"Metadata",
"for",
"image",
"classification",
"models",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/AutoMl/src/V1beta1/Model.php#L125-L131 | train |
googleapis/google-cloud-php | AutoMl/src/V1beta1/Model.php | Model.setTextClassificationModelMetadata | public function setTextClassificationModelMetadata($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\AutoMl\V1beta1\TextClassificationModelMetadata::class);
$this->writeOneof(14, $var);
return $this;
} | php | public function setTextClassificationModelMetadata($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\AutoMl\V1beta1\TextClassificationModelMetadata::class);
$this->writeOneof(14, $var);
return $this;
} | [
"public",
"function",
"setTextClassificationModelMetadata",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"AutoMl",
"\\",
"V1beta1",
"\\",
"TextClassificationModelMetadata",
"::",
"class",
")",
";",
"$",
"this",
"->",
"writeOneof",
"(",
"14",
",",
"$",
"var",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Metadata for text classification models.
Generated from protobuf field <code>.google.cloud.automl.v1beta1.TextClassificationModelMetadata text_classification_model_metadata = 14;</code>
@param \Google\Cloud\AutoMl\V1beta1\TextClassificationModelMetadata $var
@return $this | [
"Metadata",
"for",
"text",
"classification",
"models",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/AutoMl/src/V1beta1/Model.php#L151-L157 | train |
googleapis/google-cloud-php | AutoMl/src/V1beta1/Model.php | Model.setTranslationModelMetadata | public function setTranslationModelMetadata($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\AutoMl\V1beta1\TranslationModelMetadata::class);
$this->writeOneof(15, $var);
return $this;
} | php | public function setTranslationModelMetadata($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\AutoMl\V1beta1\TranslationModelMetadata::class);
$this->writeOneof(15, $var);
return $this;
} | [
"public",
"function",
"setTranslationModelMetadata",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"AutoMl",
"\\",
"V1beta1",
"\\",
"TranslationModelMetadata",
"::",
"class",
")",
";",
"$",
"this",
"->",
"writeOneof",
"(",
"15",
",",
"$",
"var",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Metadata for translation models.
Generated from protobuf field <code>.google.cloud.automl.v1beta1.TranslationModelMetadata translation_model_metadata = 15;</code>
@param \Google\Cloud\AutoMl\V1beta1\TranslationModelMetadata $var
@return $this | [
"Metadata",
"for",
"translation",
"models",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/AutoMl/src/V1beta1/Model.php#L177-L183 | train |
googleapis/google-cloud-php | AutoMl/src/V1beta1/Model.php | Model.setDeploymentState | public function setDeploymentState($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\AutoMl\V1beta1\Model_DeploymentState::class);
$this->deployment_state = $var;
return $this;
} | php | public function setDeploymentState($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\AutoMl\V1beta1\Model_DeploymentState::class);
$this->deployment_state = $var;
return $this;
} | [
"public",
"function",
"setDeploymentState",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"AutoMl",
"\\",
"V1beta1",
"\\",
"Model_DeploymentState",
"::",
"class",
")",
";",
"$",
"this",
"->",
"deployment_state",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Output only. Deployment state of the model.
Generated from protobuf field <code>.google.cloud.automl.v1beta1.Model.DeploymentState deployment_state = 8;</code>
@param int $var
@return $this | [
"Output",
"only",
".",
"Deployment",
"state",
"of",
"the",
"model",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/AutoMl/src/V1beta1/Model.php#L353-L359 | train |
googleapis/google-cloud-php | Dlp/src/V2/ListDeidentifyTemplatesResponse.php | ListDeidentifyTemplatesResponse.setDeidentifyTemplates | public function setDeidentifyTemplates($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dlp\V2\DeidentifyTemplate::class);
$this->deidentify_templates = $arr;
return $this;
} | php | public function setDeidentifyTemplates($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dlp\V2\DeidentifyTemplate::class);
$this->deidentify_templates = $arr;
return $this;
} | [
"public",
"function",
"setDeidentifyTemplates",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dlp",
"\\",
"V2",
"\\",
"DeidentifyTemplate",
"::",
"class",
")",
";",
"$",
"this",
"->",
"deidentify_templates",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | List of deidentify templates, up to page_size in
ListDeidentifyTemplatesRequest.
Generated from protobuf field <code>repeated .google.privacy.dlp.v2.DeidentifyTemplate deidentify_templates = 1;</code>
@param \Google\Cloud\Dlp\V2\DeidentifyTemplate[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"List",
"of",
"deidentify",
"templates",
"up",
"to",
"page_size",
"in",
"ListDeidentifyTemplatesRequest",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/ListDeidentifyTemplatesResponse.php#L72-L78 | train |
googleapis/google-cloud-php | Talent/src/V4beta1/Interview.php | Interview.setRating | public function setRating($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Talent\V4beta1\Rating::class);
$this->rating = $var;
return $this;
} | php | public function setRating($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Talent\V4beta1\Rating::class);
$this->rating = $var;
return $this;
} | [
"public",
"function",
"setRating",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Talent",
"\\",
"V4beta1",
"\\",
"Rating",
"::",
"class",
")",
";",
"$",
"this",
"->",
"rating",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Optional.
The rating on this interview.
Generated from protobuf field <code>.google.cloud.talent.v4beta1.Rating rating = 6;</code>
@param \Google\Cloud\Talent\V4beta1\Rating $var
@return $this | [
"Optional",
".",
"The",
"rating",
"on",
"this",
"interview",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Talent/src/V4beta1/Interview.php#L74-L80 | train |
googleapis/google-cloud-php | Vision/src/V1/AnnotateFileRequest.php | AnnotateFileRequest.setInputConfig | public function setInputConfig($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\InputConfig::class);
$this->input_config = $var;
return $this;
} | php | public function setInputConfig($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\InputConfig::class);
$this->input_config = $var;
return $this;
} | [
"public",
"function",
"setInputConfig",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Vision",
"\\",
"V1",
"\\",
"InputConfig",
"::",
"class",
")",
";",
"$",
"this",
"->",
"input_config",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Required. Information about the input file.
Generated from protobuf field <code>.google.cloud.vision.v1.InputConfig input_config = 1;</code>
@param \Google\Cloud\Vision\V1\InputConfig $var
@return $this | [
"Required",
".",
"Information",
"about",
"the",
"input",
"file",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Vision/src/V1/AnnotateFileRequest.php#L100-L106 | train |
googleapis/google-cloud-php | Vision/src/V1/AnnotateFileRequest.php | AnnotateFileRequest.setFeatures | public function setFeatures($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\Feature::class);
$this->features = $arr;
return $this;
} | php | public function setFeatures($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\Feature::class);
$this->features = $arr;
return $this;
} | [
"public",
"function",
"setFeatures",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Vision",
"\\",
"V1",
"\\",
"Feature",
"::",
"class",
")",
";",
"$",
"this",
"->",
"features",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | Required. Requested features.
Generated from protobuf field <code>repeated .google.cloud.vision.v1.Feature features = 2;</code>
@param \Google\Cloud\Vision\V1\Feature[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"Required",
".",
"Requested",
"features",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Vision/src/V1/AnnotateFileRequest.php#L126-L132 | train |
googleapis/google-cloud-php | Vision/src/V1/AnnotateFileRequest.php | AnnotateFileRequest.setPages | public function setPages($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32);
$this->pages = $arr;
return $this;
} | php | public function setPages($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32);
$this->pages = $arr;
return $this;
} | [
"public",
"function",
"setPages",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"INT32",
")",
";",
"$",
"this",
"->",
"pages",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | Pages of the file to perform image annotation.
Pages starts from 1, we assume the first page of the file is page 1.
At most 5 pages are supported per request. Pages can be negative.
Page 1 means the first page.
Page 2 means the second page.
Page -1 means the last page.
Page -2 means the second to the last page.
If the file is GIF instead of PDF or TIFF, page refers to GIF frames.
If this field is empty, by default the service performs image annotation
for the first 5 pages of the file.
Generated from protobuf field <code>repeated int32 pages = 4;</code>
@param int[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"Pages",
"of",
"the",
"file",
"to",
"perform",
"image",
"annotation",
".",
"Pages",
"starts",
"from",
"1",
"we",
"assume",
"the",
"first",
"page",
"of",
"the",
"file",
"is",
"page",
"1",
".",
"At",
"most",
"5",
"pages",
"are",
"supported",
"per",
"request",
".",
"Pages",
"can",
"be",
"negative",
".",
"Page",
"1",
"means",
"the",
"first",
"page",
".",
"Page",
"2",
"means",
"the",
"second",
"page",
".",
"Page",
"-",
"1",
"means",
"the",
"last",
"page",
".",
"Page",
"-",
"2",
"means",
"the",
"second",
"to",
"the",
"last",
"page",
".",
"If",
"the",
"file",
"is",
"GIF",
"instead",
"of",
"PDF",
"or",
"TIFF",
"page",
"refers",
"to",
"GIF",
"frames",
".",
"If",
"this",
"field",
"is",
"empty",
"by",
"default",
"the",
"service",
"performs",
"image",
"annotation",
"for",
"the",
"first",
"5",
"pages",
"of",
"the",
"file",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Vision/src/V1/AnnotateFileRequest.php#L196-L202 | train |
googleapis/google-cloud-php | Datastore/src/Transaction.php | Transaction.insertBatch | public function insertBatch(array $entities)
{
$entities = $this->operation->allocateIdsToEntities($entities);
foreach ($entities as $entity) {
$this->mutations[] = $this->operation->mutation('insert', $entity, Entity::class);
}
return $this;
} | php | public function insertBatch(array $entities)
{
$entities = $this->operation->allocateIdsToEntities($entities);
foreach ($entities as $entity) {
$this->mutations[] = $this->operation->mutation('insert', $entity, Entity::class);
}
return $this;
} | [
"public",
"function",
"insertBatch",
"(",
"array",
"$",
"entities",
")",
"{",
"$",
"entities",
"=",
"$",
"this",
"->",
"operation",
"->",
"allocateIdsToEntities",
"(",
"$",
"entities",
")",
";",
"foreach",
"(",
"$",
"entities",
"as",
"$",
"entity",
")",
"{",
"$",
"this",
"->",
"mutations",
"[",
"]",
"=",
"$",
"this",
"->",
"operation",
"->",
"mutation",
"(",
"'insert'",
",",
"$",
"entity",
",",
"Entity",
"::",
"class",
")",
";",
"}",
"return",
"$",
"this",
";",
"}"
] | Insert multiple entities.
Changes are not immediately committed to Cloud Datastore when calling
this method. Use {@see Google\Cloud\Datastore\Transaction::commit()} to
commit changes and end the transaction.
If entities with incomplete keys are provided, this method will immediately
trigger a service call to allocate IDs to the entities.
Example:
```
$entities = [
$datastore->entity('Person', ['firstName' => 'Bob']),
$datastore->entity('Person', ['firstName' => 'John'])
];
$transaction->insertBatch($entities);
$transaction->commit();
```
@param EntityInterface[] $entities The entities to insert.
@return Transaction | [
"Insert",
"multiple",
"entities",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Datastore/src/Transaction.php#L116-L124 | train |
googleapis/google-cloud-php | Datastore/src/Transaction.php | Transaction.updateBatch | public function updateBatch(array $entities, array $options = [])
{
$options += [
'allowOverwrite' => false
];
$this->operation->checkOverwrite($entities, $options['allowOverwrite']);
foreach ($entities as $entity) {
$this->mutations[] = $this->operation->mutation('update', $entity, Entity::class);
}
return $this;
} | php | public function updateBatch(array $entities, array $options = [])
{
$options += [
'allowOverwrite' => false
];
$this->operation->checkOverwrite($entities, $options['allowOverwrite']);
foreach ($entities as $entity) {
$this->mutations[] = $this->operation->mutation('update', $entity, Entity::class);
}
return $this;
} | [
"public",
"function",
"updateBatch",
"(",
"array",
"$",
"entities",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"+=",
"[",
"'allowOverwrite'",
"=>",
"false",
"]",
";",
"$",
"this",
"->",
"operation",
"->",
"checkOverwrite",
"(",
"$",
"entities",
",",
"$",
"options",
"[",
"'allowOverwrite'",
"]",
")",
";",
"foreach",
"(",
"$",
"entities",
"as",
"$",
"entity",
")",
"{",
"$",
"this",
"->",
"mutations",
"[",
"]",
"=",
"$",
"this",
"->",
"operation",
"->",
"mutation",
"(",
"'update'",
",",
"$",
"entity",
",",
"Entity",
"::",
"class",
")",
";",
"}",
"return",
"$",
"this",
";",
"}"
] | Update multiple entities.
Changes are not immediately committed to Cloud Datastore when calling
this method. Use {@see Google\Cloud\Datastore\Transaction::commit()} to
commit changes and end the transaction.
Example:
```
$entities[0]['firstName'] = 'Bob';
$entities[1]['firstName'] = 'John';
$transaction->updateBatch($entities);
$transaction->commit();
```
@param EntityInterface[] $entities The entities to update.
@param array $options [optional] {
Configuration Options
@type bool $allowOverwrite Entities must be updated as an entire
resource. Patch operations are not supported. Because entities
can be created manually, or obtained by a lookup or query, it
is possible to accidentally overwrite an existing record with a
new one when manually creating an entity. To provide additional
safety, this flag must be set to `true` in order to update a
record when the entity provided was not obtained through a
lookup or query. **Defaults to** `false`.
}
@return Transaction | [
"Update",
"multiple",
"entities",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Datastore/src/Transaction.php#L196-L208 | train |
googleapis/google-cloud-php | Datastore/src/Transaction.php | Transaction.deleteBatch | public function deleteBatch(array $keys)
{
foreach ($keys as $key) {
$this->mutations[] = $this->operation->mutation('delete', $key, Key::class);
}
return $this;
} | php | public function deleteBatch(array $keys)
{
foreach ($keys as $key) {
$this->mutations[] = $this->operation->mutation('delete', $key, Key::class);
}
return $this;
} | [
"public",
"function",
"deleteBatch",
"(",
"array",
"$",
"keys",
")",
"{",
"foreach",
"(",
"$",
"keys",
"as",
"$",
"key",
")",
"{",
"$",
"this",
"->",
"mutations",
"[",
"]",
"=",
"$",
"this",
"->",
"operation",
"->",
"mutation",
"(",
"'delete'",
",",
"$",
"key",
",",
"Key",
"::",
"class",
")",
";",
"}",
"return",
"$",
"this",
";",
"}"
] | Delete multiple records.
Changes are not immediately committed to Cloud Datastore when calling
this method. Use {@see Google\Cloud\Datastore\Transaction::commit()} to
commit changes and end the transaction.
Example:
```
$keys = [
$datastore->key('Person', 'Bob'),
$datastore->key('Person', 'John')
];
$transaction->deleteBatch($keys);
$transaction->commit();
```
@param Key[] $keys The keys to delete.
@return Transaction | [
"Delete",
"multiple",
"records",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Datastore/src/Transaction.php#L326-L333 | train |
googleapis/google-cloud-php | Datastore/src/Transaction.php | Transaction.commit | public function commit(array $options = [])
{
$options['transaction'] = $this->transactionId;
return $this->operation->commit($this->mutations, $options);
} | php | public function commit(array $options = [])
{
$options['transaction'] = $this->transactionId;
return $this->operation->commit($this->mutations, $options);
} | [
"public",
"function",
"commit",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"[",
"'transaction'",
"]",
"=",
"$",
"this",
"->",
"transactionId",
";",
"return",
"$",
"this",
"->",
"operation",
"->",
"commit",
"(",
"$",
"this",
"->",
"mutations",
",",
"$",
"options",
")",
";",
"}"
] | Commit all mutations.
Calling this method will end the operation (and close the transaction,
if one is specified).
Example:
```
$transaction->commit();
```
@see https://cloud.google.com/datastore/docs/reference/rest/v1/projects/commit Commit API documentation
@param array $options [optional] Configuration Options.
@return array [Response Body](https://cloud.google.com/datastore/reference/rest/v1/projects/commit#response-body) | [
"Commit",
"all",
"mutations",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Datastore/src/Transaction.php#L351-L356 | train |
googleapis/google-cloud-php | Dialogflow/src/V2/StreamingDetectIntentResponse.php | StreamingDetectIntentResponse.setRecognitionResult | public function setRecognitionResult($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\StreamingRecognitionResult::class);
$this->recognition_result = $var;
return $this;
} | php | public function setRecognitionResult($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\StreamingRecognitionResult::class);
$this->recognition_result = $var;
return $this;
} | [
"public",
"function",
"setRecognitionResult",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dialogflow",
"\\",
"V2",
"\\",
"StreamingRecognitionResult",
"::",
"class",
")",
";",
"$",
"this",
"->",
"recognition_result",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | The result of speech recognition.
Generated from protobuf field <code>.google.cloud.dialogflow.v2.StreamingRecognitionResult recognition_result = 2;</code>
@param \Google\Cloud\Dialogflow\V2\StreamingRecognitionResult $var
@return $this | [
"The",
"result",
"of",
"speech",
"recognition",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dialogflow/src/V2/StreamingDetectIntentResponse.php#L140-L146 | train |
googleapis/google-cloud-php | SecurityCenter/src/V1/ListAssetsResponse/ListAssetsResult.php | ListAssetsResult.setStateChange | public function setStateChange($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\SecurityCenter\V1\ListAssetsResponse_ListAssetsResult_StateChange::class);
$this->state_change = $var;
return $this;
} | php | public function setStateChange($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\SecurityCenter\V1\ListAssetsResponse_ListAssetsResult_StateChange::class);
$this->state_change = $var;
return $this;
} | [
"public",
"function",
"setStateChange",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"SecurityCenter",
"\\",
"V1",
"\\",
"ListAssetsResponse_ListAssetsResult_StateChange",
"::",
"class",
")",
";",
"$",
"this",
"->",
"state_change",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | State change of the asset between the points in time.
Generated from protobuf field <code>.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult.StateChange state_change = 2;</code>
@param int $var
@return $this | [
"State",
"change",
"of",
"the",
"asset",
"between",
"the",
"points",
"in",
"time",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/SecurityCenter/src/V1/ListAssetsResponse/ListAssetsResult.php#L92-L98 | train |
googleapis/google-cloud-php | Monitoring/src/V3/UptimeCheckIp.php | UptimeCheckIp.setRegion | public function setRegion($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Monitoring\V3\UptimeCheckRegion::class);
$this->region = $var;
return $this;
} | php | public function setRegion($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Monitoring\V3\UptimeCheckRegion::class);
$this->region = $var;
return $this;
} | [
"public",
"function",
"setRegion",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Monitoring",
"\\",
"V3",
"\\",
"UptimeCheckRegion",
"::",
"class",
")",
";",
"$",
"this",
"->",
"region",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | A broad region category in which the IP address is located.
Generated from protobuf field <code>.google.monitoring.v3.UptimeCheckRegion region = 1;</code>
@param int $var
@return $this | [
"A",
"broad",
"region",
"category",
"in",
"which",
"the",
"IP",
"address",
"is",
"located",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Monitoring/src/V3/UptimeCheckIp.php#L87-L93 | train |
googleapis/google-cloud-php | Dlp/src/V2/UpdateDeidentifyTemplateRequest.php | UpdateDeidentifyTemplateRequest.setDeidentifyTemplate | public function setDeidentifyTemplate($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\DeidentifyTemplate::class);
$this->deidentify_template = $var;
return $this;
} | php | public function setDeidentifyTemplate($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\DeidentifyTemplate::class);
$this->deidentify_template = $var;
return $this;
} | [
"public",
"function",
"setDeidentifyTemplate",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dlp",
"\\",
"V2",
"\\",
"DeidentifyTemplate",
"::",
"class",
")",
";",
"$",
"this",
"->",
"deidentify_template",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | New DeidentifyTemplate value.
Generated from protobuf field <code>.google.privacy.dlp.v2.DeidentifyTemplate deidentify_template = 2;</code>
@param \Google\Cloud\Dlp\V2\DeidentifyTemplate $var
@return $this | [
"New",
"DeidentifyTemplate",
"value",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/UpdateDeidentifyTemplateRequest.php#L108-L114 | train |
googleapis/google-cloud-php | Dataproc/src/V1beta2/ValueValidation.php | ValueValidation.setValues | public function setValues($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->values = $arr;
return $this;
} | php | public function setValues($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->values = $arr;
return $this;
} | [
"public",
"function",
"setValues",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"STRING",
")",
";",
"$",
"this",
"->",
"values",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | Required. List of allowed values for the parameter.
Generated from protobuf field <code>repeated string values = 1;</code>
@param string[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"Required",
".",
"List",
"of",
"allowed",
"values",
"for",
"the",
"parameter",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dataproc/src/V1beta2/ValueValidation.php#L58-L64 | train |
googleapis/google-cloud-php | Dialogflow/src/V2/BatchUpdateIntentsRequest.php | BatchUpdateIntentsRequest.setIntentBatchInline | public function setIntentBatchInline($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\IntentBatch::class);
$this->writeOneof(3, $var);
return $this;
} | php | public function setIntentBatchInline($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\IntentBatch::class);
$this->writeOneof(3, $var);
return $this;
} | [
"public",
"function",
"setIntentBatchInline",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dialogflow",
"\\",
"V2",
"\\",
"IntentBatch",
"::",
"class",
")",
";",
"$",
"this",
"->",
"writeOneof",
"(",
"3",
",",
"$",
"var",
")",
";",
"return",
"$",
"this",
";",
"}"
] | The collection of intents to update or create.
Generated from protobuf field <code>.google.cloud.dialogflow.v2.IntentBatch intent_batch_inline = 3;</code>
@param \Google\Cloud\Dialogflow\V2\IntentBatch $var
@return $this | [
"The",
"collection",
"of",
"intents",
"to",
"update",
"or",
"create",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dialogflow/src/V2/BatchUpdateIntentsRequest.php#L159-L165 | train |
googleapis/google-cloud-php | Language/src/V1beta2/PartOfSpeech.php | PartOfSpeech.setTag | public function setTag($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Language\V1beta2\PartOfSpeech_Tag::class);
$this->tag = $var;
return $this;
} | php | public function setTag($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Language\V1beta2\PartOfSpeech_Tag::class);
$this->tag = $var;
return $this;
} | [
"public",
"function",
"setTag",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Language",
"\\",
"V1beta2",
"\\",
"PartOfSpeech_Tag",
"::",
"class",
")",
";",
"$",
"this",
"->",
"tag",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | The part of speech tag.
Generated from protobuf field <code>.google.cloud.language.v1beta2.PartOfSpeech.Tag tag = 1;</code>
@param int $var
@return $this | [
"The",
"part",
"of",
"speech",
"tag",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Language/src/V1beta2/PartOfSpeech.php#L146-L152 | train |
googleapis/google-cloud-php | Language/src/V1beta2/PartOfSpeech.php | PartOfSpeech.setCase | public function setCase($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Language\V1beta2\PartOfSpeech_Case::class);
$this->case = $var;
return $this;
} | php | public function setCase($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Language\V1beta2\PartOfSpeech_Case::class);
$this->case = $var;
return $this;
} | [
"public",
"function",
"setCase",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Language",
"\\",
"V1beta2",
"\\",
"PartOfSpeech_Case",
"::",
"class",
")",
";",
"$",
"this",
"->",
"case",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | The grammatical case.
Generated from protobuf field <code>.google.cloud.language.v1beta2.PartOfSpeech.Case case = 3;</code>
@param int $var
@return $this | [
"The",
"grammatical",
"case",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Language/src/V1beta2/PartOfSpeech.php#L198-L204 | train |
googleapis/google-cloud-php | Language/src/V1beta2/PartOfSpeech.php | PartOfSpeech.setForm | public function setForm($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Language\V1beta2\PartOfSpeech_Form::class);
$this->form = $var;
return $this;
} | php | public function setForm($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Language\V1beta2\PartOfSpeech_Form::class);
$this->form = $var;
return $this;
} | [
"public",
"function",
"setForm",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Language",
"\\",
"V1beta2",
"\\",
"PartOfSpeech_Form",
"::",
"class",
")",
";",
"$",
"this",
"->",
"form",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | The grammatical form.
Generated from protobuf field <code>.google.cloud.language.v1beta2.PartOfSpeech.Form form = 4;</code>
@param int $var
@return $this | [
"The",
"grammatical",
"form",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Language/src/V1beta2/PartOfSpeech.php#L224-L230 | train |
googleapis/google-cloud-php | Language/src/V1beta2/PartOfSpeech.php | PartOfSpeech.setGender | public function setGender($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Language\V1beta2\PartOfSpeech_Gender::class);
$this->gender = $var;
return $this;
} | php | public function setGender($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Language\V1beta2\PartOfSpeech_Gender::class);
$this->gender = $var;
return $this;
} | [
"public",
"function",
"setGender",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Language",
"\\",
"V1beta2",
"\\",
"PartOfSpeech_Gender",
"::",
"class",
")",
";",
"$",
"this",
"->",
"gender",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | The grammatical gender.
Generated from protobuf field <code>.google.cloud.language.v1beta2.PartOfSpeech.Gender gender = 5;</code>
@param int $var
@return $this | [
"The",
"grammatical",
"gender",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Language/src/V1beta2/PartOfSpeech.php#L250-L256 | train |
googleapis/google-cloud-php | Language/src/V1beta2/PartOfSpeech.php | PartOfSpeech.setNumber | public function setNumber($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Language\V1beta2\PartOfSpeech_Number::class);
$this->number = $var;
return $this;
} | php | public function setNumber($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Language\V1beta2\PartOfSpeech_Number::class);
$this->number = $var;
return $this;
} | [
"public",
"function",
"setNumber",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Language",
"\\",
"V1beta2",
"\\",
"PartOfSpeech_Number",
"::",
"class",
")",
";",
"$",
"this",
"->",
"number",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | The grammatical number.
Generated from protobuf field <code>.google.cloud.language.v1beta2.PartOfSpeech.Number number = 7;</code>
@param int $var
@return $this | [
"The",
"grammatical",
"number",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Language/src/V1beta2/PartOfSpeech.php#L302-L308 | train |
googleapis/google-cloud-php | Language/src/V1beta2/PartOfSpeech.php | PartOfSpeech.setProper | public function setProper($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Language\V1beta2\PartOfSpeech_Proper::class);
$this->proper = $var;
return $this;
} | php | public function setProper($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Language\V1beta2\PartOfSpeech_Proper::class);
$this->proper = $var;
return $this;
} | [
"public",
"function",
"setProper",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Language",
"\\",
"V1beta2",
"\\",
"PartOfSpeech_Proper",
"::",
"class",
")",
";",
"$",
"this",
"->",
"proper",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | The grammatical properness.
Generated from protobuf field <code>.google.cloud.language.v1beta2.PartOfSpeech.Proper proper = 9;</code>
@param int $var
@return $this | [
"The",
"grammatical",
"properness",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Language/src/V1beta2/PartOfSpeech.php#L354-L360 | train |
googleapis/google-cloud-php | Core/src/Iam/PolicyBuilder.php | PolicyBuilder.setBindings | public function setBindings(array $bindings = [])
{
$this->bindings = [];
foreach ($bindings as $binding) {
$this->addBinding($binding['role'], $binding['members']);
}
return $this;
} | php | public function setBindings(array $bindings = [])
{
$this->bindings = [];
foreach ($bindings as $binding) {
$this->addBinding($binding['role'], $binding['members']);
}
return $this;
} | [
"public",
"function",
"setBindings",
"(",
"array",
"$",
"bindings",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"bindings",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"bindings",
"as",
"$",
"binding",
")",
"{",
"$",
"this",
"->",
"addBinding",
"(",
"$",
"binding",
"[",
"'role'",
"]",
",",
"$",
"binding",
"[",
"'members'",
"]",
")",
";",
"}",
"return",
"$",
"this",
";",
"}"
] | Override all stored bindings on the policy.
Example:
```
$builder->setBindings([
[
'role' => 'roles/admin',
'members' => [
'user:admin@domain.com'
]
]
]);
```
@param array $bindings [optional] An array of bindings
@return PolicyBuilder
@throws InvalidArgumentException | [
"Override",
"all",
"stored",
"bindings",
"on",
"the",
"policy",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Core/src/Iam/PolicyBuilder.php#L93-L101 | train |
googleapis/google-cloud-php | Core/src/Iam/PolicyBuilder.php | PolicyBuilder.removeBinding | public function removeBinding($role, array $members)
{
$bindings = $this->bindings;
foreach ((array) $bindings as $i => $binding) {
if ($binding['role'] == $role) {
$newMembers = array_diff($binding['members'], $members);
if (count($newMembers) != count($binding['members']) - count($members)) {
throw new InvalidArgumentException('One or more role-members were not found.');
}
if (empty($newMembers)) {
unset($bindings[$i]);
$bindings = array_values($bindings);
} else {
$binding['members'] = array_values($newMembers);
$bindings[$i] = $binding;
}
$this->bindings = $bindings;
return $this;
}
}
throw new InvalidArgumentException('The role was not found.');
} | php | public function removeBinding($role, array $members)
{
$bindings = $this->bindings;
foreach ((array) $bindings as $i => $binding) {
if ($binding['role'] == $role) {
$newMembers = array_diff($binding['members'], $members);
if (count($newMembers) != count($binding['members']) - count($members)) {
throw new InvalidArgumentException('One or more role-members were not found.');
}
if (empty($newMembers)) {
unset($bindings[$i]);
$bindings = array_values($bindings);
} else {
$binding['members'] = array_values($newMembers);
$bindings[$i] = $binding;
}
$this->bindings = $bindings;
return $this;
}
}
throw new InvalidArgumentException('The role was not found.');
} | [
"public",
"function",
"removeBinding",
"(",
"$",
"role",
",",
"array",
"$",
"members",
")",
"{",
"$",
"bindings",
"=",
"$",
"this",
"->",
"bindings",
";",
"foreach",
"(",
"(",
"array",
")",
"$",
"bindings",
"as",
"$",
"i",
"=>",
"$",
"binding",
")",
"{",
"if",
"(",
"$",
"binding",
"[",
"'role'",
"]",
"==",
"$",
"role",
")",
"{",
"$",
"newMembers",
"=",
"array_diff",
"(",
"$",
"binding",
"[",
"'members'",
"]",
",",
"$",
"members",
")",
";",
"if",
"(",
"count",
"(",
"$",
"newMembers",
")",
"!=",
"count",
"(",
"$",
"binding",
"[",
"'members'",
"]",
")",
"-",
"count",
"(",
"$",
"members",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'One or more role-members were not found.'",
")",
";",
"}",
"if",
"(",
"empty",
"(",
"$",
"newMembers",
")",
")",
"{",
"unset",
"(",
"$",
"bindings",
"[",
"$",
"i",
"]",
")",
";",
"$",
"bindings",
"=",
"array_values",
"(",
"$",
"bindings",
")",
";",
"}",
"else",
"{",
"$",
"binding",
"[",
"'members'",
"]",
"=",
"array_values",
"(",
"$",
"newMembers",
")",
";",
"$",
"bindings",
"[",
"$",
"i",
"]",
"=",
"$",
"binding",
";",
"}",
"$",
"this",
"->",
"bindings",
"=",
"$",
"bindings",
";",
"return",
"$",
"this",
";",
"}",
"}",
"throw",
"new",
"InvalidArgumentException",
"(",
"'The role was not found.'",
")",
";",
"}"
] | Remove a binding from the policy.
Example:
```
$builder->setBindings([
[
'role' => 'roles/admin',
'members' => [
'user:admin@domain.com',
'user2:admin@domain.com'
]
]
]);
$builder->removeBinding('roles/admin', [ 'user:admin@domain.com' ]);
```
@param string $role A valid role for the service
@param array $members An array of members to remove from the role
@return PolicyBuilder
@throws InvalidArgumentException | [
"Remove",
"a",
"binding",
"from",
"the",
"policy",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Core/src/Iam/PolicyBuilder.php#L148-L171 | train |
googleapis/google-cloud-php | Logging/src/Logger.php | Logger.entries | public function entries(array $options = [])
{
$resultLimit = $this->pluck('resultLimit', $options, false);
$logNameFilter = "logName = $this->formattedName";
$options += [
'resourceNames' => ["projects/$this->projectId"],
'filter' => isset($options['filter'])
? $options['filter'] .= " AND $logNameFilter"
: $logNameFilter
];
return new ItemIterator(
new PageIterator(
function (array $entry) {
return new Entry($entry);
},
[$this->connection, 'listEntries'],
$options,
[
'itemsKey' => 'entries',
'resultLimit' => $resultLimit
]
)
);
} | php | public function entries(array $options = [])
{
$resultLimit = $this->pluck('resultLimit', $options, false);
$logNameFilter = "logName = $this->formattedName";
$options += [
'resourceNames' => ["projects/$this->projectId"],
'filter' => isset($options['filter'])
? $options['filter'] .= " AND $logNameFilter"
: $logNameFilter
];
return new ItemIterator(
new PageIterator(
function (array $entry) {
return new Entry($entry);
},
[$this->connection, 'listEntries'],
$options,
[
'itemsKey' => 'entries',
'resultLimit' => $resultLimit
]
)
);
} | [
"public",
"function",
"entries",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"resultLimit",
"=",
"$",
"this",
"->",
"pluck",
"(",
"'resultLimit'",
",",
"$",
"options",
",",
"false",
")",
";",
"$",
"logNameFilter",
"=",
"\"logName = $this->formattedName\"",
";",
"$",
"options",
"+=",
"[",
"'resourceNames'",
"=>",
"[",
"\"projects/$this->projectId\"",
"]",
",",
"'filter'",
"=>",
"isset",
"(",
"$",
"options",
"[",
"'filter'",
"]",
")",
"?",
"$",
"options",
"[",
"'filter'",
"]",
".=",
"\" AND $logNameFilter\"",
":",
"$",
"logNameFilter",
"]",
";",
"return",
"new",
"ItemIterator",
"(",
"new",
"PageIterator",
"(",
"function",
"(",
"array",
"$",
"entry",
")",
"{",
"return",
"new",
"Entry",
"(",
"$",
"entry",
")",
";",
"}",
",",
"[",
"$",
"this",
"->",
"connection",
",",
"'listEntries'",
"]",
",",
"$",
"options",
",",
"[",
"'itemsKey'",
"=>",
"'entries'",
",",
"'resultLimit'",
"=>",
"$",
"resultLimit",
"]",
")",
")",
";",
"}"
] | Fetches entries scoped to the selected log.
Please note that a default filter specifying the logName will be applied
for you.
Example:
```
$entries = $logger->entries();
foreach ($entries as $entry) {
echo $entry->info()['textPayload'] . PHP_EOL;
}
```
```
// Use an advanced logs filter to fetch only entries with a specific payload.
$entries = $logger->entries([
'filter' => 'textPayload = "hello world"'
]);
foreach ($entries as $entry) {
echo $entry->info()['textPayload'] . PHP_EOL;
}
```
@codingStandardsIgnoreStart
@see https://cloud.google.com/logging/docs/api/reference/rest/v2/entries/list Entries list API documentation.
@codingStandardsIgnoreEnd
@param array $options [optional] {
Configuration options.
@type string $filter An [advanced logs filter](https://cloud.google.com/logging/docs/view/advanced_filters).
@type string $orderBy How the results should be sorted. Presently,
the only permitted values are `timestamp asc` and `timestamp desc`.
**Defaults to** `"timestamp asc"`.
@type int $pageSize The maximum number of results to return per
request.
@type int $resultLimit Limit the number of results returned in total.
**Defaults to** `0` (return all results).
@type string $pageToken A previously-returned page token used to
resume the loading of results from a specific point.
}
@return ItemIterator<Entry> | [
"Fetches",
"entries",
"scoped",
"to",
"the",
"selected",
"log",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Logging/src/Logger.php#L203-L227 | train |
googleapis/google-cloud-php | Logging/src/Logger.php | Logger.write | public function write($entry, array $options = [])
{
$entryOptions = $this->pluckArray($this->entryOptions, $options);
$this->writeBatch(
[$this->handleEntry($entry, $entryOptions)],
$options
);
} | php | public function write($entry, array $options = [])
{
$entryOptions = $this->pluckArray($this->entryOptions, $options);
$this->writeBatch(
[$this->handleEntry($entry, $entryOptions)],
$options
);
} | [
"public",
"function",
"write",
"(",
"$",
"entry",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"entryOptions",
"=",
"$",
"this",
"->",
"pluckArray",
"(",
"$",
"this",
"->",
"entryOptions",
",",
"$",
"options",
")",
";",
"$",
"this",
"->",
"writeBatch",
"(",
"[",
"$",
"this",
"->",
"handleEntry",
"(",
"$",
"entry",
",",
"$",
"entryOptions",
")",
"]",
",",
"$",
"options",
")",
";",
"}"
] | Write a single entry to the log.
Example:
```
// Writing a simple log entry.
$logger->write('a log entry');
```
```
// Writing a simple entry with a key/value set of data and a severity of `EMERGENCY`.
$logger->write(['user' => 'calvin'], [
'severity' => Logger::EMERGENCY
]);
```
```
// Using the entry factory method to write a log entry.
$entry = $logger->entry('a log entry');
$logger->write($entry);
```
@codingStandardsIgnoreStart
@see https://cloud.google.com/logging/docs/api/reference/rest/v2/entries/write Entries write API documentation.
@codingStandardsIgnoreEnd
@param array|string|Entry $entry The entry to write to the log.
@param array $options [optional] Please see
{@see Google\Cloud\Logging\Logger::entry()} to see the options
that can be applied to a log entry. Please note that if the
provided entry is of type `Entry` these options will overwrite
those that may already be set on the instance.
@throws \InvalidArgumentException | [
"Write",
"a",
"single",
"entry",
"to",
"the",
"log",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Logging/src/Logger.php#L353-L360 | train |
googleapis/google-cloud-php | Logging/src/Logger.php | Logger.writeBatch | public function writeBatch(array $entries, array $options = [])
{
$this->validateBatch($entries, Entry::class);
foreach ($entries as &$entry) {
$entry = $entry->info();
}
$this->connection->writeEntries($options + ['entries' => $entries]);
} | php | public function writeBatch(array $entries, array $options = [])
{
$this->validateBatch($entries, Entry::class);
foreach ($entries as &$entry) {
$entry = $entry->info();
}
$this->connection->writeEntries($options + ['entries' => $entries]);
} | [
"public",
"function",
"writeBatch",
"(",
"array",
"$",
"entries",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"validateBatch",
"(",
"$",
"entries",
",",
"Entry",
"::",
"class",
")",
";",
"foreach",
"(",
"$",
"entries",
"as",
"&",
"$",
"entry",
")",
"{",
"$",
"entry",
"=",
"$",
"entry",
"->",
"info",
"(",
")",
";",
"}",
"$",
"this",
"->",
"connection",
"->",
"writeEntries",
"(",
"$",
"options",
"+",
"[",
"'entries'",
"=>",
"$",
"entries",
"]",
")",
";",
"}"
] | Write a set of entries to the log.
Example:
```
$entries = [];
$entries[] = $logger->entry('my message');
$entries[] = $logger->entry('my second message');
$logger->writeBatch($entries);
```
@codingStandardsIgnoreStart
@see https://cloud.google.com/logging/docs/api/reference/rest/v2/entries/write Entries write API documentation.
@codingStandardsIgnoreEnd
@param Entry[] $entries Entries to write to the log.
@param array $options [optional] Configuration Options. | [
"Write",
"a",
"set",
"of",
"entries",
"to",
"the",
"log",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Logging/src/Logger.php#L381-L390 | train |
googleapis/google-cloud-php | Firestore/src/V1/ListenResponse.php | ListenResponse.setTargetChange | public function setTargetChange($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\TargetChange::class);
$this->writeOneof(2, $var);
return $this;
} | php | public function setTargetChange($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\TargetChange::class);
$this->writeOneof(2, $var);
return $this;
} | [
"public",
"function",
"setTargetChange",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Firestore",
"\\",
"V1",
"\\",
"TargetChange",
"::",
"class",
")",
";",
"$",
"this",
"->",
"writeOneof",
"(",
"2",
",",
"$",
"var",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Targets have changed.
Generated from protobuf field <code>.google.firestore.v1.TargetChange target_change = 2;</code>
@param \Google\Cloud\Firestore\V1\TargetChange $var
@return $this | [
"Targets",
"have",
"changed",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/V1/ListenResponse.php#L65-L71 | train |
googleapis/google-cloud-php | Storage/src/Lifecycle.php | Lifecycle.clearRules | public function clearRules($action = null)
{
if (!$action) {
$this->lifecycle = [];
return $this;
}
if (!is_string($action) && !is_callable($action)) {
throw new \InvalidArgumentException(
sprintf(
'Expected either a string or callable, instead got \'%s\'.',
gettype($action)
)
);
}
if (isset($this->lifecycle['rule'])) {
if (is_string($action)) {
$action = function ($rule) use ($action) {
return $rule['action']['type'] !== $action;
};
}
$this->lifecycle['rule'] = array_filter(
$this->lifecycle['rule'],
$action
);
if (!$this->lifecycle['rule']) {
$this->lifecycle = [];
}
}
return $this;
} | php | public function clearRules($action = null)
{
if (!$action) {
$this->lifecycle = [];
return $this;
}
if (!is_string($action) && !is_callable($action)) {
throw new \InvalidArgumentException(
sprintf(
'Expected either a string or callable, instead got \'%s\'.',
gettype($action)
)
);
}
if (isset($this->lifecycle['rule'])) {
if (is_string($action)) {
$action = function ($rule) use ($action) {
return $rule['action']['type'] !== $action;
};
}
$this->lifecycle['rule'] = array_filter(
$this->lifecycle['rule'],
$action
);
if (!$this->lifecycle['rule']) {
$this->lifecycle = [];
}
}
return $this;
} | [
"public",
"function",
"clearRules",
"(",
"$",
"action",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"action",
")",
"{",
"$",
"this",
"->",
"lifecycle",
"=",
"[",
"]",
";",
"return",
"$",
"this",
";",
"}",
"if",
"(",
"!",
"is_string",
"(",
"$",
"action",
")",
"&&",
"!",
"is_callable",
"(",
"$",
"action",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'Expected either a string or callable, instead got \\'%s\\'.'",
",",
"gettype",
"(",
"$",
"action",
")",
")",
")",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"lifecycle",
"[",
"'rule'",
"]",
")",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"action",
")",
")",
"{",
"$",
"action",
"=",
"function",
"(",
"$",
"rule",
")",
"use",
"(",
"$",
"action",
")",
"{",
"return",
"$",
"rule",
"[",
"'action'",
"]",
"[",
"'type'",
"]",
"!==",
"$",
"action",
";",
"}",
";",
"}",
"$",
"this",
"->",
"lifecycle",
"[",
"'rule'",
"]",
"=",
"array_filter",
"(",
"$",
"this",
"->",
"lifecycle",
"[",
"'rule'",
"]",
",",
"$",
"action",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"lifecycle",
"[",
"'rule'",
"]",
")",
"{",
"$",
"this",
"->",
"lifecycle",
"=",
"[",
"]",
";",
"}",
"}",
"return",
"$",
"this",
";",
"}"
] | Clear all Object Lifecycle rules or rules of a certain action type.
Example:
```
// Remove all rules.
$lifecycle->clearRules();
```
```
// Remove all "Delete" based rules.
$lifecycle->clearRules('Delete');
```
```
// Clear any rules which have an age equal to 50.
$lifecycle->clearRules(function (array $rule) {
return $rule['condition']['age'] === 50
? false
: true;
});
```
@param string|callable $action [optional] If a string is provided, it
must be the name of the type of rule to remove (`SetStorageClass`
or `Delete`). All rules of this type will then be cleared. When
providing a callable you may define a custom route for how you
would like to remove rules. The provided callable will be run
through
[array_filter](http://php.net/manual/en/function.array-filter.php).
The callable's argument will be a single lifecycle rule as an
associative array. When returning true from the callable the rule
will be preserved, and if false it will be removed.
**Defaults to** `null`, clearing all assigned rules.
@return Lifecycle
@throws \InvalidArgumentException If a type other than a string or
callabe is provided. | [
"Clear",
"all",
"Object",
"Lifecycle",
"rules",
"or",
"rules",
"of",
"a",
"certain",
"action",
"type",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Storage/src/Lifecycle.php#L201-L235 | train |
googleapis/google-cloud-php | Container/src/V1/SetMaintenancePolicyRequest.php | SetMaintenancePolicyRequest.setMaintenancePolicy | public function setMaintenancePolicy($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Container\V1\MaintenancePolicy::class);
$this->maintenance_policy = $var;
return $this;
} | php | public function setMaintenancePolicy($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Container\V1\MaintenancePolicy::class);
$this->maintenance_policy = $var;
return $this;
} | [
"public",
"function",
"setMaintenancePolicy",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Container",
"\\",
"V1",
"\\",
"MaintenancePolicy",
"::",
"class",
")",
";",
"$",
"this",
"->",
"maintenance_policy",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | The maintenance policy to be set for the cluster. An empty field
clears the existing maintenance policy.
Generated from protobuf field <code>.google.container.v1.MaintenancePolicy maintenance_policy = 4;</code>
@param \Google\Cloud\Container\V1\MaintenancePolicy $var
@return $this | [
"The",
"maintenance",
"policy",
"to",
"be",
"set",
"for",
"the",
"cluster",
".",
"An",
"empty",
"field",
"clears",
"the",
"existing",
"maintenance",
"policy",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Container/src/V1/SetMaintenancePolicyRequest.php#L188-L194 | train |
googleapis/google-cloud-php | Core/src/ArrayTrait.php | ArrayTrait.pluck | private function pluck($key, array &$arr, $isRequired = true)
{
if (!array_key_exists($key, $arr)) {
if ($isRequired) {
throw new \InvalidArgumentException(
"Key $key does not exist in the provided array."
);
}
return null;
}
$value = $arr[$key];
unset($arr[$key]);
return $value;
} | php | private function pluck($key, array &$arr, $isRequired = true)
{
if (!array_key_exists($key, $arr)) {
if ($isRequired) {
throw new \InvalidArgumentException(
"Key $key does not exist in the provided array."
);
}
return null;
}
$value = $arr[$key];
unset($arr[$key]);
return $value;
} | [
"private",
"function",
"pluck",
"(",
"$",
"key",
",",
"array",
"&",
"$",
"arr",
",",
"$",
"isRequired",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"arr",
")",
")",
"{",
"if",
"(",
"$",
"isRequired",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"\"Key $key does not exist in the provided array.\"",
")",
";",
"}",
"return",
"null",
";",
"}",
"$",
"value",
"=",
"$",
"arr",
"[",
"$",
"key",
"]",
";",
"unset",
"(",
"$",
"arr",
"[",
"$",
"key",
"]",
")",
";",
"return",
"$",
"value",
";",
"}"
] | Pluck a value out of an array.
@param string $key
@param array $arr
@param bool $isRequired
@return string|null
@throws \InvalidArgumentException | [
"Pluck",
"a",
"value",
"out",
"of",
"an",
"array",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Core/src/ArrayTrait.php#L34-L49 | train |
googleapis/google-cloud-php | Core/src/ArrayTrait.php | ArrayTrait.pluckArray | private function pluckArray(array $keys, &$arr)
{
$values = [];
foreach ($keys as $key) {
if (array_key_exists($key, $arr)) {
$values[$key] = $this->pluck($key, $arr, false);
}
}
return $values;
} | php | private function pluckArray(array $keys, &$arr)
{
$values = [];
foreach ($keys as $key) {
if (array_key_exists($key, $arr)) {
$values[$key] = $this->pluck($key, $arr, false);
}
}
return $values;
} | [
"private",
"function",
"pluckArray",
"(",
"array",
"$",
"keys",
",",
"&",
"$",
"arr",
")",
"{",
"$",
"values",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"keys",
"as",
"$",
"key",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"arr",
")",
")",
"{",
"$",
"values",
"[",
"$",
"key",
"]",
"=",
"$",
"this",
"->",
"pluck",
"(",
"$",
"key",
",",
"$",
"arr",
",",
"false",
")",
";",
"}",
"}",
"return",
"$",
"values",
";",
"}"
] | Pluck a subset of an array.
@param string $keys
@param array $arr
@return array | [
"Pluck",
"a",
"subset",
"of",
"an",
"array",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Core/src/ArrayTrait.php#L58-L69 | train |
googleapis/google-cloud-php | Core/src/ArrayTrait.php | ArrayTrait.arrayMergeRecursive | private function arrayMergeRecursive(array $array1, array $array2)
{
foreach ($array2 as $key => $value) {
if (array_key_exists($key, $array1) && is_array($array1[$key]) && is_array($value)) {
$array1[$key] = ($this->isAssoc($array1[$key]) && $this->isAssoc($value))
? $this->arrayMergeRecursive($array1[$key], $value)
: array_merge($array1[$key], $value);
} else {
$array1[$key] = $value;
}
}
return $array1;
} | php | private function arrayMergeRecursive(array $array1, array $array2)
{
foreach ($array2 as $key => $value) {
if (array_key_exists($key, $array1) && is_array($array1[$key]) && is_array($value)) {
$array1[$key] = ($this->isAssoc($array1[$key]) && $this->isAssoc($value))
? $this->arrayMergeRecursive($array1[$key], $value)
: array_merge($array1[$key], $value);
} else {
$array1[$key] = $value;
}
}
return $array1;
} | [
"private",
"function",
"arrayMergeRecursive",
"(",
"array",
"$",
"array1",
",",
"array",
"$",
"array2",
")",
"{",
"foreach",
"(",
"$",
"array2",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"array1",
")",
"&&",
"is_array",
"(",
"$",
"array1",
"[",
"$",
"key",
"]",
")",
"&&",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"$",
"array1",
"[",
"$",
"key",
"]",
"=",
"(",
"$",
"this",
"->",
"isAssoc",
"(",
"$",
"array1",
"[",
"$",
"key",
"]",
")",
"&&",
"$",
"this",
"->",
"isAssoc",
"(",
"$",
"value",
")",
")",
"?",
"$",
"this",
"->",
"arrayMergeRecursive",
"(",
"$",
"array1",
"[",
"$",
"key",
"]",
",",
"$",
"value",
")",
":",
"array_merge",
"(",
"$",
"array1",
"[",
"$",
"key",
"]",
",",
"$",
"value",
")",
";",
"}",
"else",
"{",
"$",
"array1",
"[",
"$",
"key",
"]",
"=",
"$",
"value",
";",
"}",
"}",
"return",
"$",
"array1",
";",
"}"
] | A method, similar to PHP's `array_merge_recursive`, with two differences.
1. Keys in $array2 take precedence over keys in $array1.
2. Non-array keys found in both inputs are not transformed into an array
and appended. Rather, the value in $array2 is used.
@param array $array1
@param array $array2
@return array | [
"A",
"method",
"similar",
"to",
"PHP",
"s",
"array_merge_recursive",
"with",
"two",
"differences",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Core/src/ArrayTrait.php#L106-L119 | train |
googleapis/google-cloud-php | Logging/src/Sink.php | Sink.update | public function update(array $metadata, array $options = [])
{
$options += $metadata;
$options += $this->info($options);
return $this->info = $this->connection->updateSink($options + [
'sinkName' => $this->formattedName
]);
} | php | public function update(array $metadata, array $options = [])
{
$options += $metadata;
$options += $this->info($options);
return $this->info = $this->connection->updateSink($options + [
'sinkName' => $this->formattedName
]);
} | [
"public",
"function",
"update",
"(",
"array",
"$",
"metadata",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"+=",
"$",
"metadata",
";",
"$",
"options",
"+=",
"$",
"this",
"->",
"info",
"(",
"$",
"options",
")",
";",
"return",
"$",
"this",
"->",
"info",
"=",
"$",
"this",
"->",
"connection",
"->",
"updateSink",
"(",
"$",
"options",
"+",
"[",
"'sinkName'",
"=>",
"$",
"this",
"->",
"formattedName",
"]",
")",
";",
"}"
] | Update the sink. Please note this will trigger a network request if
cached data is not available to perform the update with.
Example:
```
$sink->update([
'destination' => 'storage.googleapis.com/my-bucket'
]);
```
@codingStandardsIgnoreStart
@see https://cloud.google.com/logging/docs/api/reference/rest/v2/projects.sinks/update projects.sinks update API documentation.
@codingStandardsIgnoreEnd
@param array $metadata {
The data to update.
@type string $destination The export destination. Please see
[Exporting Logs With Sinks](https://cloud.google.com/logging/docs/api/tasks/exporting-logs#about_sinks)
for more information and examples.
@type string $filter An [advanced logs filter](https://cloud.google.com/logging/docs/view/advanced_filters).
@type string $outputVersionFormat The log entry version to use for
this sink's exported log entries. This version does not have
to correspond to the version of the log entry when it was
written to Stackdriver Logging. May be either `V1` or `V2`.
}
@param array $options [optional] Configuration Options.
@return array | [
"Update",
"the",
"sink",
".",
"Please",
"note",
"this",
"will",
"trigger",
"a",
"network",
"request",
"if",
"cached",
"data",
"is",
"not",
"available",
"to",
"perform",
"the",
"update",
"with",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Logging/src/Sink.php#L147-L155 | train |
googleapis/google-cloud-php | Logging/src/Sink.php | Sink.reload | public function reload(array $options = [])
{
return $this->info = $this->connection->getSink($options + [
'sinkName' => $this->formattedName
]);
} | php | public function reload(array $options = [])
{
return $this->info = $this->connection->getSink($options + [
'sinkName' => $this->formattedName
]);
} | [
"public",
"function",
"reload",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"info",
"=",
"$",
"this",
"->",
"connection",
"->",
"getSink",
"(",
"$",
"options",
"+",
"[",
"'sinkName'",
"=>",
"$",
"this",
"->",
"formattedName",
"]",
")",
";",
"}"
] | Triggers a network request to reload the sink's details.
Example:
```
$sink->reload();
$info = $sink->info();
echo $info['destination'];
```
@codingStandardsIgnoreStart
@see https://cloud.google.com/logging/docs/api/reference/rest/v2/projects.sinks/get projects.sinks get API documentation.
@codingStandardsIgnoreEnd
@param array $options [optional] Configuration Options.
@return array | [
"Triggers",
"a",
"network",
"request",
"to",
"reload",
"the",
"sink",
"s",
"details",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Logging/src/Sink.php#L200-L205 | train |
googleapis/google-cloud-php | Dlp/src/V2/RedactImageRequest.php | RedactImageRequest.setImageRedactionConfigs | public function setImageRedactionConfigs($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dlp\V2\RedactImageRequest\ImageRedactionConfig::class);
$this->image_redaction_configs = $arr;
return $this;
} | php | public function setImageRedactionConfigs($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dlp\V2\RedactImageRequest\ImageRedactionConfig::class);
$this->image_redaction_configs = $arr;
return $this;
} | [
"public",
"function",
"setImageRedactionConfigs",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dlp",
"\\",
"V2",
"\\",
"RedactImageRequest",
"\\",
"ImageRedactionConfig",
"::",
"class",
")",
";",
"$",
"this",
"->",
"image_redaction_configs",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | The configuration for specifying what content to redact from images.
Generated from protobuf field <code>repeated .google.privacy.dlp.v2.RedactImageRequest.ImageRedactionConfig image_redaction_configs = 5;</code>
@param \Google\Cloud\Dlp\V2\RedactImageRequest\ImageRedactionConfig[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"The",
"configuration",
"for",
"specifying",
"what",
"content",
"to",
"redact",
"from",
"images",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/RedactImageRequest.php#L145-L151 | train |
googleapis/google-cloud-php | Dlp/src/V2/RedactImageRequest.php | RedactImageRequest.setByteItem | public function setByteItem($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\ByteContentItem::class);
$this->byte_item = $var;
return $this;
} | php | public function setByteItem($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\ByteContentItem::class);
$this->byte_item = $var;
return $this;
} | [
"public",
"function",
"setByteItem",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dlp",
"\\",
"V2",
"\\",
"ByteContentItem",
"::",
"class",
")",
";",
"$",
"this",
"->",
"byte_item",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | The content must be PNG, JPEG, SVG or BMP.
Generated from protobuf field <code>.google.privacy.dlp.v2.ByteContentItem byte_item = 7;</code>
@param \Google\Cloud\Dlp\V2\ByteContentItem $var
@return $this | [
"The",
"content",
"must",
"be",
"PNG",
"JPEG",
"SVG",
"or",
"BMP",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/RedactImageRequest.php#L199-L205 | train |
googleapis/google-cloud-php | Talent/src/V4beta1/SearchProfilesResponse.php | SearchProfilesResponse.setSpellCorrection | public function setSpellCorrection($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Talent\V4beta1\SpellingCorrection::class);
$this->spell_correction = $var;
return $this;
} | php | public function setSpellCorrection($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Talent\V4beta1\SpellingCorrection::class);
$this->spell_correction = $var;
return $this;
} | [
"public",
"function",
"setSpellCorrection",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Talent",
"\\",
"V4beta1",
"\\",
"SpellingCorrection",
"::",
"class",
")",
";",
"$",
"this",
"->",
"spell_correction",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | The spell checking result, and correction.
Generated from protobuf field <code>.google.cloud.talent.v4beta1.SpellingCorrection spell_correction = 2;</code>
@param \Google\Cloud\Talent\V4beta1\SpellingCorrection $var
@return $this | [
"The",
"spell",
"checking",
"result",
"and",
"correction",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Talent/src/V4beta1/SearchProfilesResponse.php#L136-L142 | train |
googleapis/google-cloud-php | Bigtable/src/Admin/V2/Instance.php | Instance.setType | public function setType($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Bigtable\Admin\V2\Instance_Type::class);
$this->type = $var;
return $this;
} | php | public function setType($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Bigtable\Admin\V2\Instance_Type::class);
$this->type = $var;
return $this;
} | [
"public",
"function",
"setType",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Bigtable",
"\\",
"Admin",
"\\",
"V2",
"\\",
"Instance_Type",
"::",
"class",
")",
";",
"$",
"this",
"->",
"type",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | The type of the instance. Defaults to `PRODUCTION`.
Generated from protobuf field <code>.google.bigtable.admin.v2.Instance.Type type = 4;</code>
@param int $var
@return $this | [
"The",
"type",
"of",
"the",
"instance",
".",
"Defaults",
"to",
"PRODUCTION",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Bigtable/src/Admin/V2/Instance.php#L209-L215 | train |
googleapis/google-cloud-php | Bigtable/src/Admin/V2/GcRule/Intersection.php | Intersection.setRules | public function setRules($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Bigtable\Admin\V2\GcRule::class);
$this->rules = $arr;
return $this;
} | php | public function setRules($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Bigtable\Admin\V2\GcRule::class);
$this->rules = $arr;
return $this;
} | [
"public",
"function",
"setRules",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Bigtable",
"\\",
"Admin",
"\\",
"V2",
"\\",
"GcRule",
"::",
"class",
")",
";",
"$",
"this",
"->",
"rules",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | Only delete cells which would be deleted by every element of `rules`.
Generated from protobuf field <code>repeated .google.bigtable.admin.v2.GcRule rules = 1;</code>
@param \Google\Cloud\Bigtable\Admin\V2\GcRule[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"Only",
"delete",
"cells",
"which",
"would",
"be",
"deleted",
"by",
"every",
"element",
"of",
"rules",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Bigtable/src/Admin/V2/GcRule/Intersection.php#L58-L64 | train |
googleapis/google-cloud-php | Spanner/src/Session/CacheSessionPool.php | CacheSessionPool.release | public function release(Session $session)
{
$this->config['lock']->synchronize(function () use ($session) {
$item = $this->cacheItemPool->getItem($this->cacheKey);
$data = $item->get();
$name = $session->name();
if (isset($data['inUse'][$name])) {
unset($data['inUse'][$name]);
array_push($data['queue'], [
'name' => $name,
'expiration' => $session->expiration()
?: $this->time() + SessionPoolInterface::SESSION_EXPIRATION_SECONDS
]);
$this->cacheItemPool->save($item->set($data));
}
});
} | php | public function release(Session $session)
{
$this->config['lock']->synchronize(function () use ($session) {
$item = $this->cacheItemPool->getItem($this->cacheKey);
$data = $item->get();
$name = $session->name();
if (isset($data['inUse'][$name])) {
unset($data['inUse'][$name]);
array_push($data['queue'], [
'name' => $name,
'expiration' => $session->expiration()
?: $this->time() + SessionPoolInterface::SESSION_EXPIRATION_SECONDS
]);
$this->cacheItemPool->save($item->set($data));
}
});
} | [
"public",
"function",
"release",
"(",
"Session",
"$",
"session",
")",
"{",
"$",
"this",
"->",
"config",
"[",
"'lock'",
"]",
"->",
"synchronize",
"(",
"function",
"(",
")",
"use",
"(",
"$",
"session",
")",
"{",
"$",
"item",
"=",
"$",
"this",
"->",
"cacheItemPool",
"->",
"getItem",
"(",
"$",
"this",
"->",
"cacheKey",
")",
";",
"$",
"data",
"=",
"$",
"item",
"->",
"get",
"(",
")",
";",
"$",
"name",
"=",
"$",
"session",
"->",
"name",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"data",
"[",
"'inUse'",
"]",
"[",
"$",
"name",
"]",
")",
")",
"{",
"unset",
"(",
"$",
"data",
"[",
"'inUse'",
"]",
"[",
"$",
"name",
"]",
")",
";",
"array_push",
"(",
"$",
"data",
"[",
"'queue'",
"]",
",",
"[",
"'name'",
"=>",
"$",
"name",
",",
"'expiration'",
"=>",
"$",
"session",
"->",
"expiration",
"(",
")",
"?",
":",
"$",
"this",
"->",
"time",
"(",
")",
"+",
"SessionPoolInterface",
"::",
"SESSION_EXPIRATION_SECONDS",
"]",
")",
";",
"$",
"this",
"->",
"cacheItemPool",
"->",
"save",
"(",
"$",
"item",
"->",
"set",
"(",
"$",
"data",
")",
")",
";",
"}",
"}",
")",
";",
"}"
] | Release a session back to the pool.
@param Session $session The session. | [
"Release",
"a",
"session",
"back",
"to",
"the",
"pool",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Session/CacheSessionPool.php#L311-L328 | train |
googleapis/google-cloud-php | Spanner/src/Session/CacheSessionPool.php | CacheSessionPool.keepAlive | public function keepAlive(Session $session)
{
$this->config['lock']->synchronize(function () use ($session) {
$item = $this->cacheItemPool->getItem($this->cacheKey);
$data = $item->get();
$data['inUse'][$session->name()]['lastActive'] = $this->time();
$this->cacheItemPool->save($item->set($data));
});
} | php | public function keepAlive(Session $session)
{
$this->config['lock']->synchronize(function () use ($session) {
$item = $this->cacheItemPool->getItem($this->cacheKey);
$data = $item->get();
$data['inUse'][$session->name()]['lastActive'] = $this->time();
$this->cacheItemPool->save($item->set($data));
});
} | [
"public",
"function",
"keepAlive",
"(",
"Session",
"$",
"session",
")",
"{",
"$",
"this",
"->",
"config",
"[",
"'lock'",
"]",
"->",
"synchronize",
"(",
"function",
"(",
")",
"use",
"(",
"$",
"session",
")",
"{",
"$",
"item",
"=",
"$",
"this",
"->",
"cacheItemPool",
"->",
"getItem",
"(",
"$",
"this",
"->",
"cacheKey",
")",
";",
"$",
"data",
"=",
"$",
"item",
"->",
"get",
"(",
")",
";",
"$",
"data",
"[",
"'inUse'",
"]",
"[",
"$",
"session",
"->",
"name",
"(",
")",
"]",
"[",
"'lastActive'",
"]",
"=",
"$",
"this",
"->",
"time",
"(",
")",
";",
"$",
"this",
"->",
"cacheItemPool",
"->",
"save",
"(",
"$",
"item",
"->",
"set",
"(",
"$",
"data",
")",
")",
";",
"}",
")",
";",
"}"
] | Keeps a checked out session alive.
In use sessions that have not had their `lastActive` time updated
in the last 20 minutes will be considered eligible to be moved back into
the queue if the max sessions value has been met. In order to work around
this when performing a large streaming execute or read call please make
sure to call this method roughly every 15 minutes between reading rows
to keep your session active.
@param Session $session The session to keep alive. | [
"Keeps",
"a",
"checked",
"out",
"session",
"alive",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Session/CacheSessionPool.php#L342-L351 | train |
googleapis/google-cloud-php | Spanner/src/Session/CacheSessionPool.php | CacheSessionPool.warmup | public function warmup()
{
$toCreate = $this->config['lock']->synchronize(function () {
$item = $this->cacheItemPool->getItem($this->cacheKey);
$data = (array) $item->get() ?: $this->initialize();
$count = $this->getSessionCount($data);
$toCreate = [];
if ($count < $this->config['minSessions']) {
$toCreate = $this->buildToCreateList($this->config['minSessions'] - $count);
$data['toCreate'] += $toCreate;
$this->cacheItemPool->save($item->set($data));
}
return $toCreate;
});
if (!$toCreate) {
return 0;
}
$createdSessions = [];
$exception = null;
try {
$createdSessions = $this->createSessions(count($toCreate));
} catch (\Exception $exception) {
}
$this->config['lock']->synchronize(function () use ($toCreate, $createdSessions) {
$item = $this->cacheItemPool->getItem($this->cacheKey);
$data = $item->get();
$data['queue'] = array_merge($data['queue'], $createdSessions);
// Now that we've created the sessions, we can remove them from
// the list of intent.
foreach ($toCreate as $id => $time) {
unset($data['toCreate'][$id]);
}
$this->cacheItemPool->save($item->set($data));
});
if ($exception) {
throw $exception;
}
return count($toCreate);
} | php | public function warmup()
{
$toCreate = $this->config['lock']->synchronize(function () {
$item = $this->cacheItemPool->getItem($this->cacheKey);
$data = (array) $item->get() ?: $this->initialize();
$count = $this->getSessionCount($data);
$toCreate = [];
if ($count < $this->config['minSessions']) {
$toCreate = $this->buildToCreateList($this->config['minSessions'] - $count);
$data['toCreate'] += $toCreate;
$this->cacheItemPool->save($item->set($data));
}
return $toCreate;
});
if (!$toCreate) {
return 0;
}
$createdSessions = [];
$exception = null;
try {
$createdSessions = $this->createSessions(count($toCreate));
} catch (\Exception $exception) {
}
$this->config['lock']->synchronize(function () use ($toCreate, $createdSessions) {
$item = $this->cacheItemPool->getItem($this->cacheKey);
$data = $item->get();
$data['queue'] = array_merge($data['queue'], $createdSessions);
// Now that we've created the sessions, we can remove them from
// the list of intent.
foreach ($toCreate as $id => $time) {
unset($data['toCreate'][$id]);
}
$this->cacheItemPool->save($item->set($data));
});
if ($exception) {
throw $exception;
}
return count($toCreate);
} | [
"public",
"function",
"warmup",
"(",
")",
"{",
"$",
"toCreate",
"=",
"$",
"this",
"->",
"config",
"[",
"'lock'",
"]",
"->",
"synchronize",
"(",
"function",
"(",
")",
"{",
"$",
"item",
"=",
"$",
"this",
"->",
"cacheItemPool",
"->",
"getItem",
"(",
"$",
"this",
"->",
"cacheKey",
")",
";",
"$",
"data",
"=",
"(",
"array",
")",
"$",
"item",
"->",
"get",
"(",
")",
"?",
":",
"$",
"this",
"->",
"initialize",
"(",
")",
";",
"$",
"count",
"=",
"$",
"this",
"->",
"getSessionCount",
"(",
"$",
"data",
")",
";",
"$",
"toCreate",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"count",
"<",
"$",
"this",
"->",
"config",
"[",
"'minSessions'",
"]",
")",
"{",
"$",
"toCreate",
"=",
"$",
"this",
"->",
"buildToCreateList",
"(",
"$",
"this",
"->",
"config",
"[",
"'minSessions'",
"]",
"-",
"$",
"count",
")",
";",
"$",
"data",
"[",
"'toCreate'",
"]",
"+=",
"$",
"toCreate",
";",
"$",
"this",
"->",
"cacheItemPool",
"->",
"save",
"(",
"$",
"item",
"->",
"set",
"(",
"$",
"data",
")",
")",
";",
"}",
"return",
"$",
"toCreate",
";",
"}",
")",
";",
"if",
"(",
"!",
"$",
"toCreate",
")",
"{",
"return",
"0",
";",
"}",
"$",
"createdSessions",
"=",
"[",
"]",
";",
"$",
"exception",
"=",
"null",
";",
"try",
"{",
"$",
"createdSessions",
"=",
"$",
"this",
"->",
"createSessions",
"(",
"count",
"(",
"$",
"toCreate",
")",
")",
";",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"exception",
")",
"{",
"}",
"$",
"this",
"->",
"config",
"[",
"'lock'",
"]",
"->",
"synchronize",
"(",
"function",
"(",
")",
"use",
"(",
"$",
"toCreate",
",",
"$",
"createdSessions",
")",
"{",
"$",
"item",
"=",
"$",
"this",
"->",
"cacheItemPool",
"->",
"getItem",
"(",
"$",
"this",
"->",
"cacheKey",
")",
";",
"$",
"data",
"=",
"$",
"item",
"->",
"get",
"(",
")",
";",
"$",
"data",
"[",
"'queue'",
"]",
"=",
"array_merge",
"(",
"$",
"data",
"[",
"'queue'",
"]",
",",
"$",
"createdSessions",
")",
";",
"// Now that we've created the sessions, we can remove them from",
"// the list of intent.",
"foreach",
"(",
"$",
"toCreate",
"as",
"$",
"id",
"=>",
"$",
"time",
")",
"{",
"unset",
"(",
"$",
"data",
"[",
"'toCreate'",
"]",
"[",
"$",
"id",
"]",
")",
";",
"}",
"$",
"this",
"->",
"cacheItemPool",
"->",
"save",
"(",
"$",
"item",
"->",
"set",
"(",
"$",
"data",
")",
")",
";",
"}",
")",
";",
"if",
"(",
"$",
"exception",
")",
"{",
"throw",
"$",
"exception",
";",
"}",
"return",
"count",
"(",
"$",
"toCreate",
")",
";",
"}"
] | Create enough sessions to meet the minimum session constraint.
@return int The number of sessions created and added to the queue. | [
"Create",
"enough",
"sessions",
"to",
"meet",
"the",
"minimum",
"session",
"constraint",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Session/CacheSessionPool.php#L410-L458 | train |
googleapis/google-cloud-php | Spanner/src/Session/CacheSessionPool.php | CacheSessionPool.clear | public function clear()
{
$sessions = $this->config['lock']->synchronize(function () {
$item = $this->cacheItemPool->getItem($this->cacheKey);
$data = (array) $item->get() ?: $this->initialize();
$sessions = $data['queue'] + $data['inUse'];
$this->cacheItemPool->clear();
return $sessions;
});
$this->deleteSessions($sessions);
} | php | public function clear()
{
$sessions = $this->config['lock']->synchronize(function () {
$item = $this->cacheItemPool->getItem($this->cacheKey);
$data = (array) $item->get() ?: $this->initialize();
$sessions = $data['queue'] + $data['inUse'];
$this->cacheItemPool->clear();
return $sessions;
});
$this->deleteSessions($sessions);
} | [
"public",
"function",
"clear",
"(",
")",
"{",
"$",
"sessions",
"=",
"$",
"this",
"->",
"config",
"[",
"'lock'",
"]",
"->",
"synchronize",
"(",
"function",
"(",
")",
"{",
"$",
"item",
"=",
"$",
"this",
"->",
"cacheItemPool",
"->",
"getItem",
"(",
"$",
"this",
"->",
"cacheKey",
")",
";",
"$",
"data",
"=",
"(",
"array",
")",
"$",
"item",
"->",
"get",
"(",
")",
"?",
":",
"$",
"this",
"->",
"initialize",
"(",
")",
";",
"$",
"sessions",
"=",
"$",
"data",
"[",
"'queue'",
"]",
"+",
"$",
"data",
"[",
"'inUse'",
"]",
";",
"$",
"this",
"->",
"cacheItemPool",
"->",
"clear",
"(",
")",
";",
"return",
"$",
"sessions",
";",
"}",
")",
";",
"$",
"this",
"->",
"deleteSessions",
"(",
"$",
"sessions",
")",
";",
"}"
] | Clear the cache and attempt to delete all sessions in the pool.
A session may be removed from the cache, but still tracked as active by
the Spanner backend if a delete operation failed. To ensure you do not
exceed the maximum number of sessions available per node, please be sure
to check the return value of this method to be certain all sessions have
been deleted. | [
"Clear",
"the",
"cache",
"and",
"attempt",
"to",
"delete",
"all",
"sessions",
"in",
"the",
"pool",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Session/CacheSessionPool.php#L469-L481 | train |
googleapis/google-cloud-php | Spanner/src/Session/CacheSessionPool.php | CacheSessionPool.setDatabase | public function setDatabase(Database $database)
{
$this->database = $database;
$identity = $database->identity();
$this->cacheKey = sprintf(
self::CACHE_KEY_TEMPLATE,
$identity['projectId'],
$identity['instance'],
$identity['database']
);
if (!isset($this->config['lock'])) {
$this->config['lock'] = $this->getDefaultLock();
}
} | php | public function setDatabase(Database $database)
{
$this->database = $database;
$identity = $database->identity();
$this->cacheKey = sprintf(
self::CACHE_KEY_TEMPLATE,
$identity['projectId'],
$identity['instance'],
$identity['database']
);
if (!isset($this->config['lock'])) {
$this->config['lock'] = $this->getDefaultLock();
}
} | [
"public",
"function",
"setDatabase",
"(",
"Database",
"$",
"database",
")",
"{",
"$",
"this",
"->",
"database",
"=",
"$",
"database",
";",
"$",
"identity",
"=",
"$",
"database",
"->",
"identity",
"(",
")",
";",
"$",
"this",
"->",
"cacheKey",
"=",
"sprintf",
"(",
"self",
"::",
"CACHE_KEY_TEMPLATE",
",",
"$",
"identity",
"[",
"'projectId'",
"]",
",",
"$",
"identity",
"[",
"'instance'",
"]",
",",
"$",
"identity",
"[",
"'database'",
"]",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"config",
"[",
"'lock'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"config",
"[",
"'lock'",
"]",
"=",
"$",
"this",
"->",
"getDefaultLock",
"(",
")",
";",
"}",
"}"
] | Set the database used to make calls to manage sessions.
@param Database $database The database. | [
"Set",
"the",
"database",
"used",
"to",
"make",
"calls",
"to",
"manage",
"sessions",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Session/CacheSessionPool.php#L488-L502 | train |
googleapis/google-cloud-php | Spanner/src/Session/CacheSessionPool.php | CacheSessionPool.buildToCreateList | private function buildToCreateList($number)
{
$toCreate = [];
$time = $this->time();
for ($i = 0; $i < $number; $i++) {
$toCreate[uniqid($time . '_', true)] = $time;
}
return $toCreate;
} | php | private function buildToCreateList($number)
{
$toCreate = [];
$time = $this->time();
for ($i = 0; $i < $number; $i++) {
$toCreate[uniqid($time . '_', true)] = $time;
}
return $toCreate;
} | [
"private",
"function",
"buildToCreateList",
"(",
"$",
"number",
")",
"{",
"$",
"toCreate",
"=",
"[",
"]",
";",
"$",
"time",
"=",
"$",
"this",
"->",
"time",
"(",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"number",
";",
"$",
"i",
"++",
")",
"{",
"$",
"toCreate",
"[",
"uniqid",
"(",
"$",
"time",
".",
"'_'",
",",
"true",
")",
"]",
"=",
"$",
"time",
";",
"}",
"return",
"$",
"toCreate",
";",
"}"
] | Builds out a list of timestamps indicating the start time of the intent
to create a session.
@param int $number
@return array | [
"Builds",
"out",
"a",
"list",
"of",
"timestamps",
"indicating",
"the",
"start",
"time",
"of",
"the",
"intent",
"to",
"create",
"a",
"session",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Session/CacheSessionPool.php#L531-L541 | train |
googleapis/google-cloud-php | Spanner/src/Session/CacheSessionPool.php | CacheSessionPool.purgeOrphanedToCreateItems | private function purgeOrphanedToCreateItems(array &$data)
{
foreach ($data['toCreate'] as $key => $timestamp) {
$time = $this->time();
if ($timestamp + self::DURATION_TWENTY_MINUTES < $this->time()) {
unset($data['toCreate'][$key]);
}
}
} | php | private function purgeOrphanedToCreateItems(array &$data)
{
foreach ($data['toCreate'] as $key => $timestamp) {
$time = $this->time();
if ($timestamp + self::DURATION_TWENTY_MINUTES < $this->time()) {
unset($data['toCreate'][$key]);
}
}
} | [
"private",
"function",
"purgeOrphanedToCreateItems",
"(",
"array",
"&",
"$",
"data",
")",
"{",
"foreach",
"(",
"$",
"data",
"[",
"'toCreate'",
"]",
"as",
"$",
"key",
"=>",
"$",
"timestamp",
")",
"{",
"$",
"time",
"=",
"$",
"this",
"->",
"time",
"(",
")",
";",
"if",
"(",
"$",
"timestamp",
"+",
"self",
"::",
"DURATION_TWENTY_MINUTES",
"<",
"$",
"this",
"->",
"time",
"(",
")",
")",
"{",
"unset",
"(",
"$",
"data",
"[",
"'toCreate'",
"]",
"[",
"$",
"key",
"]",
")",
";",
"}",
"}",
"}"
] | Purge any items in the to create queue that have been inactive for 20
minutes or more.
@param array $data | [
"Purge",
"any",
"items",
"in",
"the",
"to",
"create",
"queue",
"that",
"have",
"been",
"inactive",
"for",
"20",
"minutes",
"or",
"more",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Session/CacheSessionPool.php#L549-L558 | train |
googleapis/google-cloud-php | Spanner/src/Session/CacheSessionPool.php | CacheSessionPool.purgeOrphanedInUseSessions | private function purgeOrphanedInUseSessions(array &$data)
{
foreach ($data['inUse'] as $key => $session) {
if ($session['lastActive'] + SessionPoolInterface::SESSION_EXPIRATION_SECONDS < $this->time()) {
unset($data['inUse'][$key]);
} elseif ($session['lastActive'] + self::DURATION_TWENTY_MINUTES < $this->time()) {
unset($session['lastActive']);
array_push($data['queue'], $session);
unset($data['inUse'][$key]);
}
}
} | php | private function purgeOrphanedInUseSessions(array &$data)
{
foreach ($data['inUse'] as $key => $session) {
if ($session['lastActive'] + SessionPoolInterface::SESSION_EXPIRATION_SECONDS < $this->time()) {
unset($data['inUse'][$key]);
} elseif ($session['lastActive'] + self::DURATION_TWENTY_MINUTES < $this->time()) {
unset($session['lastActive']);
array_push($data['queue'], $session);
unset($data['inUse'][$key]);
}
}
} | [
"private",
"function",
"purgeOrphanedInUseSessions",
"(",
"array",
"&",
"$",
"data",
")",
"{",
"foreach",
"(",
"$",
"data",
"[",
"'inUse'",
"]",
"as",
"$",
"key",
"=>",
"$",
"session",
")",
"{",
"if",
"(",
"$",
"session",
"[",
"'lastActive'",
"]",
"+",
"SessionPoolInterface",
"::",
"SESSION_EXPIRATION_SECONDS",
"<",
"$",
"this",
"->",
"time",
"(",
")",
")",
"{",
"unset",
"(",
"$",
"data",
"[",
"'inUse'",
"]",
"[",
"$",
"key",
"]",
")",
";",
"}",
"elseif",
"(",
"$",
"session",
"[",
"'lastActive'",
"]",
"+",
"self",
"::",
"DURATION_TWENTY_MINUTES",
"<",
"$",
"this",
"->",
"time",
"(",
")",
")",
"{",
"unset",
"(",
"$",
"session",
"[",
"'lastActive'",
"]",
")",
";",
"array_push",
"(",
"$",
"data",
"[",
"'queue'",
"]",
",",
"$",
"session",
")",
";",
"unset",
"(",
"$",
"data",
"[",
"'inUse'",
"]",
"[",
"$",
"key",
"]",
")",
";",
"}",
"}",
"}"
] | Purges in use sessions. If a session was last active an hour ago, we
assume it is expired and remove it from the pool. If last active 20
minutes ago, we attempt to return the session back to the queue.
@param array $data | [
"Purges",
"in",
"use",
"sessions",
".",
"If",
"a",
"session",
"was",
"last",
"active",
"an",
"hour",
"ago",
"we",
"assume",
"it",
"is",
"expired",
"and",
"remove",
"it",
"from",
"the",
"pool",
".",
"If",
"last",
"active",
"20",
"minutes",
"ago",
"we",
"attempt",
"to",
"return",
"the",
"session",
"back",
"to",
"the",
"queue",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Session/CacheSessionPool.php#L567-L578 | train |
googleapis/google-cloud-php | Spanner/src/Session/CacheSessionPool.php | CacheSessionPool.getSession | private function getSession(array &$data)
{
$session = array_shift($data['queue']);
if ($session) {
if ($session['expiration'] - self::DURATION_ONE_MINUTE < $this->time()) {
return $this->getSession($data);
}
$data['inUse'][$session['name']] = $session + [
'lastActive' => $this->time()
];
if ($this->config['shouldAutoDownsize']) {
$this->manageSessionsToDelete($data);
}
}
return $session;
} | php | private function getSession(array &$data)
{
$session = array_shift($data['queue']);
if ($session) {
if ($session['expiration'] - self::DURATION_ONE_MINUTE < $this->time()) {
return $this->getSession($data);
}
$data['inUse'][$session['name']] = $session + [
'lastActive' => $this->time()
];
if ($this->config['shouldAutoDownsize']) {
$this->manageSessionsToDelete($data);
}
}
return $session;
} | [
"private",
"function",
"getSession",
"(",
"array",
"&",
"$",
"data",
")",
"{",
"$",
"session",
"=",
"array_shift",
"(",
"$",
"data",
"[",
"'queue'",
"]",
")",
";",
"if",
"(",
"$",
"session",
")",
"{",
"if",
"(",
"$",
"session",
"[",
"'expiration'",
"]",
"-",
"self",
"::",
"DURATION_ONE_MINUTE",
"<",
"$",
"this",
"->",
"time",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"getSession",
"(",
"$",
"data",
")",
";",
"}",
"$",
"data",
"[",
"'inUse'",
"]",
"[",
"$",
"session",
"[",
"'name'",
"]",
"]",
"=",
"$",
"session",
"+",
"[",
"'lastActive'",
"=>",
"$",
"this",
"->",
"time",
"(",
")",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"config",
"[",
"'shouldAutoDownsize'",
"]",
")",
"{",
"$",
"this",
"->",
"manageSessionsToDelete",
"(",
"$",
"data",
")",
";",
"}",
"}",
"return",
"$",
"session",
";",
"}"
] | Gets the next session in the queue, clearing out any which are expired.
@param array $data
@return array|null | [
"Gets",
"the",
"next",
"session",
"in",
"the",
"queue",
"clearing",
"out",
"any",
"which",
"are",
"expired",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Session/CacheSessionPool.php#L616-L635 | train |
googleapis/google-cloud-php | Spanner/src/Session/CacheSessionPool.php | CacheSessionPool.createSessions | private function createSessions($count)
{
$args = [
'database' => $this->database->name(),
'session' => [
'labels' => isset($this->config['labels']) ? $this->config['labels'] : []
]
];
$promises = [];
for ($i = 0; $i < $count; $i++) {
$promises[] = $this->database->connection()->createSessionAsync($args);
}
$results = Promise\settle($promises)->wait();
$sessions = [];
foreach ($results as $result) {
if ($result['state'] === 'fulfilled') {
$name = $result['value']->getName();
$sessions[] = [
'name' => $name,
'expiration' => $this->time() + SessionPoolInterface::SESSION_EXPIRATION_SECONDS
];
}
}
return $sessions;
} | php | private function createSessions($count)
{
$args = [
'database' => $this->database->name(),
'session' => [
'labels' => isset($this->config['labels']) ? $this->config['labels'] : []
]
];
$promises = [];
for ($i = 0; $i < $count; $i++) {
$promises[] = $this->database->connection()->createSessionAsync($args);
}
$results = Promise\settle($promises)->wait();
$sessions = [];
foreach ($results as $result) {
if ($result['state'] === 'fulfilled') {
$name = $result['value']->getName();
$sessions[] = [
'name' => $name,
'expiration' => $this->time() + SessionPoolInterface::SESSION_EXPIRATION_SECONDS
];
}
}
return $sessions;
} | [
"private",
"function",
"createSessions",
"(",
"$",
"count",
")",
"{",
"$",
"args",
"=",
"[",
"'database'",
"=>",
"$",
"this",
"->",
"database",
"->",
"name",
"(",
")",
",",
"'session'",
"=>",
"[",
"'labels'",
"=>",
"isset",
"(",
"$",
"this",
"->",
"config",
"[",
"'labels'",
"]",
")",
"?",
"$",
"this",
"->",
"config",
"[",
"'labels'",
"]",
":",
"[",
"]",
"]",
"]",
";",
"$",
"promises",
"=",
"[",
"]",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"count",
";",
"$",
"i",
"++",
")",
"{",
"$",
"promises",
"[",
"]",
"=",
"$",
"this",
"->",
"database",
"->",
"connection",
"(",
")",
"->",
"createSessionAsync",
"(",
"$",
"args",
")",
";",
"}",
"$",
"results",
"=",
"Promise",
"\\",
"settle",
"(",
"$",
"promises",
")",
"->",
"wait",
"(",
")",
";",
"$",
"sessions",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"results",
"as",
"$",
"result",
")",
"{",
"if",
"(",
"$",
"result",
"[",
"'state'",
"]",
"===",
"'fulfilled'",
")",
"{",
"$",
"name",
"=",
"$",
"result",
"[",
"'value'",
"]",
"->",
"getName",
"(",
")",
";",
"$",
"sessions",
"[",
"]",
"=",
"[",
"'name'",
"=>",
"$",
"name",
",",
"'expiration'",
"=>",
"$",
"this",
"->",
"time",
"(",
")",
"+",
"SessionPoolInterface",
"::",
"SESSION_EXPIRATION_SECONDS",
"]",
";",
"}",
"}",
"return",
"$",
"sessions",
";",
"}"
] | Creates sessions up to the count provided.
@param int $count
@return array | [
"Creates",
"sessions",
"up",
"to",
"the",
"count",
"provided",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Session/CacheSessionPool.php#L643-L673 | train |
googleapis/google-cloud-php | Spanner/src/Session/CacheSessionPool.php | CacheSessionPool.isSessionValid | private function isSessionValid(array $session)
{
$halfHourBeforeExpiration = $session['expiration'] - (SessionPoolInterface::SESSION_EXPIRATION_SECONDS / 2);
if ($this->time() < $halfHourBeforeExpiration) {
return true;
} elseif ($halfHourBeforeExpiration < $this->time() && $this->time() < $session['expiration']) {
return $this->database
->session($session['name'])
->exists();
}
return false;
} | php | private function isSessionValid(array $session)
{
$halfHourBeforeExpiration = $session['expiration'] - (SessionPoolInterface::SESSION_EXPIRATION_SECONDS / 2);
if ($this->time() < $halfHourBeforeExpiration) {
return true;
} elseif ($halfHourBeforeExpiration < $this->time() && $this->time() < $session['expiration']) {
return $this->database
->session($session['name'])
->exists();
}
return false;
} | [
"private",
"function",
"isSessionValid",
"(",
"array",
"$",
"session",
")",
"{",
"$",
"halfHourBeforeExpiration",
"=",
"$",
"session",
"[",
"'expiration'",
"]",
"-",
"(",
"SessionPoolInterface",
"::",
"SESSION_EXPIRATION_SECONDS",
"/",
"2",
")",
";",
"if",
"(",
"$",
"this",
"->",
"time",
"(",
")",
"<",
"$",
"halfHourBeforeExpiration",
")",
"{",
"return",
"true",
";",
"}",
"elseif",
"(",
"$",
"halfHourBeforeExpiration",
"<",
"$",
"this",
"->",
"time",
"(",
")",
"&&",
"$",
"this",
"->",
"time",
"(",
")",
"<",
"$",
"session",
"[",
"'expiration'",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"database",
"->",
"session",
"(",
"$",
"session",
"[",
"'name'",
"]",
")",
"->",
"exists",
"(",
")",
";",
"}",
"return",
"false",
";",
"}"
] | If necessary, triggers a network request to determine the status of the
provided session.
@param array $session
@return bool | [
"If",
"necessary",
"triggers",
"a",
"network",
"request",
"to",
"determine",
"the",
"status",
"of",
"the",
"provided",
"session",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Session/CacheSessionPool.php#L682-L695 | train |
googleapis/google-cloud-php | Spanner/src/Session/CacheSessionPool.php | CacheSessionPool.handleSession | private function handleSession(array $session)
{
if ($this->isSessionValid($session)) {
return $session;
}
$this->config['lock']->synchronize(function () use ($session) {
$item = $this->cacheItemPool->getItem($this->cacheKey);
$data = $item->get();
unset($data['inUse'][$session['name']]);
$this->cacheItemPool->save($item->set($data));
});
} | php | private function handleSession(array $session)
{
if ($this->isSessionValid($session)) {
return $session;
}
$this->config['lock']->synchronize(function () use ($session) {
$item = $this->cacheItemPool->getItem($this->cacheKey);
$data = $item->get();
unset($data['inUse'][$session['name']]);
$this->cacheItemPool->save($item->set($data));
});
} | [
"private",
"function",
"handleSession",
"(",
"array",
"$",
"session",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isSessionValid",
"(",
"$",
"session",
")",
")",
"{",
"return",
"$",
"session",
";",
"}",
"$",
"this",
"->",
"config",
"[",
"'lock'",
"]",
"->",
"synchronize",
"(",
"function",
"(",
")",
"use",
"(",
"$",
"session",
")",
"{",
"$",
"item",
"=",
"$",
"this",
"->",
"cacheItemPool",
"->",
"getItem",
"(",
"$",
"this",
"->",
"cacheKey",
")",
";",
"$",
"data",
"=",
"$",
"item",
"->",
"get",
"(",
")",
";",
"unset",
"(",
"$",
"data",
"[",
"'inUse'",
"]",
"[",
"$",
"session",
"[",
"'name'",
"]",
"]",
")",
";",
"$",
"this",
"->",
"cacheItemPool",
"->",
"save",
"(",
"$",
"item",
"->",
"set",
"(",
"$",
"data",
")",
")",
";",
"}",
")",
";",
"}"
] | If the session is valid, return it - otherwise remove from the in use
list.
@param array $session
@return array|null | [
"If",
"the",
"session",
"is",
"valid",
"return",
"it",
"-",
"otherwise",
"remove",
"from",
"the",
"in",
"use",
"list",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Session/CacheSessionPool.php#L704-L716 | train |
googleapis/google-cloud-php | Spanner/src/Session/CacheSessionPool.php | CacheSessionPool.waitForNextAvailableSession | private function waitForNextAvailableSession()
{
$elapsedCycles = 0;
while (true) {
$session = $this->config['lock']->synchronize(function () use ($elapsedCycles) {
$item = $this->cacheItemPool->getItem($this->cacheKey);
$data = $item->get();
$session = $this->getSession($data);
if ($session) {
$this->cacheItemPool->save($item->set($data));
return $session;
}
if ($this->config['maxCyclesToWaitForSession'] <= $elapsedCycles) {
$this->cacheItemPool->save($item->set($data));
throw new \RuntimeException(
'A session did not become available in the allotted number of attempts.'
);
}
});
if ($session && $this->handleSession($session)) {
return $session;
}
$elapsedCycles++;
usleep($this->config['sleepIntervalSeconds'] * 1000000);
}
} | php | private function waitForNextAvailableSession()
{
$elapsedCycles = 0;
while (true) {
$session = $this->config['lock']->synchronize(function () use ($elapsedCycles) {
$item = $this->cacheItemPool->getItem($this->cacheKey);
$data = $item->get();
$session = $this->getSession($data);
if ($session) {
$this->cacheItemPool->save($item->set($data));
return $session;
}
if ($this->config['maxCyclesToWaitForSession'] <= $elapsedCycles) {
$this->cacheItemPool->save($item->set($data));
throw new \RuntimeException(
'A session did not become available in the allotted number of attempts.'
);
}
});
if ($session && $this->handleSession($session)) {
return $session;
}
$elapsedCycles++;
usleep($this->config['sleepIntervalSeconds'] * 1000000);
}
} | [
"private",
"function",
"waitForNextAvailableSession",
"(",
")",
"{",
"$",
"elapsedCycles",
"=",
"0",
";",
"while",
"(",
"true",
")",
"{",
"$",
"session",
"=",
"$",
"this",
"->",
"config",
"[",
"'lock'",
"]",
"->",
"synchronize",
"(",
"function",
"(",
")",
"use",
"(",
"$",
"elapsedCycles",
")",
"{",
"$",
"item",
"=",
"$",
"this",
"->",
"cacheItemPool",
"->",
"getItem",
"(",
"$",
"this",
"->",
"cacheKey",
")",
";",
"$",
"data",
"=",
"$",
"item",
"->",
"get",
"(",
")",
";",
"$",
"session",
"=",
"$",
"this",
"->",
"getSession",
"(",
"$",
"data",
")",
";",
"if",
"(",
"$",
"session",
")",
"{",
"$",
"this",
"->",
"cacheItemPool",
"->",
"save",
"(",
"$",
"item",
"->",
"set",
"(",
"$",
"data",
")",
")",
";",
"return",
"$",
"session",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"config",
"[",
"'maxCyclesToWaitForSession'",
"]",
"<=",
"$",
"elapsedCycles",
")",
"{",
"$",
"this",
"->",
"cacheItemPool",
"->",
"save",
"(",
"$",
"item",
"->",
"set",
"(",
"$",
"data",
")",
")",
";",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'A session did not become available in the allotted number of attempts.'",
")",
";",
"}",
"}",
")",
";",
"if",
"(",
"$",
"session",
"&&",
"$",
"this",
"->",
"handleSession",
"(",
"$",
"session",
")",
")",
"{",
"return",
"$",
"session",
";",
"}",
"$",
"elapsedCycles",
"++",
";",
"usleep",
"(",
"$",
"this",
"->",
"config",
"[",
"'sleepIntervalSeconds'",
"]",
"*",
"1000000",
")",
";",
"}",
"}"
] | Blocks until a session becomes available.
@return array
@throws \RuntimeException | [
"Blocks",
"until",
"a",
"session",
"becomes",
"available",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Session/CacheSessionPool.php#L724-L755 | train |
googleapis/google-cloud-php | Spanner/src/Session/CacheSessionPool.php | CacheSessionPool.getDefaultLock | private function getDefaultLock()
{
if ($this->isSysvIPCLoaded()) {
return new SemaphoreLock(
$this->getSysvKey(crc32($this->cacheKey))
);
}
return new FlockLock($this->cacheKey);
} | php | private function getDefaultLock()
{
if ($this->isSysvIPCLoaded()) {
return new SemaphoreLock(
$this->getSysvKey(crc32($this->cacheKey))
);
}
return new FlockLock($this->cacheKey);
} | [
"private",
"function",
"getDefaultLock",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isSysvIPCLoaded",
"(",
")",
")",
"{",
"return",
"new",
"SemaphoreLock",
"(",
"$",
"this",
"->",
"getSysvKey",
"(",
"crc32",
"(",
"$",
"this",
"->",
"cacheKey",
")",
")",
")",
";",
"}",
"return",
"new",
"FlockLock",
"(",
"$",
"this",
"->",
"cacheKey",
")",
";",
"}"
] | Get the default lock.
@return LockInterface | [
"Get",
"the",
"default",
"lock",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Session/CacheSessionPool.php#L762-L771 | train |
googleapis/google-cloud-php | Spanner/src/Session/CacheSessionPool.php | CacheSessionPool.validateConfig | private function validateConfig()
{
$mustBePositiveKeys = ['maxCyclesToWaitForSession', 'maxSessions', 'minSessions', 'sleepIntervalSeconds'];
foreach ($mustBePositiveKeys as $key) {
if ($this->config[$key] < 0) {
throw new \InvalidArgumentException("$key may not be negative");
}
}
if ($this->config['maxSessions'] < $this->config['minSessions']) {
throw new \InvalidArgumentException('minSessions cannot exceed maxSessions');
}
if (isset($this->config['lock']) && !$this->config['lock'] instanceof LockInterface) {
throw new \InvalidArgumentException(
'The lock must implement Google\Cloud\Core\Lock\LockInterface'
);
}
} | php | private function validateConfig()
{
$mustBePositiveKeys = ['maxCyclesToWaitForSession', 'maxSessions', 'minSessions', 'sleepIntervalSeconds'];
foreach ($mustBePositiveKeys as $key) {
if ($this->config[$key] < 0) {
throw new \InvalidArgumentException("$key may not be negative");
}
}
if ($this->config['maxSessions'] < $this->config['minSessions']) {
throw new \InvalidArgumentException('minSessions cannot exceed maxSessions');
}
if (isset($this->config['lock']) && !$this->config['lock'] instanceof LockInterface) {
throw new \InvalidArgumentException(
'The lock must implement Google\Cloud\Core\Lock\LockInterface'
);
}
} | [
"private",
"function",
"validateConfig",
"(",
")",
"{",
"$",
"mustBePositiveKeys",
"=",
"[",
"'maxCyclesToWaitForSession'",
",",
"'maxSessions'",
",",
"'minSessions'",
",",
"'sleepIntervalSeconds'",
"]",
";",
"foreach",
"(",
"$",
"mustBePositiveKeys",
"as",
"$",
"key",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"config",
"[",
"$",
"key",
"]",
"<",
"0",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"\"$key may not be negative\"",
")",
";",
"}",
"}",
"if",
"(",
"$",
"this",
"->",
"config",
"[",
"'maxSessions'",
"]",
"<",
"$",
"this",
"->",
"config",
"[",
"'minSessions'",
"]",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'minSessions cannot exceed maxSessions'",
")",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"config",
"[",
"'lock'",
"]",
")",
"&&",
"!",
"$",
"this",
"->",
"config",
"[",
"'lock'",
"]",
"instanceof",
"LockInterface",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'The lock must implement Google\\Cloud\\Core\\Lock\\LockInterface'",
")",
";",
"}",
"}"
] | Validate the config.
@param array $config
@throws \InvalidArgumentException | [
"Validate",
"the",
"config",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Session/CacheSessionPool.php#L779-L798 | train |
googleapis/google-cloud-php | Spanner/src/Session/CacheSessionPool.php | CacheSessionPool.deleteSessions | private function deleteSessions(array $sessions)
{
// gRPC calls appear to cancel when the corresponding UnaryCall object
// goes out of scope. Keeping the calls in scope allows time for the
// calls to complete at the expense of a small memory footprint.
$this->deleteCalls = [];
foreach ($sessions as $session) {
$this->deleteCalls[] = $this->database->connection()
->deleteSessionAsync([
'name' => $session['name'],
'database' => $this->database->name()
]);
}
} | php | private function deleteSessions(array $sessions)
{
// gRPC calls appear to cancel when the corresponding UnaryCall object
// goes out of scope. Keeping the calls in scope allows time for the
// calls to complete at the expense of a small memory footprint.
$this->deleteCalls = [];
foreach ($sessions as $session) {
$this->deleteCalls[] = $this->database->connection()
->deleteSessionAsync([
'name' => $session['name'],
'database' => $this->database->name()
]);
}
} | [
"private",
"function",
"deleteSessions",
"(",
"array",
"$",
"sessions",
")",
"{",
"// gRPC calls appear to cancel when the corresponding UnaryCall object",
"// goes out of scope. Keeping the calls in scope allows time for the",
"// calls to complete at the expense of a small memory footprint.",
"$",
"this",
"->",
"deleteCalls",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"sessions",
"as",
"$",
"session",
")",
"{",
"$",
"this",
"->",
"deleteCalls",
"[",
"]",
"=",
"$",
"this",
"->",
"database",
"->",
"connection",
"(",
")",
"->",
"deleteSessionAsync",
"(",
"[",
"'name'",
"=>",
"$",
"session",
"[",
"'name'",
"]",
",",
"'database'",
"=>",
"$",
"this",
"->",
"database",
"->",
"name",
"(",
")",
"]",
")",
";",
"}",
"}"
] | Delete the provided sessions.
@param array $sessions | [
"Delete",
"the",
"provided",
"sessions",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Session/CacheSessionPool.php#L805-L819 | train |
googleapis/google-cloud-php | Bigtable/src/V2/ReadModifyWriteRowResponse.php | ReadModifyWriteRowResponse.setRow | public function setRow($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\Row::class);
$this->row = $var;
return $this;
} | php | public function setRow($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\Row::class);
$this->row = $var;
return $this;
} | [
"public",
"function",
"setRow",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Bigtable",
"\\",
"V2",
"\\",
"Row",
"::",
"class",
")",
";",
"$",
"this",
"->",
"row",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | A Row containing the new contents of all cells modified by the request.
Generated from protobuf field <code>.google.bigtable.v2.Row row = 1;</code>
@param \Google\Cloud\Bigtable\V2\Row $var
@return $this | [
"A",
"Row",
"containing",
"the",
"new",
"contents",
"of",
"all",
"cells",
"modified",
"by",
"the",
"request",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Bigtable/src/V2/ReadModifyWriteRowResponse.php#L58-L64 | train |
googleapis/google-cloud-php | Core/src/Batch/HandleFailureTrait.php | HandleFailureTrait.initFailureFile | private function initFailureFile()
{
$this->baseDir = getenv('GOOGLE_CLOUD_BATCH_DAEMON_FAILURE_DIR');
if ($this->baseDir === false) {
$this->baseDir = sprintf(
'%s/batch-daemon-failure',
sys_get_temp_dir()
);
}
if (! is_dir($this->baseDir)) {
if (@mkdir($this->baseDir, 0700, true) === false) {
throw new \RuntimeException(
sprintf(
'Couuld not create a directory: %s',
$this->baseDir
)
);
}
}
// Use getmypid for simplicity.
$this->failureFile = sprintf(
'%s/failed-items-%d',
$this->baseDir,
getmypid()
);
} | php | private function initFailureFile()
{
$this->baseDir = getenv('GOOGLE_CLOUD_BATCH_DAEMON_FAILURE_DIR');
if ($this->baseDir === false) {
$this->baseDir = sprintf(
'%s/batch-daemon-failure',
sys_get_temp_dir()
);
}
if (! is_dir($this->baseDir)) {
if (@mkdir($this->baseDir, 0700, true) === false) {
throw new \RuntimeException(
sprintf(
'Couuld not create a directory: %s',
$this->baseDir
)
);
}
}
// Use getmypid for simplicity.
$this->failureFile = sprintf(
'%s/failed-items-%d',
$this->baseDir,
getmypid()
);
} | [
"private",
"function",
"initFailureFile",
"(",
")",
"{",
"$",
"this",
"->",
"baseDir",
"=",
"getenv",
"(",
"'GOOGLE_CLOUD_BATCH_DAEMON_FAILURE_DIR'",
")",
";",
"if",
"(",
"$",
"this",
"->",
"baseDir",
"===",
"false",
")",
"{",
"$",
"this",
"->",
"baseDir",
"=",
"sprintf",
"(",
"'%s/batch-daemon-failure'",
",",
"sys_get_temp_dir",
"(",
")",
")",
";",
"}",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"this",
"->",
"baseDir",
")",
")",
"{",
"if",
"(",
"@",
"mkdir",
"(",
"$",
"this",
"->",
"baseDir",
",",
"0700",
",",
"true",
")",
"===",
"false",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"sprintf",
"(",
"'Couuld not create a directory: %s'",
",",
"$",
"this",
"->",
"baseDir",
")",
")",
";",
"}",
"}",
"// Use getmypid for simplicity.",
"$",
"this",
"->",
"failureFile",
"=",
"sprintf",
"(",
"'%s/failed-items-%d'",
",",
"$",
"this",
"->",
"baseDir",
",",
"getmypid",
"(",
")",
")",
";",
"}"
] | Determine the failureFile. | [
"Determine",
"the",
"failureFile",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Core/src/Batch/HandleFailureTrait.php#L43-L68 | train |
googleapis/google-cloud-php | Core/src/Batch/HandleFailureTrait.php | HandleFailureTrait.handleFailure | public function handleFailure($idNum, array $items)
{
if (!$this->failureFile) {
$this->initFailureFile();
}
$fp = @fopen($this->failureFile, 'a');
@fwrite($fp, serialize([$idNum => $items]) . PHP_EOL);
@fclose($fp);
} | php | public function handleFailure($idNum, array $items)
{
if (!$this->failureFile) {
$this->initFailureFile();
}
$fp = @fopen($this->failureFile, 'a');
@fwrite($fp, serialize([$idNum => $items]) . PHP_EOL);
@fclose($fp);
} | [
"public",
"function",
"handleFailure",
"(",
"$",
"idNum",
",",
"array",
"$",
"items",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"failureFile",
")",
"{",
"$",
"this",
"->",
"initFailureFile",
"(",
")",
";",
"}",
"$",
"fp",
"=",
"@",
"fopen",
"(",
"$",
"this",
"->",
"failureFile",
",",
"'a'",
")",
";",
"@",
"fwrite",
"(",
"$",
"fp",
",",
"serialize",
"(",
"[",
"$",
"idNum",
"=>",
"$",
"items",
"]",
")",
".",
"PHP_EOL",
")",
";",
"@",
"fclose",
"(",
"$",
"fp",
")",
";",
"}"
] | Save the items to the failureFile. We silently abandon the items upon
failures in this method because there's nothing we can do.
@param int $idNum A numeric id for the job.
@param array $items Items to save. | [
"Save",
"the",
"items",
"to",
"the",
"failureFile",
".",
"We",
"silently",
"abandon",
"the",
"items",
"upon",
"failures",
"in",
"this",
"method",
"because",
"there",
"s",
"nothing",
"we",
"can",
"do",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Core/src/Batch/HandleFailureTrait.php#L77-L86 | train |
googleapis/google-cloud-php | Debugger/src/V2/ListBreakpointsRequest/BreakpointActionValue.php | BreakpointActionValue.setValue | public function setValue($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Debugger\V2\Breakpoint_Action::class);
$this->value = $var;
return $this;
} | php | public function setValue($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Debugger\V2\Breakpoint_Action::class);
$this->value = $var;
return $this;
} | [
"public",
"function",
"setValue",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Debugger",
"\\",
"V2",
"\\",
"Breakpoint_Action",
"::",
"class",
")",
";",
"$",
"this",
"->",
"value",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Only breakpoints with the specified action will pass the filter.
Generated from protobuf field <code>.google.devtools.clouddebugger.v2.Breakpoint.Action value = 1;</code>
@param int $var
@return $this | [
"Only",
"breakpoints",
"with",
"the",
"specified",
"action",
"will",
"pass",
"the",
"filter",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Debugger/src/V2/ListBreakpointsRequest/BreakpointActionValue.php#L59-L65 | train |
googleapis/google-cloud-php | Dataproc/src/V1/ListClustersResponse.php | ListClustersResponse.setClusters | public function setClusters($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dataproc\V1\Cluster::class);
$this->clusters = $arr;
return $this;
} | php | public function setClusters($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dataproc\V1\Cluster::class);
$this->clusters = $arr;
return $this;
} | [
"public",
"function",
"setClusters",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dataproc",
"\\",
"V1",
"\\",
"Cluster",
"::",
"class",
")",
";",
"$",
"this",
"->",
"clusters",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | Output only. The clusters in the project.
Generated from protobuf field <code>repeated .google.cloud.dataproc.v1.Cluster clusters = 1;</code>
@param \Google\Cloud\Dataproc\V1\Cluster[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"Output",
"only",
".",
"The",
"clusters",
"in",
"the",
"project",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dataproc/src/V1/ListClustersResponse.php#L70-L76 | train |
googleapis/google-cloud-php | Trace/src/V2/Span.php | Span.setAttributes | public function setAttributes($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Trace\V2\Span_Attributes::class);
$this->attributes = $var;
return $this;
} | php | public function setAttributes($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Trace\V2\Span_Attributes::class);
$this->attributes = $var;
return $this;
} | [
"public",
"function",
"setAttributes",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Trace",
"\\",
"V2",
"\\",
"Span_Attributes",
"::",
"class",
")",
";",
"$",
"this",
"->",
"attributes",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | A set of attributes on the span. You can have up to 32 attributes per
span.
Generated from protobuf field <code>.google.devtools.cloudtrace.v2.Span.Attributes attributes = 7;</code>
@param \Google\Cloud\Trace\V2\Span\Attributes $var
@return $this | [
"A",
"set",
"of",
"attributes",
"on",
"the",
"span",
".",
"You",
"can",
"have",
"up",
"to",
"32",
"attributes",
"per",
"span",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Trace/src/V2/Span.php#L393-L399 | train |
googleapis/google-cloud-php | Trace/src/V2/Span.php | Span.setStackTrace | public function setStackTrace($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Trace\V2\StackTrace::class);
$this->stack_trace = $var;
return $this;
} | php | public function setStackTrace($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Trace\V2\StackTrace::class);
$this->stack_trace = $var;
return $this;
} | [
"public",
"function",
"setStackTrace",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Trace",
"\\",
"V2",
"\\",
"StackTrace",
"::",
"class",
")",
";",
"$",
"this",
"->",
"stack_trace",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Stack trace captured at the start of the span.
Generated from protobuf field <code>.google.devtools.cloudtrace.v2.StackTrace stack_trace = 8;</code>
@param \Google\Cloud\Trace\V2\StackTrace $var
@return $this | [
"Stack",
"trace",
"captured",
"at",
"the",
"start",
"of",
"the",
"span",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Trace/src/V2/Span.php#L419-L425 | train |
googleapis/google-cloud-php | Trace/src/V2/Span.php | Span.setTimeEvents | public function setTimeEvents($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Trace\V2\Span_TimeEvents::class);
$this->time_events = $var;
return $this;
} | php | public function setTimeEvents($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Trace\V2\Span_TimeEvents::class);
$this->time_events = $var;
return $this;
} | [
"public",
"function",
"setTimeEvents",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Trace",
"\\",
"V2",
"\\",
"Span_TimeEvents",
"::",
"class",
")",
";",
"$",
"this",
"->",
"time_events",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | A set of time events. You can have up to 32 annotations and 128 message
events per span.
Generated from protobuf field <code>.google.devtools.cloudtrace.v2.Span.TimeEvents time_events = 9;</code>
@param \Google\Cloud\Trace\V2\Span\TimeEvents $var
@return $this | [
"A",
"set",
"of",
"time",
"events",
".",
"You",
"can",
"have",
"up",
"to",
"32",
"annotations",
"and",
"128",
"message",
"events",
"per",
"span",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Trace/src/V2/Span.php#L447-L453 | train |
googleapis/google-cloud-php | Trace/src/V2/Span.php | Span.setLinks | public function setLinks($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Trace\V2\Span_Links::class);
$this->links = $var;
return $this;
} | php | public function setLinks($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Trace\V2\Span_Links::class);
$this->links = $var;
return $this;
} | [
"public",
"function",
"setLinks",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Trace",
"\\",
"V2",
"\\",
"Span_Links",
"::",
"class",
")",
";",
"$",
"this",
"->",
"links",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Links associated with the span. You can have up to 128 links per Span.
Generated from protobuf field <code>.google.devtools.cloudtrace.v2.Span.Links links = 10;</code>
@param \Google\Cloud\Trace\V2\Span\Links $var
@return $this | [
"Links",
"associated",
"with",
"the",
"span",
".",
"You",
"can",
"have",
"up",
"to",
"128",
"links",
"per",
"Span",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Trace/src/V2/Span.php#L473-L479 | train |
googleapis/google-cloud-php | Firestore/src/Admin/V1/Gapic/FirestoreAdminGapicClient.php | FirestoreAdminGapicClient.fieldName | public static function fieldName($project, $database, $collectionId, $fieldId)
{
return self::getFieldNameTemplate()->render([
'project' => $project,
'database' => $database,
'collection_id' => $collectionId,
'field_id' => $fieldId,
]);
} | php | public static function fieldName($project, $database, $collectionId, $fieldId)
{
return self::getFieldNameTemplate()->render([
'project' => $project,
'database' => $database,
'collection_id' => $collectionId,
'field_id' => $fieldId,
]);
} | [
"public",
"static",
"function",
"fieldName",
"(",
"$",
"project",
",",
"$",
"database",
",",
"$",
"collectionId",
",",
"$",
"fieldId",
")",
"{",
"return",
"self",
"::",
"getFieldNameTemplate",
"(",
")",
"->",
"render",
"(",
"[",
"'project'",
"=>",
"$",
"project",
",",
"'database'",
"=>",
"$",
"database",
",",
"'collection_id'",
"=>",
"$",
"collectionId",
",",
"'field_id'",
"=>",
"$",
"fieldId",
",",
"]",
")",
";",
"}"
] | Formats a string containing the fully-qualified path to represent
a field resource.
@param string $project
@param string $database
@param string $collectionId
@param string $fieldId
@return string The formatted field resource.
@experimental | [
"Formats",
"a",
"string",
"containing",
"the",
"fully",
"-",
"qualified",
"path",
"to",
"represent",
"a",
"field",
"resource",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/Admin/V1/Gapic/FirestoreAdminGapicClient.php#L216-L224 | train |
googleapis/google-cloud-php | Firestore/src/Admin/V1/Gapic/FirestoreAdminGapicClient.php | FirestoreAdminGapicClient.indexName | public static function indexName($project, $database, $collectionId, $indexId)
{
return self::getIndexNameTemplate()->render([
'project' => $project,
'database' => $database,
'collection_id' => $collectionId,
'index_id' => $indexId,
]);
} | php | public static function indexName($project, $database, $collectionId, $indexId)
{
return self::getIndexNameTemplate()->render([
'project' => $project,
'database' => $database,
'collection_id' => $collectionId,
'index_id' => $indexId,
]);
} | [
"public",
"static",
"function",
"indexName",
"(",
"$",
"project",
",",
"$",
"database",
",",
"$",
"collectionId",
",",
"$",
"indexId",
")",
"{",
"return",
"self",
"::",
"getIndexNameTemplate",
"(",
")",
"->",
"render",
"(",
"[",
"'project'",
"=>",
"$",
"project",
",",
"'database'",
"=>",
"$",
"database",
",",
"'collection_id'",
"=>",
"$",
"collectionId",
",",
"'index_id'",
"=>",
"$",
"indexId",
",",
"]",
")",
";",
"}"
] | Formats a string containing the fully-qualified path to represent
a index resource.
@param string $project
@param string $database
@param string $collectionId
@param string $indexId
@return string The formatted index resource.
@experimental | [
"Formats",
"a",
"string",
"containing",
"the",
"fully",
"-",
"qualified",
"path",
"to",
"represent",
"a",
"index",
"resource",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/Admin/V1/Gapic/FirestoreAdminGapicClient.php#L238-L246 | train |
googleapis/google-cloud-php | Firestore/src/Admin/V1/Gapic/FirestoreAdminGapicClient.php | FirestoreAdminGapicClient.parentName | public static function parentName($project, $database, $collectionId)
{
return self::getParentNameTemplate()->render([
'project' => $project,
'database' => $database,
'collection_id' => $collectionId,
]);
} | php | public static function parentName($project, $database, $collectionId)
{
return self::getParentNameTemplate()->render([
'project' => $project,
'database' => $database,
'collection_id' => $collectionId,
]);
} | [
"public",
"static",
"function",
"parentName",
"(",
"$",
"project",
",",
"$",
"database",
",",
"$",
"collectionId",
")",
"{",
"return",
"self",
"::",
"getParentNameTemplate",
"(",
")",
"->",
"render",
"(",
"[",
"'project'",
"=>",
"$",
"project",
",",
"'database'",
"=>",
"$",
"database",
",",
"'collection_id'",
"=>",
"$",
"collectionId",
",",
"]",
")",
";",
"}"
] | Formats a string containing the fully-qualified path to represent
a parent resource.
@param string $project
@param string $database
@param string $collectionId
@return string The formatted parent resource.
@experimental | [
"Formats",
"a",
"string",
"containing",
"the",
"fully",
"-",
"qualified",
"path",
"to",
"represent",
"a",
"parent",
"resource",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/Admin/V1/Gapic/FirestoreAdminGapicClient.php#L259-L266 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.