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 | BigQuery/src/BigQueryClient.php | BigQueryClient.datasets | public function datasets(array $options = [])
{
$resultLimit = $this->pluck('resultLimit', $options, false);
return new ItemIterator(
new PageIterator(
function (array $dataset) {
return new Dataset(
$this->connection,
$dataset['datasetReference']['datasetId'],
$this->projectId,
$this->mapper,
$dataset
);
},
[$this->connection, 'listDatasets'],
$options + ['projectId' => $this->projectId],
[
'itemsKey' => 'datasets',
'resultLimit' => $resultLimit
]
)
);
} | php | public function datasets(array $options = [])
{
$resultLimit = $this->pluck('resultLimit', $options, false);
return new ItemIterator(
new PageIterator(
function (array $dataset) {
return new Dataset(
$this->connection,
$dataset['datasetReference']['datasetId'],
$this->projectId,
$this->mapper,
$dataset
);
},
[$this->connection, 'listDatasets'],
$options + ['projectId' => $this->projectId],
[
'itemsKey' => 'datasets',
'resultLimit' => $resultLimit
]
)
);
} | [
"public",
"function",
"datasets",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"resultLimit",
"=",
"$",
"this",
"->",
"pluck",
"(",
"'resultLimit'",
",",
"$",
"options",
",",
"false",
")",
";",
"return",
"new",
"ItemIterator",
"(",
"new",
"PageIterator",
"(",
"function",
"(",
"array",
"$",
"dataset",
")",
"{",
"return",
"new",
"Dataset",
"(",
"$",
"this",
"->",
"connection",
",",
"$",
"dataset",
"[",
"'datasetReference'",
"]",
"[",
"'datasetId'",
"]",
",",
"$",
"this",
"->",
"projectId",
",",
"$",
"this",
"->",
"mapper",
",",
"$",
"dataset",
")",
";",
"}",
",",
"[",
"$",
"this",
"->",
"connection",
",",
"'listDatasets'",
"]",
",",
"$",
"options",
"+",
"[",
"'projectId'",
"=>",
"$",
"this",
"->",
"projectId",
"]",
",",
"[",
"'itemsKey'",
"=>",
"'datasets'",
",",
"'resultLimit'",
"=>",
"$",
"resultLimit",
"]",
")",
")",
";",
"}"
] | Fetches datasets in the project.
Example:
```
$datasets = $bigQuery->datasets();
foreach ($datasets as $dataset) {
echo $dataset->id() . PHP_EOL;
}
```
@see https://cloud.google.com/bigquery/docs/reference/v2/datasets/list Datasets list API documentation.
@param array $options [optional] {
Configuration options.
@type bool $all Whether to list all datasets, including hidden ones.
**Defaults to** `false`.
@type int $maxResults Maximum number of results to return per page.
@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<Dataset> | [
"Fetches",
"datasets",
"in",
"the",
"project",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/BigQuery/src/BigQueryClient.php#L531-L554 | train |
googleapis/google-cloud-php | BigQuery/src/BigQueryClient.php | BigQueryClient.getServiceAccount | public function getServiceAccount(array $options = [])
{
$resp = $this->connection->getServiceAccount($options + ['projectId' => $this->projectId]);
return $resp['email'];
} | php | public function getServiceAccount(array $options = [])
{
$resp = $this->connection->getServiceAccount($options + ['projectId' => $this->projectId]);
return $resp['email'];
} | [
"public",
"function",
"getServiceAccount",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"resp",
"=",
"$",
"this",
"->",
"connection",
"->",
"getServiceAccount",
"(",
"$",
"options",
"+",
"[",
"'projectId'",
"=>",
"$",
"this",
"->",
"projectId",
"]",
")",
";",
"return",
"$",
"resp",
"[",
"'email'",
"]",
";",
"}"
] | Get a service account for the KMS integration.
Example:
```
$serviceAccount = $bigQuery->getServiceAccount();
```
@param array $options [optional] Configuration options.
@return string | [
"Get",
"a",
"service",
"account",
"for",
"the",
"KMS",
"integration",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/BigQuery/src/BigQueryClient.php#L728-L732 | train |
googleapis/google-cloud-php | Vision/src/V1/DominantColorsAnnotation.php | DominantColorsAnnotation.setColors | public function setColors($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\ColorInfo::class);
$this->colors = $arr;
return $this;
} | php | public function setColors($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\ColorInfo::class);
$this->colors = $arr;
return $this;
} | [
"public",
"function",
"setColors",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Vision",
"\\",
"V1",
"\\",
"ColorInfo",
"::",
"class",
")",
";",
"$",
"this",
"->",
"colors",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | RGB color values with their score and pixel fraction.
Generated from protobuf field <code>repeated .google.cloud.vision.v1.ColorInfo colors = 1;</code>
@param \Google\Cloud\Vision\V1\ColorInfo[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"RGB",
"color",
"values",
"with",
"their",
"score",
"and",
"pixel",
"fraction",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Vision/src/V1/DominantColorsAnnotation.php#L58-L64 | train |
googleapis/google-cloud-php | Datastore/src/V1/Filter.php | Filter.setPropertyFilter | public function setPropertyFilter($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Datastore\V1\PropertyFilter::class);
$this->writeOneof(2, $var);
return $this;
} | php | public function setPropertyFilter($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Datastore\V1\PropertyFilter::class);
$this->writeOneof(2, $var);
return $this;
} | [
"public",
"function",
"setPropertyFilter",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Datastore",
"\\",
"V1",
"\\",
"PropertyFilter",
"::",
"class",
")",
";",
"$",
"this",
"->",
"writeOneof",
"(",
"2",
",",
"$",
"var",
")",
";",
"return",
"$",
"this",
";",
"}"
] | A filter on a property.
Generated from protobuf field <code>.google.datastore.v1.PropertyFilter property_filter = 2;</code>
@param \Google\Cloud\Datastore\V1\PropertyFilter $var
@return $this | [
"A",
"filter",
"on",
"a",
"property",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Datastore/src/V1/Filter.php#L81-L87 | train |
googleapis/google-cloud-php | Talent/src/V4beta1/ProfileQuery.php | ProfileQuery.setWorkExperienceFilter | public function setWorkExperienceFilter($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Talent\V4beta1\WorkExperienceFilter::class);
$this->work_experience_filter = $arr;
return $this;
} | php | public function setWorkExperienceFilter($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Talent\V4beta1\WorkExperienceFilter::class);
$this->work_experience_filter = $arr;
return $this;
} | [
"public",
"function",
"setWorkExperienceFilter",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Talent",
"\\",
"V4beta1",
"\\",
"WorkExperienceFilter",
"::",
"class",
")",
";",
"$",
"this",
"->",
"work_experience_filter",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | Optional.
Work experience filter specifies the total working experience of profiles
to match on.
If a work experience filter isn't specified, profiles with any
professional experience are retrieved.
If multiple work experience filters are specified, profiles that match any
work experience filters are retrieved.
For example, search for profiles with 10 years of work experience.
Generated from protobuf field <code>repeated .google.cloud.talent.v4beta1.WorkExperienceFilter work_experience_filter = 7;</code>
@param \Google\Cloud\Talent\V4beta1\WorkExperienceFilter[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"Optional",
".",
"Work",
"experience",
"filter",
"specifies",
"the",
"total",
"working",
"experience",
"of",
"profiles",
"to",
"match",
"on",
".",
"If",
"a",
"work",
"experience",
"filter",
"isn",
"t",
"specified",
"profiles",
"with",
"any",
"professional",
"experience",
"are",
"retrieved",
".",
"If",
"multiple",
"work",
"experience",
"filters",
"are",
"specified",
"profiles",
"that",
"match",
"any",
"work",
"experience",
"filters",
"are",
"retrieved",
".",
"For",
"example",
"search",
"for",
"profiles",
"with",
"10",
"years",
"of",
"work",
"experience",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Talent/src/V4beta1/ProfileQuery.php#L594-L600 | train |
googleapis/google-cloud-php | Talent/src/V4beta1/ProfileQuery.php | ProfileQuery.setApplicationDateFilters | public function setApplicationDateFilters($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Talent\V4beta1\ApplicationDateFilter::class);
$this->application_date_filters = $arr;
return $this;
} | php | public function setApplicationDateFilters($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Talent\V4beta1\ApplicationDateFilter::class);
$this->application_date_filters = $arr;
return $this;
} | [
"public",
"function",
"setApplicationDateFilters",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Talent",
"\\",
"V4beta1",
"\\",
"ApplicationDateFilter",
"::",
"class",
")",
";",
"$",
"this",
"->",
"application_date_filters",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | Optional.
The application date filters specify application date ranges to match on.
Generated from protobuf field <code>repeated .google.cloud.talent.v4beta1.ApplicationDateFilter application_date_filters = 10;</code>
@param \Google\Cloud\Talent\V4beta1\ApplicationDateFilter[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"Optional",
".",
"The",
"application",
"date",
"filters",
"specify",
"application",
"date",
"ranges",
"to",
"match",
"on",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Talent/src/V4beta1/ProfileQuery.php#L713-L719 | train |
googleapis/google-cloud-php | Talent/src/V4beta1/ProfileQuery.php | ProfileQuery.setApplicationOutcomeNotesFilters | public function setApplicationOutcomeNotesFilters($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Talent\V4beta1\ApplicationOutcomeNotesFilter::class);
$this->application_outcome_notes_filters = $arr;
return $this;
} | php | public function setApplicationOutcomeNotesFilters($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Talent\V4beta1\ApplicationOutcomeNotesFilter::class);
$this->application_outcome_notes_filters = $arr;
return $this;
} | [
"public",
"function",
"setApplicationOutcomeNotesFilters",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Talent",
"\\",
"V4beta1",
"\\",
"ApplicationOutcomeNotesFilter",
"::",
"class",
")",
";",
"$",
"this",
"->",
"application_outcome_notes_filters",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | Optional.
The application outcome notes filters specify the notes for the outcome of
the job application.
Generated from protobuf field <code>repeated .google.cloud.talent.v4beta1.ApplicationOutcomeNotesFilter application_outcome_notes_filters = 11;</code>
@param \Google\Cloud\Talent\V4beta1\ApplicationOutcomeNotesFilter[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"Optional",
".",
"The",
"application",
"outcome",
"notes",
"filters",
"specify",
"the",
"notes",
"for",
"the",
"outcome",
"of",
"the",
"job",
"application",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Talent/src/V4beta1/ProfileQuery.php#L743-L749 | train |
googleapis/google-cloud-php | Talent/src/V4beta1/ProfileQuery.php | ProfileQuery.setApplicationLastStageFilters | public function setApplicationLastStageFilters($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Talent\V4beta1\ApplicationLastStageFilter::class);
$this->application_last_stage_filters = $arr;
return $this;
} | php | public function setApplicationLastStageFilters($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Talent\V4beta1\ApplicationLastStageFilter::class);
$this->application_last_stage_filters = $arr;
return $this;
} | [
"public",
"function",
"setApplicationLastStageFilters",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Talent",
"\\",
"V4beta1",
"\\",
"ApplicationLastStageFilter",
"::",
"class",
")",
";",
"$",
"this",
"->",
"application_last_stage_filters",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | Optional.
The application last stage filters specify the last stage of job
application.
Generated from protobuf field <code>repeated .google.cloud.talent.v4beta1.ApplicationLastStageFilter application_last_stage_filters = 12;</code>
@param \Google\Cloud\Talent\V4beta1\ApplicationLastStageFilter[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"Optional",
".",
"The",
"application",
"last",
"stage",
"filters",
"specify",
"the",
"last",
"stage",
"of",
"job",
"application",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Talent/src/V4beta1/ProfileQuery.php#L773-L779 | train |
googleapis/google-cloud-php | Talent/src/V4beta1/ProfileQuery.php | ProfileQuery.setApplicationJobFilters | public function setApplicationJobFilters($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Talent\V4beta1\ApplicationJobFilter::class);
$this->application_job_filters = $arr;
return $this;
} | php | public function setApplicationJobFilters($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Talent\V4beta1\ApplicationJobFilter::class);
$this->application_job_filters = $arr;
return $this;
} | [
"public",
"function",
"setApplicationJobFilters",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Talent",
"\\",
"V4beta1",
"\\",
"ApplicationJobFilter",
"::",
"class",
")",
";",
"$",
"this",
"->",
"application_job_filters",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | Optional.
The application job filters specify the job applied for in the application.
Generated from protobuf field <code>repeated .google.cloud.talent.v4beta1.ApplicationJobFilter application_job_filters = 13;</code>
@param \Google\Cloud\Talent\V4beta1\ApplicationJobFilter[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"Optional",
".",
"The",
"application",
"job",
"filters",
"specify",
"the",
"job",
"applied",
"for",
"in",
"the",
"application",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Talent/src/V4beta1/ProfileQuery.php#L801-L807 | train |
googleapis/google-cloud-php | Talent/src/V4beta1/ProfileQuery.php | ProfileQuery.setApplicationStatusFilters | public function setApplicationStatusFilters($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Talent\V4beta1\ApplicationStatusFilter::class);
$this->application_status_filters = $arr;
return $this;
} | php | public function setApplicationStatusFilters($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Talent\V4beta1\ApplicationStatusFilter::class);
$this->application_status_filters = $arr;
return $this;
} | [
"public",
"function",
"setApplicationStatusFilters",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Talent",
"\\",
"V4beta1",
"\\",
"ApplicationStatusFilter",
"::",
"class",
")",
";",
"$",
"this",
"->",
"application_status_filters",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | Optional.
The application status filters specify the status of job application.
Generated from protobuf field <code>repeated .google.cloud.talent.v4beta1.ApplicationStatusFilter application_status_filters = 14;</code>
@param \Google\Cloud\Talent\V4beta1\ApplicationStatusFilter[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"Optional",
".",
"The",
"application",
"status",
"filters",
"specify",
"the",
"status",
"of",
"job",
"application",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Talent/src/V4beta1/ProfileQuery.php#L829-L835 | train |
googleapis/google-cloud-php | Trace/src/V2/Span/TimeEvent.php | TimeEvent.setAnnotation | public function setAnnotation($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Trace\V2\Span_TimeEvent_Annotation::class);
$this->writeOneof(2, $var);
return $this;
} | php | public function setAnnotation($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Trace\V2\Span_TimeEvent_Annotation::class);
$this->writeOneof(2, $var);
return $this;
} | [
"public",
"function",
"setAnnotation",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Trace",
"\\",
"V2",
"\\",
"Span_TimeEvent_Annotation",
"::",
"class",
")",
";",
"$",
"this",
"->",
"writeOneof",
"(",
"2",
",",
"$",
"var",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Text annotation with a set of attributes.
Generated from protobuf field <code>.google.devtools.cloudtrace.v2.Span.TimeEvent.Annotation annotation = 2;</code>
@param \Google\Cloud\Trace\V2\Span\TimeEvent\Annotation $var
@return $this | [
"Text",
"annotation",
"with",
"a",
"set",
"of",
"attributes",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Trace/src/V2/Span/TimeEvent.php#L89-L95 | train |
googleapis/google-cloud-php | Monitoring/src/V3/ListNotificationChannelsResponse.php | ListNotificationChannelsResponse.setNotificationChannels | public function setNotificationChannels($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Monitoring\V3\NotificationChannel::class);
$this->notification_channels = $arr;
return $this;
} | php | public function setNotificationChannels($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Monitoring\V3\NotificationChannel::class);
$this->notification_channels = $arr;
return $this;
} | [
"public",
"function",
"setNotificationChannels",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Monitoring",
"\\",
"V3",
"\\",
"NotificationChannel",
"::",
"class",
")",
";",
"$",
"this",
"->",
"notification_channels",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | The notification channels defined for the specified project.
Generated from protobuf field <code>repeated .google.monitoring.v3.NotificationChannel notification_channels = 3;</code>
@param \Google\Cloud\Monitoring\V3\NotificationChannel[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"The",
"notification",
"channels",
"defined",
"for",
"the",
"specified",
"project",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Monitoring/src/V3/ListNotificationChannelsResponse.php#L72-L78 | train |
googleapis/google-cloud-php | Dlp/src/V2/CustomInfoType/DetectionRule/LikelihoodAdjustment.php | LikelihoodAdjustment.setFixedLikelihood | public function setFixedLikelihood($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Dlp\V2\Likelihood::class);
$this->writeOneof(1, $var);
return $this;
} | php | public function setFixedLikelihood($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Dlp\V2\Likelihood::class);
$this->writeOneof(1, $var);
return $this;
} | [
"public",
"function",
"setFixedLikelihood",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dlp",
"\\",
"V2",
"\\",
"Likelihood",
"::",
"class",
")",
";",
"$",
"this",
"->",
"writeOneof",
"(",
"1",
",",
"$",
"var",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Set the likelihood of a finding to a fixed value.
Generated from protobuf field <code>.google.privacy.dlp.v2.Likelihood fixed_likelihood = 1;</code>
@param int $var
@return $this | [
"Set",
"the",
"likelihood",
"of",
"a",
"finding",
"to",
"a",
"fixed",
"value",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/CustomInfoType/DetectionRule/LikelihoodAdjustment.php#L63-L69 | train |
googleapis/google-cloud-php | Spanner/src/V1/Gapic/SpannerGapicClient.php | SpannerGapicClient.databaseName | public static function databaseName($project, $instance, $database)
{
return self::getDatabaseNameTemplate()->render([
'project' => $project,
'instance' => $instance,
'database' => $database,
]);
} | php | public static function databaseName($project, $instance, $database)
{
return self::getDatabaseNameTemplate()->render([
'project' => $project,
'instance' => $instance,
'database' => $database,
]);
} | [
"public",
"static",
"function",
"databaseName",
"(",
"$",
"project",
",",
"$",
"instance",
",",
"$",
"database",
")",
"{",
"return",
"self",
"::",
"getDatabaseNameTemplate",
"(",
")",
"->",
"render",
"(",
"[",
"'project'",
"=>",
"$",
"project",
",",
"'instance'",
"=>",
"$",
"instance",
",",
"'database'",
"=>",
"$",
"database",
",",
"]",
")",
";",
"}"
] | Formats a string containing the fully-qualified path to represent
a database resource.
@param string $project
@param string $instance
@param string $database
@return string The formatted database resource.
@experimental | [
"Formats",
"a",
"string",
"containing",
"the",
"fully",
"-",
"qualified",
"path",
"to",
"represent",
"a",
"database",
"resource",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/V1/Gapic/SpannerGapicClient.php#L189-L196 | train |
googleapis/google-cloud-php | Spanner/src/V1/Gapic/SpannerGapicClient.php | SpannerGapicClient.sessionName | public static function sessionName($project, $instance, $database, $session)
{
return self::getSessionNameTemplate()->render([
'project' => $project,
'instance' => $instance,
'database' => $database,
'session' => $session,
]);
} | php | public static function sessionName($project, $instance, $database, $session)
{
return self::getSessionNameTemplate()->render([
'project' => $project,
'instance' => $instance,
'database' => $database,
'session' => $session,
]);
} | [
"public",
"static",
"function",
"sessionName",
"(",
"$",
"project",
",",
"$",
"instance",
",",
"$",
"database",
",",
"$",
"session",
")",
"{",
"return",
"self",
"::",
"getSessionNameTemplate",
"(",
")",
"->",
"render",
"(",
"[",
"'project'",
"=>",
"$",
"project",
",",
"'instance'",
"=>",
"$",
"instance",
",",
"'database'",
"=>",
"$",
"database",
",",
"'session'",
"=>",
"$",
"session",
",",
"]",
")",
";",
"}"
] | Formats a string containing the fully-qualified path to represent
a session resource.
@param string $project
@param string $instance
@param string $database
@param string $session
@return string The formatted session resource.
@experimental | [
"Formats",
"a",
"string",
"containing",
"the",
"fully",
"-",
"qualified",
"path",
"to",
"represent",
"a",
"session",
"resource",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/V1/Gapic/SpannerGapicClient.php#L210-L218 | train |
googleapis/google-cloud-php | Bigtable/src/Admin/V2/AppProfile.php | AppProfile.setMultiClusterRoutingUseAny | public function setMultiClusterRoutingUseAny($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\Admin\V2\AppProfile_MultiClusterRoutingUseAny::class);
$this->writeOneof(5, $var);
return $this;
} | php | public function setMultiClusterRoutingUseAny($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\Admin\V2\AppProfile_MultiClusterRoutingUseAny::class);
$this->writeOneof(5, $var);
return $this;
} | [
"public",
"function",
"setMultiClusterRoutingUseAny",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Bigtable",
"\\",
"Admin",
"\\",
"V2",
"\\",
"AppProfile_MultiClusterRoutingUseAny",
"::",
"class",
")",
";",
"$",
"this",
"->",
"writeOneof",
"(",
"5",
",",
"$",
"var",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Use a multi-cluster routing policy that may pick any cluster.
Generated from protobuf field <code>.google.bigtable.admin.v2.AppProfile.MultiClusterRoutingUseAny multi_cluster_routing_use_any = 5;</code>
@param \Google\Cloud\Bigtable\Admin\V2\AppProfile\MultiClusterRoutingUseAny $var
@return $this | [
"Use",
"a",
"multi",
"-",
"cluster",
"routing",
"policy",
"that",
"may",
"pick",
"any",
"cluster",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Bigtable/src/Admin/V2/AppProfile.php#L194-L200 | train |
googleapis/google-cloud-php | Bigtable/src/Admin/V2/AppProfile.php | AppProfile.setSingleClusterRouting | public function setSingleClusterRouting($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\Admin\V2\AppProfile_SingleClusterRouting::class);
$this->writeOneof(6, $var);
return $this;
} | php | public function setSingleClusterRouting($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\Admin\V2\AppProfile_SingleClusterRouting::class);
$this->writeOneof(6, $var);
return $this;
} | [
"public",
"function",
"setSingleClusterRouting",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Bigtable",
"\\",
"Admin",
"\\",
"V2",
"\\",
"AppProfile_SingleClusterRouting",
"::",
"class",
")",
";",
"$",
"this",
"->",
"writeOneof",
"(",
"6",
",",
"$",
"var",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Use a single-cluster routing policy.
Generated from protobuf field <code>.google.bigtable.admin.v2.AppProfile.SingleClusterRouting single_cluster_routing = 6;</code>
@param \Google\Cloud\Bigtable\Admin\V2\AppProfile\SingleClusterRouting $var
@return $this | [
"Use",
"a",
"single",
"-",
"cluster",
"routing",
"policy",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Bigtable/src/Admin/V2/AppProfile.php#L220-L226 | train |
googleapis/google-cloud-php | Datastore/src/DatastoreClient.php | DatastoreClient.allocateId | public function allocateId(Key $key, array $options = [])
{
$res = $this->allocateIds([$key], $options);
return $res[0];
} | php | public function allocateId(Key $key, array $options = [])
{
$res = $this->allocateIds([$key], $options);
return $res[0];
} | [
"public",
"function",
"allocateId",
"(",
"Key",
"$",
"key",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"res",
"=",
"$",
"this",
"->",
"allocateIds",
"(",
"[",
"$",
"key",
"]",
",",
"$",
"options",
")",
";",
"return",
"$",
"res",
"[",
"0",
"]",
";",
"}"
] | Allocates an available ID to a given incomplete key
Key MUST be in an incomplete state (i.e. including a kind but not an ID
or name in its final pathElement).
This method will execute a service request.
Example:
```
$key = $datastore->key('Person');
$keyWithAllocatedId = $datastore->allocateId($key);
```
@see https://cloud.google.com/datastore/reference/rest/v1/projects/allocateIds allocateIds
@param Key $key The incomplete key.
@param array $options [optional] Configuration options.
@return Key | [
"Allocates",
"an",
"available",
"ID",
"to",
"a",
"given",
"incomplete",
"key"
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Datastore/src/DatastoreClient.php#L476-L480 | train |
googleapis/google-cloud-php | Datastore/src/DatastoreClient.php | DatastoreClient.transaction | public function transaction(array $options = [])
{
$transaction = $this->operation->beginTransaction([
// if empty, force request to encode as {} rather than [].
'readWrite' => $this->pluck('transactionOptions', $options, false) ?: (object) []
], $options);
return new Transaction(
$this->operation,
$this->projectId,
$transaction
);
} | php | public function transaction(array $options = [])
{
$transaction = $this->operation->beginTransaction([
// if empty, force request to encode as {} rather than [].
'readWrite' => $this->pluck('transactionOptions', $options, false) ?: (object) []
], $options);
return new Transaction(
$this->operation,
$this->projectId,
$transaction
);
} | [
"public",
"function",
"transaction",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"transaction",
"=",
"$",
"this",
"->",
"operation",
"->",
"beginTransaction",
"(",
"[",
"// if empty, force request to encode as {} rather than [].",
"'readWrite'",
"=>",
"$",
"this",
"->",
"pluck",
"(",
"'transactionOptions'",
",",
"$",
"options",
",",
"false",
")",
"?",
":",
"(",
"object",
")",
"[",
"]",
"]",
",",
"$",
"options",
")",
";",
"return",
"new",
"Transaction",
"(",
"$",
"this",
"->",
"operation",
",",
"$",
"this",
"->",
"projectId",
",",
"$",
"transaction",
")",
";",
"}"
] | Create a Transaction.
Example:
```
$transaction = $datastore->transaction();
```
@see https://cloud.google.com/datastore/docs/concepts/transactions Datastore Transactions
@see https://cloud.google.com/datastore/docs/reference/rest/v1/projects/beginTransaction beginTransaction
@codingStandardsIgnoreStart
@param array $options {
Configuration options.
@type array $transactionOptions Transaction configuration. See
[ReadWrite](https://cloud.google.com/datastore/docs/reference/rest/v1/projects/beginTransaction#ReadWrite).
}
@return Transaction
@codingStandardsIgnoreEnd | [
"Create",
"a",
"Transaction",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Datastore/src/DatastoreClient.php#L532-L544 | train |
googleapis/google-cloud-php | Datastore/src/DatastoreClient.php | DatastoreClient.readOnlyTransaction | public function readOnlyTransaction(array $options = [])
{
$transaction = $this->operation->beginTransaction([
// if empty, force request to encode as {} rather than [].
'readOnly' => $this->pluck('transactionOptions', $options, false) ?: (object) []
], $options);
return new ReadOnlyTransaction(
$this->operation,
$this->projectId,
$transaction
);
} | php | public function readOnlyTransaction(array $options = [])
{
$transaction = $this->operation->beginTransaction([
// if empty, force request to encode as {} rather than [].
'readOnly' => $this->pluck('transactionOptions', $options, false) ?: (object) []
], $options);
return new ReadOnlyTransaction(
$this->operation,
$this->projectId,
$transaction
);
} | [
"public",
"function",
"readOnlyTransaction",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"transaction",
"=",
"$",
"this",
"->",
"operation",
"->",
"beginTransaction",
"(",
"[",
"// if empty, force request to encode as {} rather than [].",
"'readOnly'",
"=>",
"$",
"this",
"->",
"pluck",
"(",
"'transactionOptions'",
",",
"$",
"options",
",",
"false",
")",
"?",
":",
"(",
"object",
")",
"[",
"]",
"]",
",",
"$",
"options",
")",
";",
"return",
"new",
"ReadOnlyTransaction",
"(",
"$",
"this",
"->",
"operation",
",",
"$",
"this",
"->",
"projectId",
",",
"$",
"transaction",
")",
";",
"}"
] | Create a Read-Only Transaction.
Example:
```
$transaction = $datastore->readOnlyTransaction();
```
@see https://cloud.google.com/datastore/docs/concepts/transactions Datastore Transactions
@see https://cloud.google.com/datastore/docs/reference/rest/v1/projects/beginTransaction beginTransaction
@codingStandardsIgnoreStart
@param array $options {
Configuration options.
@type array $transactionOptions See
[ReadOnly](https://cloud.google.com/datastore/docs/reference/rest/v1/projects/beginTransaction#ReadOnly).
}
@return ReadOnlyTransaction
@codingStandardsIgnoreEnd | [
"Create",
"a",
"Read",
"-",
"Only",
"Transaction",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Datastore/src/DatastoreClient.php#L566-L578 | train |
googleapis/google-cloud-php | Datastore/src/DatastoreClient.php | DatastoreClient.insert | public function insert(EntityInterface $entity, array $options = [])
{
$res = $this->insertBatch([$entity], $options);
return $this->parseSingleMutationResult($res);
} | php | public function insert(EntityInterface $entity, array $options = [])
{
$res = $this->insertBatch([$entity], $options);
return $this->parseSingleMutationResult($res);
} | [
"public",
"function",
"insert",
"(",
"EntityInterface",
"$",
"entity",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"res",
"=",
"$",
"this",
"->",
"insertBatch",
"(",
"[",
"$",
"entity",
"]",
",",
"$",
"options",
")",
";",
"return",
"$",
"this",
"->",
"parseSingleMutationResult",
"(",
"$",
"res",
")",
";",
"}"
] | Insert an entity
An entity with incomplete keys will be allocated an ID prior to insertion.
Insert by this method is non-transactional. If you need transaction
support, use {@see Google\Cloud\Datastore\Transaction::insert()}.
Example:
```
$key = $datastore->key('Person', 'Bob');
$entity = $datastore->entity($key, ['firstName' => 'Bob']);
$datastore->insert($entity);
```
@see https://cloud.google.com/datastore/docs/reference/rest/v1/projects/commit Commit API documentation
@param EntityInterface $entity The entity to be inserted.
@param array $options [optional] Configuration options.
@return string The entity version.
@throws DomainException If a conflict occurs, fail. | [
"Insert",
"an",
"entity"
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Datastore/src/DatastoreClient.php#L603-L607 | train |
googleapis/google-cloud-php | Datastore/src/DatastoreClient.php | DatastoreClient.update | public function update(EntityInterface $entity, array $options = [])
{
$res = $this->updateBatch([$entity], $options);
return $this->parseSingleMutationResult($res);
} | php | public function update(EntityInterface $entity, array $options = [])
{
$res = $this->updateBatch([$entity], $options);
return $this->parseSingleMutationResult($res);
} | [
"public",
"function",
"update",
"(",
"EntityInterface",
"$",
"entity",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"res",
"=",
"$",
"this",
"->",
"updateBatch",
"(",
"[",
"$",
"entity",
"]",
",",
"$",
"options",
")",
";",
"return",
"$",
"this",
"->",
"parseSingleMutationResult",
"(",
"$",
"res",
")",
";",
"}"
] | Update an entity
Please note that updating a record in Cloud Datastore will replace the
existing record. Adding, editing or removing a single property is only
possible by first retrieving the entire entity in its existing state.
Update by this method is non-transactional. If you need transaction
support, use {@see Google\Cloud\Datastore\Transaction::update()}.
Example:
```
$entity['firstName'] = 'John';
$datastore->update($entity);
```
@see https://cloud.google.com/datastore/docs/reference/rest/v1/projects/commit Commit API documentation
@param EntityInterface $entity The entity to be updated.
@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 string The entity version.
@throws DomainException If a conflict occurs, fail. | [
"Update",
"an",
"entity"
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Datastore/src/DatastoreClient.php#L680-L684 | train |
googleapis/google-cloud-php | Datastore/src/DatastoreClient.php | DatastoreClient.upsert | public function upsert(EntityInterface $entity, array $options = [])
{
$res = $this->upsertBatch([$entity], $options);
return $this->parseSingleMutationResult($res);
} | php | public function upsert(EntityInterface $entity, array $options = [])
{
$res = $this->upsertBatch([$entity], $options);
return $this->parseSingleMutationResult($res);
} | [
"public",
"function",
"upsert",
"(",
"EntityInterface",
"$",
"entity",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"res",
"=",
"$",
"this",
"->",
"upsertBatch",
"(",
"[",
"$",
"entity",
"]",
",",
"$",
"options",
")",
";",
"return",
"$",
"this",
"->",
"parseSingleMutationResult",
"(",
"$",
"res",
")",
";",
"}"
] | Upsert an entity
Upsert will create a record if one does not already exist, or overwrite
existing record if one already exists.
Please note that upserting a record in Cloud Datastore will replace the
existing record, if one exists. Adding, editing or removing a single
property is only possible by first retrieving the entire entity in its
existing state.
An entity with incomplete keys will be allocated an ID prior to insertion.
Upsert by this method is non-transactional. If you need transaction
support, use {@see Google\Cloud\Datastore\Transaction::upsert()}.
Example:
```
$key = $datastore->key('Person', 'Bob');
$entity = $datastore->entity($key, ['firstName' => 'Bob']);
$datastore->upsert($entity);
```
@see https://cloud.google.com/datastore/docs/reference/rest/v1/projects/commit Commit API documentation
@param EntityInterface $entity The entity to be upserted.
@param array $options [optional] Configuration Options.
@return string The entity version.
@throws DomainException If a conflict occurs, fail. | [
"Upsert",
"an",
"entity"
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Datastore/src/DatastoreClient.php#L767-L771 | train |
googleapis/google-cloud-php | Datastore/src/DatastoreClient.php | DatastoreClient.deleteBatch | public function deleteBatch(array $keys, array $options = [])
{
$options += [
'baseVersion' => null
];
$mutations = [];
foreach ($keys as $key) {
$mutations[] = $this->operation->mutation('delete', $key, Key::class, $options['baseVersion']);
}
return $this->operation->commit($mutations, $options);
} | php | public function deleteBatch(array $keys, array $options = [])
{
$options += [
'baseVersion' => null
];
$mutations = [];
foreach ($keys as $key) {
$mutations[] = $this->operation->mutation('delete', $key, Key::class, $options['baseVersion']);
}
return $this->operation->commit($mutations, $options);
} | [
"public",
"function",
"deleteBatch",
"(",
"array",
"$",
"keys",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"+=",
"[",
"'baseVersion'",
"=>",
"null",
"]",
";",
"$",
"mutations",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"keys",
"as",
"$",
"key",
")",
"{",
"$",
"mutations",
"[",
"]",
"=",
"$",
"this",
"->",
"operation",
"->",
"mutation",
"(",
"'delete'",
",",
"$",
"key",
",",
"Key",
"::",
"class",
",",
"$",
"options",
"[",
"'baseVersion'",
"]",
")",
";",
"}",
"return",
"$",
"this",
"->",
"operation",
"->",
"commit",
"(",
"$",
"mutations",
",",
"$",
"options",
")",
";",
"}"
] | Delete multiple entities
Deletion by this method is non-transactional. If you need transaction
support, use {@see Google\Cloud\Datastore\Transaction::deleteBatch()}.
Example:
```
$keys = [
$datastore->key('Person', 'Bob'),
$datastore->key('Person', 'John')
];
$datastore->deleteBatch($keys);
```
@see https://cloud.google.com/datastore/docs/reference/rest/v1/projects/commit Commit API documentation
@param Key[] $keys The identifiers to delete.
@param array $options [optional] {
Configuration options
@type string $baseVersion Provides concurrency control. The version
of the entity that this mutation is being applied to. If this
does not match the current version on the server, the mutation
conflicts.
}
@return array [Response Body](https://cloud.google.com/datastore/reference/rest/v1/projects/commit#response-body) | [
"Delete",
"multiple",
"entities"
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Datastore/src/DatastoreClient.php#L883-L895 | train |
googleapis/google-cloud-php | Datastore/src/DatastoreClient.php | DatastoreClient.lookup | public function lookup(Key $key, array $options = [])
{
$res = $this->lookupBatch([$key], $options);
return (isset($res['found'][0]))
? $res['found'][0]
: null;
} | php | public function lookup(Key $key, array $options = [])
{
$res = $this->lookupBatch([$key], $options);
return (isset($res['found'][0]))
? $res['found'][0]
: null;
} | [
"public",
"function",
"lookup",
"(",
"Key",
"$",
"key",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"res",
"=",
"$",
"this",
"->",
"lookupBatch",
"(",
"[",
"$",
"key",
"]",
",",
"$",
"options",
")",
";",
"return",
"(",
"isset",
"(",
"$",
"res",
"[",
"'found'",
"]",
"[",
"0",
"]",
")",
")",
"?",
"$",
"res",
"[",
"'found'",
"]",
"[",
"0",
"]",
":",
"null",
";",
"}"
] | Retrieve an entity from the datastore
To lookup an entity inside a transaction, use
{@see Google\Cloud\Datastore\Transaction::lookup()}.
Example:
```
$key = $datastore->key('Person', 'Bob');
$entity = $datastore->lookup($key);
if (!is_null($entity)) {
echo $entity['firstName']; // 'Bob'
}
```
@see https://cloud.google.com/datastore/docs/reference/rest/v1/projects/lookup Lookup API documentation
@param Key $key The identifier to use to locate a desired entity.
@param array $options [optional] {
Configuration Options
@type string $readConsistency See
[ReadConsistency](https://cloud.google.com/datastore/reference/rest/v1/ReadOptions#ReadConsistency).
@type string $className If set, the given class will be returned.
Value must be the name of a class implementing
{@see Google\Cloud\Datastore\EntityInterface}. **Defaults to**
{@see Google\Cloud\Datastore\Entity}.
}
@return EntityInterface|null | [
"Retrieve",
"an",
"entity",
"from",
"the",
"datastore"
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Datastore/src/DatastoreClient.php#L928-L935 | train |
googleapis/google-cloud-php | Datastore/src/DatastoreClient.php | DatastoreClient.parseSingleMutationResult | private function parseSingleMutationResult(array $res)
{
$mutationResult = $res['mutationResults'][0];
if (isset($mutationResult['conflictDetected']) && $mutationResult['conflictDetected']) {
throw new DomainException(
'A conflict was detected in the mutation. ' .
'The operation failed.'
);
}
// cast to string for conformance between REST and gRPC.
return (string) $mutationResult['version'];
} | php | private function parseSingleMutationResult(array $res)
{
$mutationResult = $res['mutationResults'][0];
if (isset($mutationResult['conflictDetected']) && $mutationResult['conflictDetected']) {
throw new DomainException(
'A conflict was detected in the mutation. ' .
'The operation failed.'
);
}
// cast to string for conformance between REST and gRPC.
return (string) $mutationResult['version'];
} | [
"private",
"function",
"parseSingleMutationResult",
"(",
"array",
"$",
"res",
")",
"{",
"$",
"mutationResult",
"=",
"$",
"res",
"[",
"'mutationResults'",
"]",
"[",
"0",
"]",
";",
"if",
"(",
"isset",
"(",
"$",
"mutationResult",
"[",
"'conflictDetected'",
"]",
")",
"&&",
"$",
"mutationResult",
"[",
"'conflictDetected'",
"]",
")",
"{",
"throw",
"new",
"DomainException",
"(",
"'A conflict was detected in the mutation. '",
".",
"'The operation failed.'",
")",
";",
"}",
"// cast to string for conformance between REST and gRPC.",
"return",
"(",
"string",
")",
"$",
"mutationResult",
"[",
"'version'",
"]",
";",
"}"
] | Handle mutation results
@codingStandardsIgnoreStart
@param array $res [MutationResult](https://cloud.google.com/datastore/reference/rest/v1/projects/commit#MutationResult)
@return string
@throws DomainException
@codingStandardsIgnoreEnd | [
"Handle",
"mutation",
"results"
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Datastore/src/DatastoreClient.php#L1123-L1136 | train |
googleapis/google-cloud-php | Bigtable/src/Admin/V2/ListInstancesResponse.php | ListInstancesResponse.setInstances | public function setInstances($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Bigtable\Admin\V2\Instance::class);
$this->instances = $arr;
return $this;
} | php | public function setInstances($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Bigtable\Admin\V2\Instance::class);
$this->instances = $arr;
return $this;
} | [
"public",
"function",
"setInstances",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Bigtable",
"\\",
"Admin",
"\\",
"V2",
"\\",
"Instance",
"::",
"class",
")",
";",
"$",
"this",
"->",
"instances",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | The list of requested instances.
Generated from protobuf field <code>repeated .google.bigtable.admin.v2.Instance instances = 1;</code>
@param \Google\Cloud\Bigtable\Admin\V2\Instance[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"The",
"list",
"of",
"requested",
"instances",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Bigtable/src/Admin/V2/ListInstancesResponse.php#L84-L90 | train |
googleapis/google-cloud-php | Datastore/src/Query/Query.php | Query.projection | public function projection($properties)
{
if (!is_array($properties)) {
$properties = [$properties];
}
foreach ($properties as $property) {
$this->query['projection'][] = [
'property' => $this->propertyName($property)
];
}
return $this;
} | php | public function projection($properties)
{
if (!is_array($properties)) {
$properties = [$properties];
}
foreach ($properties as $property) {
$this->query['projection'][] = [
'property' => $this->propertyName($property)
];
}
return $this;
} | [
"public",
"function",
"projection",
"(",
"$",
"properties",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"properties",
")",
")",
"{",
"$",
"properties",
"=",
"[",
"$",
"properties",
"]",
";",
"}",
"foreach",
"(",
"$",
"properties",
"as",
"$",
"property",
")",
"{",
"$",
"this",
"->",
"query",
"[",
"'projection'",
"]",
"[",
"]",
"=",
"[",
"'property'",
"=>",
"$",
"this",
"->",
"propertyName",
"(",
"$",
"property",
")",
"]",
";",
"}",
"return",
"$",
"this",
";",
"}"
] | Set the Query Projection.
Accepts an array of properties. If set, only these properties will be
returned.
Example:
```
$query->projection(['firstName', 'lastName']);
```
@param array|string $properties The property or properties to include in
the result.
@return Query | [
"Set",
"the",
"Query",
"Projection",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Datastore/src/Query/Query.php#L165-L178 | train |
googleapis/google-cloud-php | Datastore/src/Query/Query.php | Query.kind | public function kind($kinds)
{
if (!is_array($kinds)) {
$kinds = [$kinds];
}
foreach ($kinds as $kind) {
$this->query['kind'][] = $this->propertyName($kind);
}
return $this;
} | php | public function kind($kinds)
{
if (!is_array($kinds)) {
$kinds = [$kinds];
}
foreach ($kinds as $kind) {
$this->query['kind'][] = $this->propertyName($kind);
}
return $this;
} | [
"public",
"function",
"kind",
"(",
"$",
"kinds",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"kinds",
")",
")",
"{",
"$",
"kinds",
"=",
"[",
"$",
"kinds",
"]",
";",
"}",
"foreach",
"(",
"$",
"kinds",
"as",
"$",
"kind",
")",
"{",
"$",
"this",
"->",
"query",
"[",
"'kind'",
"]",
"[",
"]",
"=",
"$",
"this",
"->",
"propertyName",
"(",
"$",
"kind",
")",
";",
"}",
"return",
"$",
"this",
";",
"}"
] | Set the Kind to query.
If empty, returns entities of all kinds. Must be set in order to filter
results. While you may supply as many kinds as you wish, datastore currently
only accepts one at a time.
Example:
```
$query->kind('Person');
```
@param array|string $kinds The kind or kinds to return. Only a single kind
is currently supported.
@return Query | [
"Set",
"the",
"Kind",
"to",
"query",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Datastore/src/Query/Query.php#L213-L224 | train |
googleapis/google-cloud-php | Datastore/src/Query/Query.php | Query.filter | public function filter($property, $operator, $value)
{
if (!isset($this->query['filter']) || !isset($this->query['filter']['compositeFilter'])) {
$this->initializeFilter();
}
$this->query['filter']['compositeFilter']['filters'][] = [
'propertyFilter' => [
'property' => $this->propertyName($property),
'value' => $this->entityMapper->valueObject($value),
'op' => $this->mapOperator($operator)
]
];
return $this;
} | php | public function filter($property, $operator, $value)
{
if (!isset($this->query['filter']) || !isset($this->query['filter']['compositeFilter'])) {
$this->initializeFilter();
}
$this->query['filter']['compositeFilter']['filters'][] = [
'propertyFilter' => [
'property' => $this->propertyName($property),
'value' => $this->entityMapper->valueObject($value),
'op' => $this->mapOperator($operator)
]
];
return $this;
} | [
"public",
"function",
"filter",
"(",
"$",
"property",
",",
"$",
"operator",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"query",
"[",
"'filter'",
"]",
")",
"||",
"!",
"isset",
"(",
"$",
"this",
"->",
"query",
"[",
"'filter'",
"]",
"[",
"'compositeFilter'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"initializeFilter",
"(",
")",
";",
"}",
"$",
"this",
"->",
"query",
"[",
"'filter'",
"]",
"[",
"'compositeFilter'",
"]",
"[",
"'filters'",
"]",
"[",
"]",
"=",
"[",
"'propertyFilter'",
"=>",
"[",
"'property'",
"=>",
"$",
"this",
"->",
"propertyName",
"(",
"$",
"property",
")",
",",
"'value'",
"=>",
"$",
"this",
"->",
"entityMapper",
"->",
"valueObject",
"(",
"$",
"value",
")",
",",
"'op'",
"=>",
"$",
"this",
"->",
"mapOperator",
"(",
"$",
"operator",
")",
"]",
"]",
";",
"return",
"$",
"this",
";",
"}"
] | Add a filter to the query.
If the top-level filter is specified as a propertyFilter, it will be replaced.
Any composite filters will be preserved and the new filter will be added.
Example:
```
$query->filter('firstName', '=', 'Bob')
->filter('lastName', '=', 'Testguy');
```
@see https://cloud.google.com/datastore/reference/rest/v1/projects/runQuery#operator_1 Allowed Operators
@param string $property The property to filter.
@param string $operator The operator to use in the filter. A list of
allowed operators may be found
[here](https://cloud.google.com/datastore/reference/rest/v1/projects/runQuery#operator_1).
Short comparison operators are provided for convenience and are
mapped to their datastore-compatible equivalents. Available short
operators are `=`, `<`, `<=`, `>`, and `>=`.
@param mixed $value The value to check.
@return Query | [
"Add",
"a",
"filter",
"to",
"the",
"query",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Datastore/src/Query/Query.php#L250-L265 | train |
googleapis/google-cloud-php | Datastore/src/Query/Query.php | Query.order | public function order($property, $direction = self::ORDER_DEFAULT)
{
$this->query['order'][] = [
'property' => $this->propertyName($property),
'direction' => $direction
];
return $this;
} | php | public function order($property, $direction = self::ORDER_DEFAULT)
{
$this->query['order'][] = [
'property' => $this->propertyName($property),
'direction' => $direction
];
return $this;
} | [
"public",
"function",
"order",
"(",
"$",
"property",
",",
"$",
"direction",
"=",
"self",
"::",
"ORDER_DEFAULT",
")",
"{",
"$",
"this",
"->",
"query",
"[",
"'order'",
"]",
"[",
"]",
"=",
"[",
"'property'",
"=>",
"$",
"this",
"->",
"propertyName",
"(",
"$",
"property",
")",
",",
"'direction'",
"=>",
"$",
"direction",
"]",
";",
"return",
"$",
"this",
";",
"}"
] | Specify an order for the query.
Example:
```
$query->order('birthDate', Query::ORDER_DESCENDING);
```
@see https://cloud.google.com/datastore/reference/rest/v1/projects/runQuery#Direction Allowed Directions
@param string $property The property to order by.
@param string $direction [optional] The direction to order in. Google
Cloud PHP provides class constants which map to allowed Datastore
values. Those constants are `Query::ORDER_DESCENDING` and
`Query::ORDER_ASCENDING`. **Defaults to** `Query::ORDER_ACENDING`.
@return Query | [
"Specify",
"an",
"order",
"for",
"the",
"query",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Datastore/src/Query/Query.php#L315-L323 | train |
googleapis/google-cloud-php | Datastore/src/Query/Query.php | Query.distinctOn | public function distinctOn($property)
{
if (!is_array($property)) {
$property = [$property];
}
foreach ($property as $prop) {
$this->query['distinctOn'][] = $this->propertyName($prop);
}
return $this;
} | php | public function distinctOn($property)
{
if (!is_array($property)) {
$property = [$property];
}
foreach ($property as $prop) {
$this->query['distinctOn'][] = $this->propertyName($prop);
}
return $this;
} | [
"public",
"function",
"distinctOn",
"(",
"$",
"property",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"property",
")",
")",
"{",
"$",
"property",
"=",
"[",
"$",
"property",
"]",
";",
"}",
"foreach",
"(",
"$",
"property",
"as",
"$",
"prop",
")",
"{",
"$",
"this",
"->",
"query",
"[",
"'distinctOn'",
"]",
"[",
"]",
"=",
"$",
"this",
"->",
"propertyName",
"(",
"$",
"prop",
")",
";",
"}",
"return",
"$",
"this",
";",
"}"
] | The properties to make distinct.
The query results will contain the first result for each distinct
combination of values for the given properties (if empty, all results
are returned).
Example:
```
$query->distinctOn('lastName');
```
@param array|string $property The property or properties to make distinct.
@return Query | [
"The",
"properties",
"to",
"make",
"distinct",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Datastore/src/Query/Query.php#L340-L351 | train |
googleapis/google-cloud-php | Datastore/src/Query/Query.php | Query.mapOperator | private function mapOperator($operator)
{
if (array_key_exists($operator, $this->shortOperators)) {
$operator = $this->shortOperators[$operator];
}
if (!in_array($operator, $this->allowedOperators)) {
throw new InvalidArgumentException(sprintf(
'Invalid operator `%s` given. Valid operators are %s.',
$operator,
implode(', ', $this->allowedOperators)
));
}
return $operator;
} | php | private function mapOperator($operator)
{
if (array_key_exists($operator, $this->shortOperators)) {
$operator = $this->shortOperators[$operator];
}
if (!in_array($operator, $this->allowedOperators)) {
throw new InvalidArgumentException(sprintf(
'Invalid operator `%s` given. Valid operators are %s.',
$operator,
implode(', ', $this->allowedOperators)
));
}
return $operator;
} | [
"private",
"function",
"mapOperator",
"(",
"$",
"operator",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"operator",
",",
"$",
"this",
"->",
"shortOperators",
")",
")",
"{",
"$",
"operator",
"=",
"$",
"this",
"->",
"shortOperators",
"[",
"$",
"operator",
"]",
";",
"}",
"if",
"(",
"!",
"in_array",
"(",
"$",
"operator",
",",
"$",
"this",
"->",
"allowedOperators",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'Invalid operator `%s` given. Valid operators are %s.'",
",",
"$",
"operator",
",",
"implode",
"(",
"', '",
",",
"$",
"this",
"->",
"allowedOperators",
")",
")",
")",
";",
"}",
"return",
"$",
"operator",
";",
"}"
] | Convert given operator to API-compatible operator.
@param string $operator
@return string | [
"Convert",
"given",
"operator",
"to",
"API",
"-",
"compatible",
"operator",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Datastore/src/Query/Query.php#L518-L533 | train |
googleapis/google-cloud-php | Scheduler/src/V1/ListJobsResponse.php | ListJobsResponse.setJobs | public function setJobs($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Scheduler\V1\Job::class);
$this->jobs = $arr;
return $this;
} | php | public function setJobs($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Scheduler\V1\Job::class);
$this->jobs = $arr;
return $this;
} | [
"public",
"function",
"setJobs",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Scheduler",
"\\",
"V1",
"\\",
"Job",
"::",
"class",
")",
";",
"$",
"this",
"->",
"jobs",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | The list of jobs.
Generated from protobuf field <code>repeated .google.cloud.scheduler.v1.Job jobs = 1;</code>
@param \Google\Cloud\Scheduler\V1\Job[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"The",
"list",
"of",
"jobs",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Scheduler/src/V1/ListJobsResponse.php#L76-L82 | train |
googleapis/google-cloud-php | Spanner/src/V1/CommitRequest.php | CommitRequest.setMutations | public function setMutations($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\V1\Mutation::class);
$this->mutations = $arr;
return $this;
} | php | public function setMutations($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\V1\Mutation::class);
$this->mutations = $arr;
return $this;
} | [
"public",
"function",
"setMutations",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Spanner",
"\\",
"V1",
"\\",
"Mutation",
"::",
"class",
")",
";",
"$",
"this",
"->",
"mutations",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | The mutations to be executed when this transaction commits. All
mutations are applied atomically, in the order they appear in
this list.
Generated from protobuf field <code>repeated .google.spanner.v1.Mutation mutations = 4;</code>
@param \Google\Cloud\Spanner\V1\Mutation[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"The",
"mutations",
"to",
"be",
"executed",
"when",
"this",
"transaction",
"commits",
".",
"All",
"mutations",
"are",
"applied",
"atomically",
"in",
"the",
"order",
"they",
"appear",
"in",
"this",
"list",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/V1/CommitRequest.php#L181-L187 | train |
googleapis/google-cloud-php | Dialogflow/src/V2/OutputAudioConfig.php | OutputAudioConfig.setAudioEncoding | public function setAudioEncoding($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\V2\OutputAudioEncoding::class);
$this->audio_encoding = $var;
return $this;
} | php | public function setAudioEncoding($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\V2\OutputAudioEncoding::class);
$this->audio_encoding = $var;
return $this;
} | [
"public",
"function",
"setAudioEncoding",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dialogflow",
"\\",
"V2",
"\\",
"OutputAudioEncoding",
"::",
"class",
")",
";",
"$",
"this",
"->",
"audio_encoding",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Required. Audio encoding of the synthesized audio content.
Generated from protobuf field <code>.google.cloud.dialogflow.v2.OutputAudioEncoding audio_encoding = 1;</code>
@param int $var
@return $this | [
"Required",
".",
"Audio",
"encoding",
"of",
"the",
"synthesized",
"audio",
"content",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dialogflow/src/V2/OutputAudioConfig.php#L82-L88 | train |
googleapis/google-cloud-php | Dialogflow/src/V2/OutputAudioConfig.php | OutputAudioConfig.setSynthesizeSpeechConfig | public function setSynthesizeSpeechConfig($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\SynthesizeSpeechConfig::class);
$this->synthesize_speech_config = $var;
return $this;
} | php | public function setSynthesizeSpeechConfig($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\SynthesizeSpeechConfig::class);
$this->synthesize_speech_config = $var;
return $this;
} | [
"public",
"function",
"setSynthesizeSpeechConfig",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dialogflow",
"\\",
"V2",
"\\",
"SynthesizeSpeechConfig",
"::",
"class",
")",
";",
"$",
"this",
"->",
"synthesize_speech_config",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Optional. Configuration of how speech should be synthesized.
Generated from protobuf field <code>.google.cloud.dialogflow.v2.SynthesizeSpeechConfig synthesize_speech_config = 3;</code>
@param \Google\Cloud\Dialogflow\V2\SynthesizeSpeechConfig $var
@return $this | [
"Optional",
".",
"Configuration",
"of",
"how",
"speech",
"should",
"be",
"synthesized",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dialogflow/src/V2/OutputAudioConfig.php#L142-L148 | train |
googleapis/google-cloud-php | AutoMl/src/V1beta1/TextClassificationDatasetMetadata.php | TextClassificationDatasetMetadata.setClassificationType | public function setClassificationType($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\AutoMl\V1beta1\ClassificationType::class);
$this->classification_type = $var;
return $this;
} | php | public function setClassificationType($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\AutoMl\V1beta1\ClassificationType::class);
$this->classification_type = $var;
return $this;
} | [
"public",
"function",
"setClassificationType",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"AutoMl",
"\\",
"V1beta1",
"\\",
"ClassificationType",
"::",
"class",
")",
";",
"$",
"this",
"->",
"classification_type",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Required.
Type of the classification problem.
Generated from protobuf field <code>.google.cloud.automl.v1beta1.ClassificationType classification_type = 1;</code>
@param int $var
@return $this | [
"Required",
".",
"Type",
"of",
"the",
"classification",
"problem",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/AutoMl/src/V1beta1/TextClassificationDatasetMetadata.php#L62-L68 | train |
googleapis/google-cloud-php | Vision/src/V1/TextAnnotation/TextProperty.php | TextProperty.setDetectedLanguages | public function setDetectedLanguages($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\TextAnnotation\DetectedLanguage::class);
$this->detected_languages = $arr;
return $this;
} | php | public function setDetectedLanguages($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\TextAnnotation\DetectedLanguage::class);
$this->detected_languages = $arr;
return $this;
} | [
"public",
"function",
"setDetectedLanguages",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Vision",
"\\",
"V1",
"\\",
"TextAnnotation",
"\\",
"DetectedLanguage",
"::",
"class",
")",
";",
"$",
"this",
"->",
"detected_languages",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | A list of detected languages together with confidence.
Generated from protobuf field <code>repeated .google.cloud.vision.v1.TextAnnotation.DetectedLanguage detected_languages = 1;</code>
@param \Google\Cloud\Vision\V1\TextAnnotation\DetectedLanguage[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"A",
"list",
"of",
"detected",
"languages",
"together",
"with",
"confidence",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Vision/src/V1/TextAnnotation/TextProperty.php#L66-L72 | train |
googleapis/google-cloud-php | Vision/src/V1/TextAnnotation/TextProperty.php | TextProperty.setDetectedBreak | public function setDetectedBreak($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\TextAnnotation_DetectedBreak::class);
$this->detected_break = $var;
return $this;
} | php | public function setDetectedBreak($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\TextAnnotation_DetectedBreak::class);
$this->detected_break = $var;
return $this;
} | [
"public",
"function",
"setDetectedBreak",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Vision",
"\\",
"V1",
"\\",
"TextAnnotation_DetectedBreak",
"::",
"class",
")",
";",
"$",
"this",
"->",
"detected_break",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Detected start or end of a text segment.
Generated from protobuf field <code>.google.cloud.vision.v1.TextAnnotation.DetectedBreak detected_break = 2;</code>
@param \Google\Cloud\Vision\V1\TextAnnotation\DetectedBreak $var
@return $this | [
"Detected",
"start",
"or",
"end",
"of",
"a",
"text",
"segment",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Vision/src/V1/TextAnnotation/TextProperty.php#L92-L98 | train |
googleapis/google-cloud-php | Vision/src/V1/AnnotateImageResponse.php | AnnotateImageResponse.setLandmarkAnnotations | public function setLandmarkAnnotations($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\EntityAnnotation::class);
$this->landmark_annotations = $arr;
return $this;
} | php | public function setLandmarkAnnotations($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\EntityAnnotation::class);
$this->landmark_annotations = $arr;
return $this;
} | [
"public",
"function",
"setLandmarkAnnotations",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Vision",
"\\",
"V1",
"\\",
"EntityAnnotation",
"::",
"class",
")",
";",
"$",
"this",
"->",
"landmark_annotations",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | If present, landmark detection has completed successfully.
Generated from protobuf field <code>repeated .google.cloud.vision.v1.EntityAnnotation landmark_annotations = 2;</code>
@param \Google\Cloud\Vision\V1\EntityAnnotation[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"If",
"present",
"landmark",
"detection",
"has",
"completed",
"successfully",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Vision/src/V1/AnnotateImageResponse.php#L202-L208 | train |
googleapis/google-cloud-php | Vision/src/V1/AnnotateImageResponse.php | AnnotateImageResponse.setLogoAnnotations | public function setLogoAnnotations($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\EntityAnnotation::class);
$this->logo_annotations = $arr;
return $this;
} | php | public function setLogoAnnotations($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\EntityAnnotation::class);
$this->logo_annotations = $arr;
return $this;
} | [
"public",
"function",
"setLogoAnnotations",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Vision",
"\\",
"V1",
"\\",
"EntityAnnotation",
"::",
"class",
")",
";",
"$",
"this",
"->",
"logo_annotations",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | If present, logo detection has completed successfully.
Generated from protobuf field <code>repeated .google.cloud.vision.v1.EntityAnnotation logo_annotations = 3;</code>
@param \Google\Cloud\Vision\V1\EntityAnnotation[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"If",
"present",
"logo",
"detection",
"has",
"completed",
"successfully",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Vision/src/V1/AnnotateImageResponse.php#L228-L234 | train |
googleapis/google-cloud-php | Vision/src/V1/AnnotateImageResponse.php | AnnotateImageResponse.setLabelAnnotations | public function setLabelAnnotations($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\EntityAnnotation::class);
$this->label_annotations = $arr;
return $this;
} | php | public function setLabelAnnotations($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\EntityAnnotation::class);
$this->label_annotations = $arr;
return $this;
} | [
"public",
"function",
"setLabelAnnotations",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Vision",
"\\",
"V1",
"\\",
"EntityAnnotation",
"::",
"class",
")",
";",
"$",
"this",
"->",
"label_annotations",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | If present, label detection has completed successfully.
Generated from protobuf field <code>repeated .google.cloud.vision.v1.EntityAnnotation label_annotations = 4;</code>
@param \Google\Cloud\Vision\V1\EntityAnnotation[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"If",
"present",
"label",
"detection",
"has",
"completed",
"successfully",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Vision/src/V1/AnnotateImageResponse.php#L254-L260 | train |
googleapis/google-cloud-php | Vision/src/V1/AnnotateImageResponse.php | AnnotateImageResponse.setLocalizedObjectAnnotations | public function setLocalizedObjectAnnotations($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\LocalizedObjectAnnotation::class);
$this->localized_object_annotations = $arr;
return $this;
} | php | public function setLocalizedObjectAnnotations($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\LocalizedObjectAnnotation::class);
$this->localized_object_annotations = $arr;
return $this;
} | [
"public",
"function",
"setLocalizedObjectAnnotations",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Vision",
"\\",
"V1",
"\\",
"LocalizedObjectAnnotation",
"::",
"class",
")",
";",
"$",
"this",
"->",
"localized_object_annotations",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | If present, localized object detection has completed successfully.
This will be sorted descending by confidence score.
Generated from protobuf field <code>repeated .google.cloud.vision.v1.LocalizedObjectAnnotation localized_object_annotations = 22;</code>
@param \Google\Cloud\Vision\V1\LocalizedObjectAnnotation[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"If",
"present",
"localized",
"object",
"detection",
"has",
"completed",
"successfully",
".",
"This",
"will",
"be",
"sorted",
"descending",
"by",
"confidence",
"score",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Vision/src/V1/AnnotateImageResponse.php#L282-L288 | train |
googleapis/google-cloud-php | Vision/src/V1/AnnotateImageResponse.php | AnnotateImageResponse.setSafeSearchAnnotation | public function setSafeSearchAnnotation($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\SafeSearchAnnotation::class);
$this->safe_search_annotation = $var;
return $this;
} | php | public function setSafeSearchAnnotation($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\SafeSearchAnnotation::class);
$this->safe_search_annotation = $var;
return $this;
} | [
"public",
"function",
"setSafeSearchAnnotation",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Vision",
"\\",
"V1",
"\\",
"SafeSearchAnnotation",
"::",
"class",
")",
";",
"$",
"this",
"->",
"safe_search_annotation",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | If present, safe-search annotation has completed successfully.
Generated from protobuf field <code>.google.cloud.vision.v1.SafeSearchAnnotation safe_search_annotation = 6;</code>
@param \Google\Cloud\Vision\V1\SafeSearchAnnotation $var
@return $this | [
"If",
"present",
"safe",
"-",
"search",
"annotation",
"has",
"completed",
"successfully",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Vision/src/V1/AnnotateImageResponse.php#L366-L372 | train |
googleapis/google-cloud-php | Vision/src/V1/AnnotateImageResponse.php | AnnotateImageResponse.setImagePropertiesAnnotation | public function setImagePropertiesAnnotation($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ImageProperties::class);
$this->image_properties_annotation = $var;
return $this;
} | php | public function setImagePropertiesAnnotation($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ImageProperties::class);
$this->image_properties_annotation = $var;
return $this;
} | [
"public",
"function",
"setImagePropertiesAnnotation",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Vision",
"\\",
"V1",
"\\",
"ImageProperties",
"::",
"class",
")",
";",
"$",
"this",
"->",
"image_properties_annotation",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | If present, image properties were extracted successfully.
Generated from protobuf field <code>.google.cloud.vision.v1.ImageProperties image_properties_annotation = 8;</code>
@param \Google\Cloud\Vision\V1\ImageProperties $var
@return $this | [
"If",
"present",
"image",
"properties",
"were",
"extracted",
"successfully",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Vision/src/V1/AnnotateImageResponse.php#L392-L398 | train |
googleapis/google-cloud-php | Vision/src/V1/AnnotateImageResponse.php | AnnotateImageResponse.setCropHintsAnnotation | public function setCropHintsAnnotation($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\CropHintsAnnotation::class);
$this->crop_hints_annotation = $var;
return $this;
} | php | public function setCropHintsAnnotation($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\CropHintsAnnotation::class);
$this->crop_hints_annotation = $var;
return $this;
} | [
"public",
"function",
"setCropHintsAnnotation",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Vision",
"\\",
"V1",
"\\",
"CropHintsAnnotation",
"::",
"class",
")",
";",
"$",
"this",
"->",
"crop_hints_annotation",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | If present, crop hints have completed successfully.
Generated from protobuf field <code>.google.cloud.vision.v1.CropHintsAnnotation crop_hints_annotation = 11;</code>
@param \Google\Cloud\Vision\V1\CropHintsAnnotation $var
@return $this | [
"If",
"present",
"crop",
"hints",
"have",
"completed",
"successfully",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Vision/src/V1/AnnotateImageResponse.php#L418-L424 | train |
googleapis/google-cloud-php | Vision/src/V1/AnnotateImageResponse.php | AnnotateImageResponse.setWebDetection | public function setWebDetection($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\WebDetection::class);
$this->web_detection = $var;
return $this;
} | php | public function setWebDetection($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\WebDetection::class);
$this->web_detection = $var;
return $this;
} | [
"public",
"function",
"setWebDetection",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Vision",
"\\",
"V1",
"\\",
"WebDetection",
"::",
"class",
")",
";",
"$",
"this",
"->",
"web_detection",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | If present, web detection has completed successfully.
Generated from protobuf field <code>.google.cloud.vision.v1.WebDetection web_detection = 13;</code>
@param \Google\Cloud\Vision\V1\WebDetection $var
@return $this | [
"If",
"present",
"web",
"detection",
"has",
"completed",
"successfully",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Vision/src/V1/AnnotateImageResponse.php#L444-L450 | train |
googleapis/google-cloud-php | Vision/src/V1/AnnotateImageResponse.php | AnnotateImageResponse.setProductSearchResults | public function setProductSearchResults($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ProductSearchResults::class);
$this->product_search_results = $var;
return $this;
} | php | public function setProductSearchResults($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ProductSearchResults::class);
$this->product_search_results = $var;
return $this;
} | [
"public",
"function",
"setProductSearchResults",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Vision",
"\\",
"V1",
"\\",
"ProductSearchResults",
"::",
"class",
")",
";",
"$",
"this",
"->",
"product_search_results",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | If present, product search has completed successfully.
Generated from protobuf field <code>.google.cloud.vision.v1.ProductSearchResults product_search_results = 14;</code>
@param \Google\Cloud\Vision\V1\ProductSearchResults $var
@return $this | [
"If",
"present",
"product",
"search",
"has",
"completed",
"successfully",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Vision/src/V1/AnnotateImageResponse.php#L470-L476 | train |
googleapis/google-cloud-php | Vision/src/V1/AnnotateImageResponse.php | AnnotateImageResponse.setContext | public function setContext($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ImageAnnotationContext::class);
$this->context = $var;
return $this;
} | php | public function setContext($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ImageAnnotationContext::class);
$this->context = $var;
return $this;
} | [
"public",
"function",
"setContext",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Vision",
"\\",
"V1",
"\\",
"ImageAnnotationContext",
"::",
"class",
")",
";",
"$",
"this",
"->",
"context",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | If present, contextual information is needed to understand where this image
comes from.
Generated from protobuf field <code>.google.cloud.vision.v1.ImageAnnotationContext context = 21;</code>
@param \Google\Cloud\Vision\V1\ImageAnnotationContext $var
@return $this | [
"If",
"present",
"contextual",
"information",
"is",
"needed",
"to",
"understand",
"where",
"this",
"image",
"comes",
"from",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Vision/src/V1/AnnotateImageResponse.php#L528-L534 | train |
googleapis/google-cloud-php | Datastore/src/DatastoreSessionHandler.php | DatastoreSessionHandler.open | public function open($savePath, $sessionName)
{
$this->kind = $sessionName;
if (preg_match(self::NAMESPACE_ALLOWED_PATTERN, $savePath) !== 1 ||
preg_match(self::NAMESPACE_RESERVED_PATTERN, $savePath) === 1) {
throw new InvalidArgumentException(
sprintf('The given save_path "%s" not allowed', $savePath)
);
}
$this->namespaceId = $savePath;
$this->transaction = $this->datastore->transaction();
return true;
} | php | public function open($savePath, $sessionName)
{
$this->kind = $sessionName;
if (preg_match(self::NAMESPACE_ALLOWED_PATTERN, $savePath) !== 1 ||
preg_match(self::NAMESPACE_RESERVED_PATTERN, $savePath) === 1) {
throw new InvalidArgumentException(
sprintf('The given save_path "%s" not allowed', $savePath)
);
}
$this->namespaceId = $savePath;
$this->transaction = $this->datastore->transaction();
return true;
} | [
"public",
"function",
"open",
"(",
"$",
"savePath",
",",
"$",
"sessionName",
")",
"{",
"$",
"this",
"->",
"kind",
"=",
"$",
"sessionName",
";",
"if",
"(",
"preg_match",
"(",
"self",
"::",
"NAMESPACE_ALLOWED_PATTERN",
",",
"$",
"savePath",
")",
"!==",
"1",
"||",
"preg_match",
"(",
"self",
"::",
"NAMESPACE_RESERVED_PATTERN",
",",
"$",
"savePath",
")",
"===",
"1",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'The given save_path \"%s\" not allowed'",
",",
"$",
"savePath",
")",
")",
";",
"}",
"$",
"this",
"->",
"namespaceId",
"=",
"$",
"savePath",
";",
"$",
"this",
"->",
"transaction",
"=",
"$",
"this",
"->",
"datastore",
"->",
"transaction",
"(",
")",
";",
"return",
"true",
";",
"}"
] | Start a session, by creating a transaction for the later `write`.
@param string $savePath The value of `session.save_path` setting will be
used here. It will use this value as the Datastore namespaceId.
@param string $sessionName The value of `session.name` setting will be
used here. It will use this value as the Datastore kind.
@return bool | [
"Start",
"a",
"session",
"by",
"creating",
"a",
"transaction",
"for",
"the",
"later",
"write",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Datastore/src/DatastoreSessionHandler.php#L186-L198 | train |
googleapis/google-cloud-php | Datastore/src/DatastoreSessionHandler.php | DatastoreSessionHandler.read | public function read($id)
{
try {
$key = $this->datastore->key(
$this->kind,
$id,
['namespaceId' => $this->namespaceId]
);
$entity = $this->transaction->lookup($key);
if ($entity !== null && isset($entity['data'])) {
return $entity['data'];
}
} catch (Exception $e) {
trigger_error(
sprintf('Datastore lookup failed: %s', $e->getMessage()),
E_USER_WARNING
);
}
return '';
} | php | public function read($id)
{
try {
$key = $this->datastore->key(
$this->kind,
$id,
['namespaceId' => $this->namespaceId]
);
$entity = $this->transaction->lookup($key);
if ($entity !== null && isset($entity['data'])) {
return $entity['data'];
}
} catch (Exception $e) {
trigger_error(
sprintf('Datastore lookup failed: %s', $e->getMessage()),
E_USER_WARNING
);
}
return '';
} | [
"public",
"function",
"read",
"(",
"$",
"id",
")",
"{",
"try",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"datastore",
"->",
"key",
"(",
"$",
"this",
"->",
"kind",
",",
"$",
"id",
",",
"[",
"'namespaceId'",
"=>",
"$",
"this",
"->",
"namespaceId",
"]",
")",
";",
"$",
"entity",
"=",
"$",
"this",
"->",
"transaction",
"->",
"lookup",
"(",
"$",
"key",
")",
";",
"if",
"(",
"$",
"entity",
"!==",
"null",
"&&",
"isset",
"(",
"$",
"entity",
"[",
"'data'",
"]",
")",
")",
"{",
"return",
"$",
"entity",
"[",
"'data'",
"]",
";",
"}",
"}",
"catch",
"(",
"Exception",
"$",
"e",
")",
"{",
"trigger_error",
"(",
"sprintf",
"(",
"'Datastore lookup failed: %s'",
",",
"$",
"e",
"->",
"getMessage",
"(",
")",
")",
",",
"E_USER_WARNING",
")",
";",
"}",
"return",
"''",
";",
"}"
] | Read the session data from Cloud Datastore. | [
"Read",
"the",
"session",
"data",
"from",
"Cloud",
"Datastore",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Datastore/src/DatastoreSessionHandler.php#L211-L230 | train |
googleapis/google-cloud-php | Datastore/src/DatastoreSessionHandler.php | DatastoreSessionHandler.write | public function write($id, $data)
{
try {
$key = $this->datastore->key(
$this->kind,
$id,
['namespaceId' => $this->namespaceId]
);
$entity = $this->datastore->entity(
$key,
[
'data' => $data,
't' => time()
],
$this->options['entityOptions']
);
$this->transaction->upsert($entity);
$this->transaction->commit();
} catch (Exception $e) {
trigger_error(
sprintf('Datastore upsert failed: %s', $e->getMessage()),
E_USER_WARNING
);
return false;
}
return true;
} | php | public function write($id, $data)
{
try {
$key = $this->datastore->key(
$this->kind,
$id,
['namespaceId' => $this->namespaceId]
);
$entity = $this->datastore->entity(
$key,
[
'data' => $data,
't' => time()
],
$this->options['entityOptions']
);
$this->transaction->upsert($entity);
$this->transaction->commit();
} catch (Exception $e) {
trigger_error(
sprintf('Datastore upsert failed: %s', $e->getMessage()),
E_USER_WARNING
);
return false;
}
return true;
} | [
"public",
"function",
"write",
"(",
"$",
"id",
",",
"$",
"data",
")",
"{",
"try",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"datastore",
"->",
"key",
"(",
"$",
"this",
"->",
"kind",
",",
"$",
"id",
",",
"[",
"'namespaceId'",
"=>",
"$",
"this",
"->",
"namespaceId",
"]",
")",
";",
"$",
"entity",
"=",
"$",
"this",
"->",
"datastore",
"->",
"entity",
"(",
"$",
"key",
",",
"[",
"'data'",
"=>",
"$",
"data",
",",
"'t'",
"=>",
"time",
"(",
")",
"]",
",",
"$",
"this",
"->",
"options",
"[",
"'entityOptions'",
"]",
")",
";",
"$",
"this",
"->",
"transaction",
"->",
"upsert",
"(",
"$",
"entity",
")",
";",
"$",
"this",
"->",
"transaction",
"->",
"commit",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"$",
"e",
")",
"{",
"trigger_error",
"(",
"sprintf",
"(",
"'Datastore upsert failed: %s'",
",",
"$",
"e",
"->",
"getMessage",
"(",
")",
")",
",",
"E_USER_WARNING",
")",
";",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] | Write the session data to Cloud Datastore.
@param string $id Identifier used to construct a {@see \Google\Cloud\Datastore\Key}
for the {@see \Google\Cloud\Datastore\Entity} to be written.
@param string $data The session data to write to the {@see \Google\Cloud\Datastore\Entity}.
@return bool | [
"Write",
"the",
"session",
"data",
"to",
"Cloud",
"Datastore",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Datastore/src/DatastoreSessionHandler.php#L240-L266 | train |
googleapis/google-cloud-php | Datastore/src/DatastoreSessionHandler.php | DatastoreSessionHandler.destroy | public function destroy($id)
{
try {
$key = $this->datastore->key(
$this->kind,
$id,
['namespaceId' => $this->namespaceId]
);
$this->transaction->delete($key);
$this->transaction->commit();
} catch (Exception $e) {
trigger_error(
sprintf('Datastore delete failed: %s', $e->getMessage()),
E_USER_WARNING
);
return false;
}
return true;
} | php | public function destroy($id)
{
try {
$key = $this->datastore->key(
$this->kind,
$id,
['namespaceId' => $this->namespaceId]
);
$this->transaction->delete($key);
$this->transaction->commit();
} catch (Exception $e) {
trigger_error(
sprintf('Datastore delete failed: %s', $e->getMessage()),
E_USER_WARNING
);
return false;
}
return true;
} | [
"public",
"function",
"destroy",
"(",
"$",
"id",
")",
"{",
"try",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"datastore",
"->",
"key",
"(",
"$",
"this",
"->",
"kind",
",",
"$",
"id",
",",
"[",
"'namespaceId'",
"=>",
"$",
"this",
"->",
"namespaceId",
"]",
")",
";",
"$",
"this",
"->",
"transaction",
"->",
"delete",
"(",
"$",
"key",
")",
";",
"$",
"this",
"->",
"transaction",
"->",
"commit",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"$",
"e",
")",
"{",
"trigger_error",
"(",
"sprintf",
"(",
"'Datastore delete failed: %s'",
",",
"$",
"e",
"->",
"getMessage",
"(",
")",
")",
",",
"E_USER_WARNING",
")",
";",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] | Delete the session data from Cloud Datastore. | [
"Delete",
"the",
"session",
"data",
"from",
"Cloud",
"Datastore",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Datastore/src/DatastoreSessionHandler.php#L271-L289 | train |
googleapis/google-cloud-php | Datastore/src/DatastoreSessionHandler.php | DatastoreSessionHandler.gc | public function gc($maxlifetime)
{
if ($this->gcLimit === 0) {
return true;
}
try {
$query = $this->datastore->query()
->kind($this->kind)
->filter('t', '<', time() - $maxlifetime)
->order('t')
->keysOnly()
->limit($this->gcLimit);
$result = $this->datastore->runQuery(
$query,
['namespaceId' => $this->namespaceId]
);
$keys = [];
/* @var Entity $e */
foreach ($result as $e) {
$keys[] = $e->key();
}
if (!empty($keys)) {
$this->datastore->deleteBatch($keys);
}
} catch (Exception $e) {
trigger_error(
sprintf('Session gc failed: %s', $e->getMessage()),
E_USER_WARNING
);
return false;
}
return true;
} | php | public function gc($maxlifetime)
{
if ($this->gcLimit === 0) {
return true;
}
try {
$query = $this->datastore->query()
->kind($this->kind)
->filter('t', '<', time() - $maxlifetime)
->order('t')
->keysOnly()
->limit($this->gcLimit);
$result = $this->datastore->runQuery(
$query,
['namespaceId' => $this->namespaceId]
);
$keys = [];
/* @var Entity $e */
foreach ($result as $e) {
$keys[] = $e->key();
}
if (!empty($keys)) {
$this->datastore->deleteBatch($keys);
}
} catch (Exception $e) {
trigger_error(
sprintf('Session gc failed: %s', $e->getMessage()),
E_USER_WARNING
);
return false;
}
return true;
} | [
"public",
"function",
"gc",
"(",
"$",
"maxlifetime",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"gcLimit",
"===",
"0",
")",
"{",
"return",
"true",
";",
"}",
"try",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"datastore",
"->",
"query",
"(",
")",
"->",
"kind",
"(",
"$",
"this",
"->",
"kind",
")",
"->",
"filter",
"(",
"'t'",
",",
"'<'",
",",
"time",
"(",
")",
"-",
"$",
"maxlifetime",
")",
"->",
"order",
"(",
"'t'",
")",
"->",
"keysOnly",
"(",
")",
"->",
"limit",
"(",
"$",
"this",
"->",
"gcLimit",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"datastore",
"->",
"runQuery",
"(",
"$",
"query",
",",
"[",
"'namespaceId'",
"=>",
"$",
"this",
"->",
"namespaceId",
"]",
")",
";",
"$",
"keys",
"=",
"[",
"]",
";",
"/* @var Entity $e */",
"foreach",
"(",
"$",
"result",
"as",
"$",
"e",
")",
"{",
"$",
"keys",
"[",
"]",
"=",
"$",
"e",
"->",
"key",
"(",
")",
";",
"}",
"if",
"(",
"!",
"empty",
"(",
"$",
"keys",
")",
")",
"{",
"$",
"this",
"->",
"datastore",
"->",
"deleteBatch",
"(",
"$",
"keys",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"$",
"e",
")",
"{",
"trigger_error",
"(",
"sprintf",
"(",
"'Session gc failed: %s'",
",",
"$",
"e",
"->",
"getMessage",
"(",
")",
")",
",",
"E_USER_WARNING",
")",
";",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] | Delete the old session data from Cloud Datastore. | [
"Delete",
"the",
"old",
"session",
"data",
"from",
"Cloud",
"Datastore",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Datastore/src/DatastoreSessionHandler.php#L294-L326 | train |
googleapis/google-cloud-php | Vision/src/V1/BoundingPoly.php | BoundingPoly.setVertices | public function setVertices($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\Vertex::class);
$this->vertices = $arr;
return $this;
} | php | public function setVertices($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\Vertex::class);
$this->vertices = $arr;
return $this;
} | [
"public",
"function",
"setVertices",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Vision",
"\\",
"V1",
"\\",
"Vertex",
"::",
"class",
")",
";",
"$",
"this",
"->",
"vertices",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | The bounding polygon vertices.
Generated from protobuf field <code>repeated .google.cloud.vision.v1.Vertex vertices = 1;</code>
@param \Google\Cloud\Vision\V1\Vertex[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"The",
"bounding",
"polygon",
"vertices",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Vision/src/V1/BoundingPoly.php#L66-L72 | train |
googleapis/google-cloud-php | Vision/src/V1/BoundingPoly.php | BoundingPoly.setNormalizedVertices | public function setNormalizedVertices($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\NormalizedVertex::class);
$this->normalized_vertices = $arr;
return $this;
} | php | public function setNormalizedVertices($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\NormalizedVertex::class);
$this->normalized_vertices = $arr;
return $this;
} | [
"public",
"function",
"setNormalizedVertices",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Vision",
"\\",
"V1",
"\\",
"NormalizedVertex",
"::",
"class",
")",
";",
"$",
"this",
"->",
"normalized_vertices",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | The bounding polygon normalized vertices.
Generated from protobuf field <code>repeated .google.cloud.vision.v1.NormalizedVertex normalized_vertices = 2;</code>
@param \Google\Cloud\Vision\V1\NormalizedVertex[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"The",
"bounding",
"polygon",
"normalized",
"vertices",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Vision/src/V1/BoundingPoly.php#L92-L98 | train |
googleapis/google-cloud-php | Vision/src/V1/FaceAnnotation.php | FaceAnnotation.setLandmarks | public function setLandmarks($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\FaceAnnotation\Landmark::class);
$this->landmarks = $arr;
return $this;
} | php | public function setLandmarks($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\FaceAnnotation\Landmark::class);
$this->landmarks = $arr;
return $this;
} | [
"public",
"function",
"setLandmarks",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Vision",
"\\",
"V1",
"\\",
"FaceAnnotation",
"\\",
"Landmark",
"::",
"class",
")",
";",
"$",
"this",
"->",
"landmarks",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | Detected face landmarks.
Generated from protobuf field <code>repeated .google.cloud.vision.v1.FaceAnnotation.Landmark landmarks = 3;</code>
@param \Google\Cloud\Vision\V1\FaceAnnotation\Landmark[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"Detected",
"face",
"landmarks",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Vision/src/V1/FaceAnnotation.php#L276-L282 | train |
googleapis/google-cloud-php | Vision/src/V1/FaceAnnotation.php | FaceAnnotation.setJoyLikelihood | public function setJoyLikelihood($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Likelihood::class);
$this->joy_likelihood = $var;
return $this;
} | php | public function setJoyLikelihood($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Likelihood::class);
$this->joy_likelihood = $var;
return $this;
} | [
"public",
"function",
"setJoyLikelihood",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Vision",
"\\",
"V1",
"\\",
"Likelihood",
"::",
"class",
")",
";",
"$",
"this",
"->",
"joy_likelihood",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Joy likelihood.
Generated from protobuf field <code>.google.cloud.vision.v1.Likelihood joy_likelihood = 9;</code>
@param int $var
@return $this | [
"Joy",
"likelihood",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Vision/src/V1/FaceAnnotation.php#L442-L448 | train |
googleapis/google-cloud-php | Vision/src/V1/FaceAnnotation.php | FaceAnnotation.setSorrowLikelihood | public function setSorrowLikelihood($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Likelihood::class);
$this->sorrow_likelihood = $var;
return $this;
} | php | public function setSorrowLikelihood($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Likelihood::class);
$this->sorrow_likelihood = $var;
return $this;
} | [
"public",
"function",
"setSorrowLikelihood",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Vision",
"\\",
"V1",
"\\",
"Likelihood",
"::",
"class",
")",
";",
"$",
"this",
"->",
"sorrow_likelihood",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Sorrow likelihood.
Generated from protobuf field <code>.google.cloud.vision.v1.Likelihood sorrow_likelihood = 10;</code>
@param int $var
@return $this | [
"Sorrow",
"likelihood",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Vision/src/V1/FaceAnnotation.php#L468-L474 | train |
googleapis/google-cloud-php | Vision/src/V1/FaceAnnotation.php | FaceAnnotation.setAngerLikelihood | public function setAngerLikelihood($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Likelihood::class);
$this->anger_likelihood = $var;
return $this;
} | php | public function setAngerLikelihood($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Likelihood::class);
$this->anger_likelihood = $var;
return $this;
} | [
"public",
"function",
"setAngerLikelihood",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Vision",
"\\",
"V1",
"\\",
"Likelihood",
"::",
"class",
")",
";",
"$",
"this",
"->",
"anger_likelihood",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Anger likelihood.
Generated from protobuf field <code>.google.cloud.vision.v1.Likelihood anger_likelihood = 11;</code>
@param int $var
@return $this | [
"Anger",
"likelihood",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Vision/src/V1/FaceAnnotation.php#L494-L500 | train |
googleapis/google-cloud-php | Vision/src/V1/FaceAnnotation.php | FaceAnnotation.setSurpriseLikelihood | public function setSurpriseLikelihood($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Likelihood::class);
$this->surprise_likelihood = $var;
return $this;
} | php | public function setSurpriseLikelihood($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Likelihood::class);
$this->surprise_likelihood = $var;
return $this;
} | [
"public",
"function",
"setSurpriseLikelihood",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Vision",
"\\",
"V1",
"\\",
"Likelihood",
"::",
"class",
")",
";",
"$",
"this",
"->",
"surprise_likelihood",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Surprise likelihood.
Generated from protobuf field <code>.google.cloud.vision.v1.Likelihood surprise_likelihood = 12;</code>
@param int $var
@return $this | [
"Surprise",
"likelihood",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Vision/src/V1/FaceAnnotation.php#L520-L526 | train |
googleapis/google-cloud-php | Vision/src/V1/FaceAnnotation.php | FaceAnnotation.setUnderExposedLikelihood | public function setUnderExposedLikelihood($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Likelihood::class);
$this->under_exposed_likelihood = $var;
return $this;
} | php | public function setUnderExposedLikelihood($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Likelihood::class);
$this->under_exposed_likelihood = $var;
return $this;
} | [
"public",
"function",
"setUnderExposedLikelihood",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Vision",
"\\",
"V1",
"\\",
"Likelihood",
"::",
"class",
")",
";",
"$",
"this",
"->",
"under_exposed_likelihood",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Under-exposed likelihood.
Generated from protobuf field <code>.google.cloud.vision.v1.Likelihood under_exposed_likelihood = 13;</code>
@param int $var
@return $this | [
"Under",
"-",
"exposed",
"likelihood",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Vision/src/V1/FaceAnnotation.php#L546-L552 | train |
googleapis/google-cloud-php | Vision/src/V1/FaceAnnotation.php | FaceAnnotation.setBlurredLikelihood | public function setBlurredLikelihood($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Likelihood::class);
$this->blurred_likelihood = $var;
return $this;
} | php | public function setBlurredLikelihood($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Likelihood::class);
$this->blurred_likelihood = $var;
return $this;
} | [
"public",
"function",
"setBlurredLikelihood",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Vision",
"\\",
"V1",
"\\",
"Likelihood",
"::",
"class",
")",
";",
"$",
"this",
"->",
"blurred_likelihood",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Blurred likelihood.
Generated from protobuf field <code>.google.cloud.vision.v1.Likelihood blurred_likelihood = 14;</code>
@param int $var
@return $this | [
"Blurred",
"likelihood",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Vision/src/V1/FaceAnnotation.php#L572-L578 | train |
googleapis/google-cloud-php | Vision/src/V1/FaceAnnotation.php | FaceAnnotation.setHeadwearLikelihood | public function setHeadwearLikelihood($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Likelihood::class);
$this->headwear_likelihood = $var;
return $this;
} | php | public function setHeadwearLikelihood($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Likelihood::class);
$this->headwear_likelihood = $var;
return $this;
} | [
"public",
"function",
"setHeadwearLikelihood",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Vision",
"\\",
"V1",
"\\",
"Likelihood",
"::",
"class",
")",
";",
"$",
"this",
"->",
"headwear_likelihood",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Headwear likelihood.
Generated from protobuf field <code>.google.cloud.vision.v1.Likelihood headwear_likelihood = 15;</code>
@param int $var
@return $this | [
"Headwear",
"likelihood",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Vision/src/V1/FaceAnnotation.php#L598-L604 | train |
googleapis/google-cloud-php | Asset/src/V1/BatchGetAssetsHistoryResponse.php | BatchGetAssetsHistoryResponse.setAssets | public function setAssets($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Asset\V1\TemporalAsset::class);
$this->assets = $arr;
return $this;
} | php | public function setAssets($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Asset\V1\TemporalAsset::class);
$this->assets = $arr;
return $this;
} | [
"public",
"function",
"setAssets",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Asset",
"\\",
"V1",
"\\",
"TemporalAsset",
"::",
"class",
")",
";",
"$",
"this",
"->",
"assets",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | A list of assets with valid time windows.
Generated from protobuf field <code>repeated .google.cloud.asset.v1.TemporalAsset assets = 1;</code>
@param \Google\Cloud\Asset\V1\TemporalAsset[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"A",
"list",
"of",
"assets",
"with",
"valid",
"time",
"windows",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Asset/src/V1/BatchGetAssetsHistoryResponse.php#L58-L64 | train |
googleapis/google-cloud-php | Spanner/src/Result.php | Result.rows | public function rows($format = self::RETURN_ASSOCIATIVE)
{
$bufferedResults = [];
$call = $this->call;
$generator = null;
$shouldRetry = false;
$backoff = new ExponentialBackoff($this->retries, function ($ex) {
if ($ex instanceof ServiceException) {
return $ex->getCode() === Grpc\STATUS_UNAVAILABLE;
}
return false;
});
$valid = $backoff->execute(function () use ($call, &$generator) {
$generator = $call();
return $generator->valid();
});
while ($valid) {
try {
$result = $generator->current();
$bufferedResults[] = $result;
$this->setResultData($result, $format);
$empty = false;
if (!isset($result['values']) || $this->columnCount === 0) {
$empty = true;
}
$hasResumeToken = $this->isSetAndTrue($result, 'resumeToken');
if ($hasResumeToken || count($bufferedResults) >= self::BUFFER_RESULT_LIMIT) {
$chunkedResult = null;
if (!$empty) {
list($yieldableRows, $chunkedResult) = $this->parseRowsFromBufferedResults($bufferedResults);
foreach ($yieldableRows as $row) {
yield $this->mapper->decodeValues($this->columns, $row, $format);
}
}
// Now that we've yielded all available rows, flush the buffer.
$bufferedResults = [];
$shouldRetry = $hasResumeToken;
// If the last item in the buffer had a chunked value let's
// hold on to it so we can stitch it together into a yieldable
// result.
if ($chunkedResult) {
$bufferedResults[] = $chunkedResult;
}
}
$generator->next();
$valid = $generator->valid();
} catch (ServiceException $ex) {
if ($shouldRetry && $ex->getCode() === Grpc\STATUS_UNAVAILABLE) {
// Attempt to resume using our last stored resume token. If we
// successfully resume, flush the buffer.
$generator = $backoff->execute($call, [$this->resumeToken]);
$bufferedResults = [];
continue;
}
throw $ex;
}
}
// If there are any results remaining in the buffer, yield them.
if ($bufferedResults) {
list($yieldableRows, $chunkedResult) = $this->parseRowsFromBufferedResults($bufferedResults);
foreach ($yieldableRows as $row) {
yield $this->mapper->decodeValues($this->columns, $row, $format);
}
}
} | php | public function rows($format = self::RETURN_ASSOCIATIVE)
{
$bufferedResults = [];
$call = $this->call;
$generator = null;
$shouldRetry = false;
$backoff = new ExponentialBackoff($this->retries, function ($ex) {
if ($ex instanceof ServiceException) {
return $ex->getCode() === Grpc\STATUS_UNAVAILABLE;
}
return false;
});
$valid = $backoff->execute(function () use ($call, &$generator) {
$generator = $call();
return $generator->valid();
});
while ($valid) {
try {
$result = $generator->current();
$bufferedResults[] = $result;
$this->setResultData($result, $format);
$empty = false;
if (!isset($result['values']) || $this->columnCount === 0) {
$empty = true;
}
$hasResumeToken = $this->isSetAndTrue($result, 'resumeToken');
if ($hasResumeToken || count($bufferedResults) >= self::BUFFER_RESULT_LIMIT) {
$chunkedResult = null;
if (!$empty) {
list($yieldableRows, $chunkedResult) = $this->parseRowsFromBufferedResults($bufferedResults);
foreach ($yieldableRows as $row) {
yield $this->mapper->decodeValues($this->columns, $row, $format);
}
}
// Now that we've yielded all available rows, flush the buffer.
$bufferedResults = [];
$shouldRetry = $hasResumeToken;
// If the last item in the buffer had a chunked value let's
// hold on to it so we can stitch it together into a yieldable
// result.
if ($chunkedResult) {
$bufferedResults[] = $chunkedResult;
}
}
$generator->next();
$valid = $generator->valid();
} catch (ServiceException $ex) {
if ($shouldRetry && $ex->getCode() === Grpc\STATUS_UNAVAILABLE) {
// Attempt to resume using our last stored resume token. If we
// successfully resume, flush the buffer.
$generator = $backoff->execute($call, [$this->resumeToken]);
$bufferedResults = [];
continue;
}
throw $ex;
}
}
// If there are any results remaining in the buffer, yield them.
if ($bufferedResults) {
list($yieldableRows, $chunkedResult) = $this->parseRowsFromBufferedResults($bufferedResults);
foreach ($yieldableRows as $row) {
yield $this->mapper->decodeValues($this->columns, $row, $format);
}
}
} | [
"public",
"function",
"rows",
"(",
"$",
"format",
"=",
"self",
"::",
"RETURN_ASSOCIATIVE",
")",
"{",
"$",
"bufferedResults",
"=",
"[",
"]",
";",
"$",
"call",
"=",
"$",
"this",
"->",
"call",
";",
"$",
"generator",
"=",
"null",
";",
"$",
"shouldRetry",
"=",
"false",
";",
"$",
"backoff",
"=",
"new",
"ExponentialBackoff",
"(",
"$",
"this",
"->",
"retries",
",",
"function",
"(",
"$",
"ex",
")",
"{",
"if",
"(",
"$",
"ex",
"instanceof",
"ServiceException",
")",
"{",
"return",
"$",
"ex",
"->",
"getCode",
"(",
")",
"===",
"Grpc",
"\\",
"STATUS_UNAVAILABLE",
";",
"}",
"return",
"false",
";",
"}",
")",
";",
"$",
"valid",
"=",
"$",
"backoff",
"->",
"execute",
"(",
"function",
"(",
")",
"use",
"(",
"$",
"call",
",",
"&",
"$",
"generator",
")",
"{",
"$",
"generator",
"=",
"$",
"call",
"(",
")",
";",
"return",
"$",
"generator",
"->",
"valid",
"(",
")",
";",
"}",
")",
";",
"while",
"(",
"$",
"valid",
")",
"{",
"try",
"{",
"$",
"result",
"=",
"$",
"generator",
"->",
"current",
"(",
")",
";",
"$",
"bufferedResults",
"[",
"]",
"=",
"$",
"result",
";",
"$",
"this",
"->",
"setResultData",
"(",
"$",
"result",
",",
"$",
"format",
")",
";",
"$",
"empty",
"=",
"false",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"result",
"[",
"'values'",
"]",
")",
"||",
"$",
"this",
"->",
"columnCount",
"===",
"0",
")",
"{",
"$",
"empty",
"=",
"true",
";",
"}",
"$",
"hasResumeToken",
"=",
"$",
"this",
"->",
"isSetAndTrue",
"(",
"$",
"result",
",",
"'resumeToken'",
")",
";",
"if",
"(",
"$",
"hasResumeToken",
"||",
"count",
"(",
"$",
"bufferedResults",
")",
">=",
"self",
"::",
"BUFFER_RESULT_LIMIT",
")",
"{",
"$",
"chunkedResult",
"=",
"null",
";",
"if",
"(",
"!",
"$",
"empty",
")",
"{",
"list",
"(",
"$",
"yieldableRows",
",",
"$",
"chunkedResult",
")",
"=",
"$",
"this",
"->",
"parseRowsFromBufferedResults",
"(",
"$",
"bufferedResults",
")",
";",
"foreach",
"(",
"$",
"yieldableRows",
"as",
"$",
"row",
")",
"{",
"yield",
"$",
"this",
"->",
"mapper",
"->",
"decodeValues",
"(",
"$",
"this",
"->",
"columns",
",",
"$",
"row",
",",
"$",
"format",
")",
";",
"}",
"}",
"// Now that we've yielded all available rows, flush the buffer.",
"$",
"bufferedResults",
"=",
"[",
"]",
";",
"$",
"shouldRetry",
"=",
"$",
"hasResumeToken",
";",
"// If the last item in the buffer had a chunked value let's",
"// hold on to it so we can stitch it together into a yieldable",
"// result.",
"if",
"(",
"$",
"chunkedResult",
")",
"{",
"$",
"bufferedResults",
"[",
"]",
"=",
"$",
"chunkedResult",
";",
"}",
"}",
"$",
"generator",
"->",
"next",
"(",
")",
";",
"$",
"valid",
"=",
"$",
"generator",
"->",
"valid",
"(",
")",
";",
"}",
"catch",
"(",
"ServiceException",
"$",
"ex",
")",
"{",
"if",
"(",
"$",
"shouldRetry",
"&&",
"$",
"ex",
"->",
"getCode",
"(",
")",
"===",
"Grpc",
"\\",
"STATUS_UNAVAILABLE",
")",
"{",
"// Attempt to resume using our last stored resume token. If we",
"// successfully resume, flush the buffer.",
"$",
"generator",
"=",
"$",
"backoff",
"->",
"execute",
"(",
"$",
"call",
",",
"[",
"$",
"this",
"->",
"resumeToken",
"]",
")",
";",
"$",
"bufferedResults",
"=",
"[",
"]",
";",
"continue",
";",
"}",
"throw",
"$",
"ex",
";",
"}",
"}",
"// If there are any results remaining in the buffer, yield them.",
"if",
"(",
"$",
"bufferedResults",
")",
"{",
"list",
"(",
"$",
"yieldableRows",
",",
"$",
"chunkedResult",
")",
"=",
"$",
"this",
"->",
"parseRowsFromBufferedResults",
"(",
"$",
"bufferedResults",
")",
";",
"foreach",
"(",
"$",
"yieldableRows",
"as",
"$",
"row",
")",
"{",
"yield",
"$",
"this",
"->",
"mapper",
"->",
"decodeValues",
"(",
"$",
"this",
"->",
"columns",
",",
"$",
"row",
",",
"$",
"format",
")",
";",
"}",
"}",
"}"
] | Return the formatted and decoded rows. If the stream is interrupted and
a resume token is available, attempts will be made on your behalf to
resume.
Example:
```
$rows = $result->rows();
```
@param string $format Determines the format in which rows are returned.
`Result::RETURN_NAME_VALUE_PAIR` returns items as a
multi-dimensional array containing a name and a value key.
Ex: `[0 => ['name' => 'column1', 'value' => 'my_value']]`.
`Result::RETURN_ASSOCIATIVE` returns items as an associative array
with the column name as the key. Please note with this option, if
duplicate column names are present a `\RuntimeException` will be
thrown. `Result::RETURN_ZERO_INDEXED` returns items as a 0 indexed
array, with the key representing the column number as found by
executing {@see Google\Cloud\Spanner\Result::columns()}. Ex:
`[0 => 'my_value']`. **Defaults to** `Result::RETURN_ASSOCIATIVE`.
@return \Generator
@throws \InvalidArgumentException When an invalid format is provided.
@throws \RuntimeException When duplicate column names exist with a
selected format of `Result::RETURN_ASSOCIATIVE`. | [
"Return",
"the",
"formatted",
"and",
"decoded",
"rows",
".",
"If",
"the",
"stream",
"is",
"interrupted",
"and",
"a",
"resume",
"token",
"is",
"available",
"attempts",
"will",
"be",
"made",
"on",
"your",
"behalf",
"to",
"resume",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Result.php#L175-L252 | train |
googleapis/google-cloud-php | Spanner/src/Result.php | Result.mergeValues | private function mergeValues(array $set1, array $set2)
{
// `$set2` may be empty if an array value is chunked at the end of the
// list. Handling it normally results in an additional `null` value
// being pushed onto the list of values. Since this method is only
// called in cases where two chunks must be merged, we can safely
// short-circuit the operation of the second chunk is empty.
if (empty($set2)) {
return $set1;
}
$lastItemSet1 = array_pop($set1);
$firstItemSet2 = array_shift($set2);
$item = $firstItemSet2;
if (is_string($lastItemSet1) && is_string($firstItemSet2)) {
$item = $lastItemSet1 . $firstItemSet2;
} elseif (is_array($lastItemSet1)) {
$item = $this->mergeValues($lastItemSet1, $firstItemSet2);
} else {
array_push($set1, $lastItemSet1);
}
array_push($set1, $item);
return array_merge($set1, $set2);
} | php | private function mergeValues(array $set1, array $set2)
{
// `$set2` may be empty if an array value is chunked at the end of the
// list. Handling it normally results in an additional `null` value
// being pushed onto the list of values. Since this method is only
// called in cases where two chunks must be merged, we can safely
// short-circuit the operation of the second chunk is empty.
if (empty($set2)) {
return $set1;
}
$lastItemSet1 = array_pop($set1);
$firstItemSet2 = array_shift($set2);
$item = $firstItemSet2;
if (is_string($lastItemSet1) && is_string($firstItemSet2)) {
$item = $lastItemSet1 . $firstItemSet2;
} elseif (is_array($lastItemSet1)) {
$item = $this->mergeValues($lastItemSet1, $firstItemSet2);
} else {
array_push($set1, $lastItemSet1);
}
array_push($set1, $item);
return array_merge($set1, $set2);
} | [
"private",
"function",
"mergeValues",
"(",
"array",
"$",
"set1",
",",
"array",
"$",
"set2",
")",
"{",
"// `$set2` may be empty if an array value is chunked at the end of the",
"// list. Handling it normally results in an additional `null` value",
"// being pushed onto the list of values. Since this method is only",
"// called in cases where two chunks must be merged, we can safely",
"// short-circuit the operation of the second chunk is empty.",
"if",
"(",
"empty",
"(",
"$",
"set2",
")",
")",
"{",
"return",
"$",
"set1",
";",
"}",
"$",
"lastItemSet1",
"=",
"array_pop",
"(",
"$",
"set1",
")",
";",
"$",
"firstItemSet2",
"=",
"array_shift",
"(",
"$",
"set2",
")",
";",
"$",
"item",
"=",
"$",
"firstItemSet2",
";",
"if",
"(",
"is_string",
"(",
"$",
"lastItemSet1",
")",
"&&",
"is_string",
"(",
"$",
"firstItemSet2",
")",
")",
"{",
"$",
"item",
"=",
"$",
"lastItemSet1",
".",
"$",
"firstItemSet2",
";",
"}",
"elseif",
"(",
"is_array",
"(",
"$",
"lastItemSet1",
")",
")",
"{",
"$",
"item",
"=",
"$",
"this",
"->",
"mergeValues",
"(",
"$",
"lastItemSet1",
",",
"$",
"firstItemSet2",
")",
";",
"}",
"else",
"{",
"array_push",
"(",
"$",
"set1",
",",
"$",
"lastItemSet1",
")",
";",
"}",
"array_push",
"(",
"$",
"set1",
",",
"$",
"item",
")",
";",
"return",
"array_merge",
"(",
"$",
"set1",
",",
"$",
"set2",
")",
";",
"}"
] | Merge result set values together.
@param array $set1
@param array $set2
@return array | [
"Merge",
"result",
"set",
"values",
"together",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Result.php#L490-L515 | train |
googleapis/google-cloud-php | CommonProtos/src/DevTools/Source/V1/AliasContext.php | AliasContext.setKind | public function setKind($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\DevTools\Source\V1\AliasContext_Kind::class);
$this->kind = $var;
return $this;
} | php | public function setKind($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\DevTools\Source\V1\AliasContext_Kind::class);
$this->kind = $var;
return $this;
} | [
"public",
"function",
"setKind",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"DevTools",
"\\",
"Source",
"\\",
"V1",
"\\",
"AliasContext_Kind",
"::",
"class",
")",
";",
"$",
"this",
"->",
"kind",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | The alias kind.
Generated from protobuf field <code>.google.devtools.source.v1.AliasContext.Kind kind = 1;</code>
@param int $var
@return $this | [
"The",
"alias",
"kind",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/CommonProtos/src/DevTools/Source/V1/AliasContext.php#L66-L72 | train |
googleapis/google-cloud-php | Dialogflow/src/V2/EntityType.php | EntityType.setKind | public function setKind($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\V2\EntityType_Kind::class);
$this->kind = $var;
return $this;
} | php | public function setKind($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\V2\EntityType_Kind::class);
$this->kind = $var;
return $this;
} | [
"public",
"function",
"setKind",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dialogflow",
"\\",
"V2",
"\\",
"EntityType_Kind",
"::",
"class",
")",
";",
"$",
"this",
"->",
"kind",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Required. Indicates the kind of entity type.
Generated from protobuf field <code>.google.cloud.dialogflow.v2.EntityType.Kind kind = 3;</code>
@param int $var
@return $this | [
"Required",
".",
"Indicates",
"the",
"kind",
"of",
"entity",
"type",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dialogflow/src/V2/EntityType.php#L158-L164 | train |
googleapis/google-cloud-php | Dialogflow/src/V2/EntityType.php | EntityType.setAutoExpansionMode | public function setAutoExpansionMode($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\V2\EntityType_AutoExpansionMode::class);
$this->auto_expansion_mode = $var;
return $this;
} | php | public function setAutoExpansionMode($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\V2\EntityType_AutoExpansionMode::class);
$this->auto_expansion_mode = $var;
return $this;
} | [
"public",
"function",
"setAutoExpansionMode",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dialogflow",
"\\",
"V2",
"\\",
"EntityType_AutoExpansionMode",
"::",
"class",
")",
";",
"$",
"this",
"->",
"auto_expansion_mode",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Optional. Indicates whether the entity type can be automatically
expanded.
Generated from protobuf field <code>.google.cloud.dialogflow.v2.EntityType.AutoExpansionMode auto_expansion_mode = 4;</code>
@param int $var
@return $this | [
"Optional",
".",
"Indicates",
"whether",
"the",
"entity",
"type",
"can",
"be",
"automatically",
"expanded",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dialogflow/src/V2/EntityType.php#L186-L192 | train |
googleapis/google-cloud-php | Spanner/src/Admin/Instance/V1/ListInstanceConfigsResponse.php | ListInstanceConfigsResponse.setInstanceConfigs | public function setInstanceConfigs($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig::class);
$this->instance_configs = $arr;
return $this;
} | php | public function setInstanceConfigs($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig::class);
$this->instance_configs = $arr;
return $this;
} | [
"public",
"function",
"setInstanceConfigs",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Spanner",
"\\",
"Admin",
"\\",
"Instance",
"\\",
"V1",
"\\",
"InstanceConfig",
"::",
"class",
")",
";",
"$",
"this",
"->",
"instance_configs",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | The list of requested instance configurations.
Generated from protobuf field <code>repeated .google.spanner.admin.instance.v1.InstanceConfig instance_configs = 1;</code>
@param \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"The",
"list",
"of",
"requested",
"instance",
"configurations",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Admin/Instance/V1/ListInstanceConfigsResponse.php#L71-L77 | train |
googleapis/google-cloud-php | Logging/src/V2/ListExclusionsResponse.php | ListExclusionsResponse.setExclusions | public function setExclusions($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Logging\V2\LogExclusion::class);
$this->exclusions = $arr;
return $this;
} | php | public function setExclusions($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Logging\V2\LogExclusion::class);
$this->exclusions = $arr;
return $this;
} | [
"public",
"function",
"setExclusions",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Logging",
"\\",
"V2",
"\\",
"LogExclusion",
"::",
"class",
")",
";",
"$",
"this",
"->",
"exclusions",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | A list of exclusions.
Generated from protobuf field <code>repeated .google.logging.v2.LogExclusion exclusions = 1;</code>
@param \Google\Cloud\Logging\V2\LogExclusion[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"A",
"list",
"of",
"exclusions",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Logging/src/V2/ListExclusionsResponse.php#L70-L76 | train |
googleapis/google-cloud-php | PubSub/src/V1/ReceivedMessage.php | ReceivedMessage.setMessage | public function setMessage($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\PubsubMessage::class);
$this->message = $var;
return $this;
} | php | public function setMessage($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\PubsubMessage::class);
$this->message = $var;
return $this;
} | [
"public",
"function",
"setMessage",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"PubSub",
"\\",
"V1",
"\\",
"PubsubMessage",
"::",
"class",
")",
";",
"$",
"this",
"->",
"message",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | The message.
Generated from protobuf field <code>.google.pubsub.v1.PubsubMessage message = 2;</code>
@param \Google\Cloud\PubSub\V1\PubsubMessage $var
@return $this | [
"The",
"message",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/PubSub/src/V1/ReceivedMessage.php#L92-L98 | train |
googleapis/google-cloud-php | Vision/src/V1/ImportProductSetsResponse.php | ImportProductSetsResponse.setReferenceImages | public function setReferenceImages($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\ReferenceImage::class);
$this->reference_images = $arr;
return $this;
} | php | public function setReferenceImages($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\ReferenceImage::class);
$this->reference_images = $arr;
return $this;
} | [
"public",
"function",
"setReferenceImages",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Vision",
"\\",
"V1",
"\\",
"ReferenceImage",
"::",
"class",
")",
";",
"$",
"this",
"->",
"reference_images",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | The list of reference_images that are imported successfully.
Generated from protobuf field <code>repeated .google.cloud.vision.v1.ReferenceImage reference_images = 1;</code>
@param \Google\Cloud\Vision\V1\ReferenceImage[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"The",
"list",
"of",
"reference_images",
"that",
"are",
"imported",
"successfully",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Vision/src/V1/ImportProductSetsResponse.php#L79-L85 | train |
googleapis/google-cloud-php | Dlp/src/V2/InspectJobConfig.php | InspectJobConfig.setStorageConfig | public function setStorageConfig($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\StorageConfig::class);
$this->storage_config = $var;
return $this;
} | php | public function setStorageConfig($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\StorageConfig::class);
$this->storage_config = $var;
return $this;
} | [
"public",
"function",
"setStorageConfig",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dlp",
"\\",
"V2",
"\\",
"StorageConfig",
"::",
"class",
")",
";",
"$",
"this",
"->",
"storage_config",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | The data to scan.
Generated from protobuf field <code>.google.privacy.dlp.v2.StorageConfig storage_config = 1;</code>
@param \Google\Cloud\Dlp\V2\StorageConfig $var
@return $this | [
"The",
"data",
"to",
"scan",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/InspectJobConfig.php#L86-L92 | train |
googleapis/google-cloud-php | Dlp/src/V2/InspectJobConfig.php | InspectJobConfig.setInspectConfig | public function setInspectConfig($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\InspectConfig::class);
$this->inspect_config = $var;
return $this;
} | php | public function setInspectConfig($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\InspectConfig::class);
$this->inspect_config = $var;
return $this;
} | [
"public",
"function",
"setInspectConfig",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dlp",
"\\",
"V2",
"\\",
"InspectConfig",
"::",
"class",
")",
";",
"$",
"this",
"->",
"inspect_config",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | How and what to scan for.
Generated from protobuf field <code>.google.privacy.dlp.v2.InspectConfig inspect_config = 2;</code>
@param \Google\Cloud\Dlp\V2\InspectConfig $var
@return $this | [
"How",
"and",
"what",
"to",
"scan",
"for",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/InspectJobConfig.php#L112-L118 | train |
googleapis/google-cloud-php | Dlp/src/V2/InspectJobConfig.php | InspectJobConfig.setActions | public function setActions($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dlp\V2\Action::class);
$this->actions = $arr;
return $this;
} | php | public function setActions($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dlp\V2\Action::class);
$this->actions = $arr;
return $this;
} | [
"public",
"function",
"setActions",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dlp",
"\\",
"V2",
"\\",
"Action",
"::",
"class",
")",
";",
"$",
"this",
"->",
"actions",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | Actions to execute at the completion of the job. Are executed in the order
provided.
Generated from protobuf field <code>repeated .google.privacy.dlp.v2.Action actions = 4;</code>
@param \Google\Cloud\Dlp\V2\Action[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"Actions",
"to",
"execute",
"at",
"the",
"completion",
"of",
"the",
"job",
".",
"Are",
"executed",
"in",
"the",
"order",
"provided",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/InspectJobConfig.php#L170-L176 | train |
googleapis/google-cloud-php | Core/src/Batch/BatchRunner.php | BatchRunner.registerJob | public function registerJob($identifier, $func, array $options = [])
{
if ($func instanceof \Closure) {
throw new \InvalidArgumentException('Closure is not allowed');
}
// Always work on the latest data
$result = $this->configStorage->lock();
if ($result === false) {
return false;
}
$this->config = $this->configStorage->load();
$this->config->registerJob(
$identifier,
function ($id) use ($identifier, $func, $options) {
return new BatchJob($identifier, $func, $id, $options);
}
);
try {
$result = $this->configStorage->save($this->config);
} finally {
$this->configStorage->unlock();
}
return $result;
} | php | public function registerJob($identifier, $func, array $options = [])
{
if ($func instanceof \Closure) {
throw new \InvalidArgumentException('Closure is not allowed');
}
// Always work on the latest data
$result = $this->configStorage->lock();
if ($result === false) {
return false;
}
$this->config = $this->configStorage->load();
$this->config->registerJob(
$identifier,
function ($id) use ($identifier, $func, $options) {
return new BatchJob($identifier, $func, $id, $options);
}
);
try {
$result = $this->configStorage->save($this->config);
} finally {
$this->configStorage->unlock();
}
return $result;
} | [
"public",
"function",
"registerJob",
"(",
"$",
"identifier",
",",
"$",
"func",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"func",
"instanceof",
"\\",
"Closure",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Closure is not allowed'",
")",
";",
"}",
"// Always work on the latest data",
"$",
"result",
"=",
"$",
"this",
"->",
"configStorage",
"->",
"lock",
"(",
")",
";",
"if",
"(",
"$",
"result",
"===",
"false",
")",
"{",
"return",
"false",
";",
"}",
"$",
"this",
"->",
"config",
"=",
"$",
"this",
"->",
"configStorage",
"->",
"load",
"(",
")",
";",
"$",
"this",
"->",
"config",
"->",
"registerJob",
"(",
"$",
"identifier",
",",
"function",
"(",
"$",
"id",
")",
"use",
"(",
"$",
"identifier",
",",
"$",
"func",
",",
"$",
"options",
")",
"{",
"return",
"new",
"BatchJob",
"(",
"$",
"identifier",
",",
"$",
"func",
",",
"$",
"id",
",",
"$",
"options",
")",
";",
"}",
")",
";",
"try",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"configStorage",
"->",
"save",
"(",
"$",
"this",
"->",
"config",
")",
";",
"}",
"finally",
"{",
"$",
"this",
"->",
"configStorage",
"->",
"unlock",
"(",
")",
";",
"}",
"return",
"$",
"result",
";",
"}"
] | Register a job for batch execution.
@param string $identifier Unique identifier of the job.
@param callable $func Any Callable except for Closure. The callable
should accept an array of items as the first argument.
@param array $options [optional] {
Configuration options.
@type int $batchSize The size of the batch.
@type float $callPeriod The period in seconds from the last execution
to force executing the job.
@type int $numWorkers The number of child processes. It only takes
effect with the {@see \Google\Cloud\Core\Batch\BatchDaemon}.
@type string $bootstrapFile A file to load before executing the
job. It's needed for registering global functions.
}
@return bool true on success, false on failure
@throws \InvalidArgumentException When receiving a Closure. | [
"Register",
"a",
"job",
"for",
"batch",
"execution",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Core/src/Batch/BatchRunner.php#L97-L121 | train |
googleapis/google-cloud-php | Core/src/Batch/BatchRunner.php | BatchRunner.submitItem | public function submitItem($identifier, $item)
{
$job = $this->getJobFromId($identifier);
if ($job === null) {
throw new \RuntimeException(
"The identifier does not exist: $identifier"
);
}
$idNum = $job->id();
return $this->processor->submit($item, $idNum);
} | php | public function submitItem($identifier, $item)
{
$job = $this->getJobFromId($identifier);
if ($job === null) {
throw new \RuntimeException(
"The identifier does not exist: $identifier"
);
}
$idNum = $job->id();
return $this->processor->submit($item, $idNum);
} | [
"public",
"function",
"submitItem",
"(",
"$",
"identifier",
",",
"$",
"item",
")",
"{",
"$",
"job",
"=",
"$",
"this",
"->",
"getJobFromId",
"(",
"$",
"identifier",
")",
";",
"if",
"(",
"$",
"job",
"===",
"null",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"\"The identifier does not exist: $identifier\"",
")",
";",
"}",
"$",
"idNum",
"=",
"$",
"job",
"->",
"id",
"(",
")",
";",
"return",
"$",
"this",
"->",
"processor",
"->",
"submit",
"(",
"$",
"item",
",",
"$",
"idNum",
")",
";",
"}"
] | Submit an item.
@param string $identifier Unique identifier of the job.
@param mixed $item It needs to be serializable.
@return bool true on success, false on failure
@throws \RuntimeException | [
"Submit",
"an",
"item",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Core/src/Batch/BatchRunner.php#L132-L142 | train |
googleapis/google-cloud-php | Core/src/Batch/BatchRunner.php | BatchRunner.loadConfig | public function loadConfig()
{
$result = $this->configStorage->lock();
if ($result === false) {
throw new \RuntimeException('Failed to lock the configStorage');
}
try {
$result = $this->configStorage->load();
} catch (\RuntimeException $e) {
$this->configStorage->clear();
throw $e;
} finally {
$this->configStorage->unlock();
}
$this->config = $result;
return true;
} | php | public function loadConfig()
{
$result = $this->configStorage->lock();
if ($result === false) {
throw new \RuntimeException('Failed to lock the configStorage');
}
try {
$result = $this->configStorage->load();
} catch (\RuntimeException $e) {
$this->configStorage->clear();
throw $e;
} finally {
$this->configStorage->unlock();
}
$this->config = $result;
return true;
} | [
"public",
"function",
"loadConfig",
"(",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"configStorage",
"->",
"lock",
"(",
")",
";",
"if",
"(",
"$",
"result",
"===",
"false",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'Failed to lock the configStorage'",
")",
";",
"}",
"try",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"configStorage",
"->",
"load",
"(",
")",
";",
"}",
"catch",
"(",
"\\",
"RuntimeException",
"$",
"e",
")",
"{",
"$",
"this",
"->",
"configStorage",
"->",
"clear",
"(",
")",
";",
"throw",
"$",
"e",
";",
"}",
"finally",
"{",
"$",
"this",
"->",
"configStorage",
"->",
"unlock",
"(",
")",
";",
"}",
"$",
"this",
"->",
"config",
"=",
"$",
"result",
";",
"return",
"true",
";",
"}"
] | Load the config from the storage.
@return bool true on success
@throws \RuntimeException when it fails to load the config. | [
"Load",
"the",
"config",
"from",
"the",
"storage",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Core/src/Batch/BatchRunner.php#L184-L201 | train |
googleapis/google-cloud-php | Speech/src/SpeechHelpersTrait.php | SpeechHelpersTrait.createAudioStreamFromResource | public function createAudioStreamFromResource($resource, $chunkSize = 32000)
{
while (!feof($resource)) {
$chunk = fread($resource, $chunkSize);
if (strlen($chunk) > 0) {
yield $chunk;
}
}
} | php | public function createAudioStreamFromResource($resource, $chunkSize = 32000)
{
while (!feof($resource)) {
$chunk = fread($resource, $chunkSize);
if (strlen($chunk) > 0) {
yield $chunk;
}
}
} | [
"public",
"function",
"createAudioStreamFromResource",
"(",
"$",
"resource",
",",
"$",
"chunkSize",
"=",
"32000",
")",
"{",
"while",
"(",
"!",
"feof",
"(",
"$",
"resource",
")",
")",
"{",
"$",
"chunk",
"=",
"fread",
"(",
"$",
"resource",
",",
"$",
"chunkSize",
")",
";",
"if",
"(",
"strlen",
"(",
"$",
"chunk",
")",
">",
"0",
")",
"{",
"yield",
"$",
"chunk",
";",
"}",
"}",
"}"
] | Convert a PHP resource instance into an iterable of data "chunks".
@param resource $resource The resource object to read data from.
@param int $chunkSize The chunk size to use, in bytes. Defaults to 32000
@return \Generator<string> An iterable of strings that have been read from the resource. | [
"Convert",
"a",
"PHP",
"resource",
"instance",
"into",
"an",
"iterable",
"of",
"data",
"chunks",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Speech/src/SpeechHelpersTrait.php#L107-L115 | train |
googleapis/google-cloud-php | Dlp/src/V2/RedactImageRequest/ImageRedactionConfig.php | ImageRedactionConfig.setInfoType | public function setInfoType($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\InfoType::class);
$this->writeOneof(1, $var);
return $this;
} | php | public function setInfoType($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\InfoType::class);
$this->writeOneof(1, $var);
return $this;
} | [
"public",
"function",
"setInfoType",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dlp",
"\\",
"V2",
"\\",
"InfoType",
"::",
"class",
")",
";",
"$",
"this",
"->",
"writeOneof",
"(",
"1",
",",
"$",
"var",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Only one per info_type should be provided per request. If not
specified, and redact_all_text is false, the DLP API will redact all
text that it matches against all info_types that are found, but not
specified in another ImageRedactionConfig.
Generated from protobuf field <code>.google.privacy.dlp.v2.InfoType info_type = 1;</code>
@param \Google\Cloud\Dlp\V2\InfoType $var
@return $this | [
"Only",
"one",
"per",
"info_type",
"should",
"be",
"provided",
"per",
"request",
".",
"If",
"not",
"specified",
"and",
"redact_all_text",
"is",
"false",
"the",
"DLP",
"API",
"will",
"redact",
"all",
"text",
"that",
"it",
"matches",
"against",
"all",
"info_types",
"that",
"are",
"found",
"but",
"not",
"specified",
"in",
"another",
"ImageRedactionConfig",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/RedactImageRequest/ImageRedactionConfig.php#L75-L81 | train |
googleapis/google-cloud-php | Dlp/src/V2/RedactImageRequest/ImageRedactionConfig.php | ImageRedactionConfig.setRedactionColor | public function setRedactionColor($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\Color::class);
$this->redaction_color = $var;
return $this;
} | php | public function setRedactionColor($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\Color::class);
$this->redaction_color = $var;
return $this;
} | [
"public",
"function",
"setRedactionColor",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dlp",
"\\",
"V2",
"\\",
"Color",
"::",
"class",
")",
";",
"$",
"this",
"->",
"redaction_color",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | The color to use when redacting content from an image. If not specified,
the default is black.
Generated from protobuf field <code>.google.privacy.dlp.v2.Color redaction_color = 3;</code>
@param \Google\Cloud\Dlp\V2\Color $var
@return $this | [
"The",
"color",
"to",
"use",
"when",
"redacting",
"content",
"from",
"an",
"image",
".",
"If",
"not",
"specified",
"the",
"default",
"is",
"black",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/RedactImageRequest/ImageRedactionConfig.php#L131-L137 | train |
googleapis/google-cloud-php | Debugger/src/Debuggee.php | Debuggee.register | public function register(array $options = [])
{
$resp = $this->connection->registerDebuggee(['debuggee' => $this->info()] + $options);
if (array_key_exists('debuggee', $resp)) {
$this->id = $resp['debuggee']['id'];
return true;
}
return false;
} | php | public function register(array $options = [])
{
$resp = $this->connection->registerDebuggee(['debuggee' => $this->info()] + $options);
if (array_key_exists('debuggee', $resp)) {
$this->id = $resp['debuggee']['id'];
return true;
}
return false;
} | [
"public",
"function",
"register",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"resp",
"=",
"$",
"this",
"->",
"connection",
"->",
"registerDebuggee",
"(",
"[",
"'debuggee'",
"=>",
"$",
"this",
"->",
"info",
"(",
")",
"]",
"+",
"$",
"options",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"'debuggee'",
",",
"$",
"resp",
")",
")",
"{",
"$",
"this",
"->",
"id",
"=",
"$",
"resp",
"[",
"'debuggee'",
"]",
"[",
"'id'",
"]",
";",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | Register this debuggee with the Stackdriver backend.
Example:
```
$debuggee->register();
echo $debuggee->id();
```
@codingStandardsIgnoreStart
@see https://cloud.google.com/debugger/api/reference/rest/v2/controller.debuggees/register Debuggee register API documentation.
@codingStandardsIgnoreEnd
@param array $options
@return bool | [
"Register",
"this",
"debuggee",
"with",
"the",
"Stackdriver",
"backend",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Debugger/src/Debuggee.php#L197-L205 | train |
googleapis/google-cloud-php | Debugger/src/Debuggee.php | Debuggee.breakpointsWithWaitToken | public function breakpointsWithWaitToken(array $options = [])
{
$ret = $this->connection->listBreakpoints(['debuggeeId' => $this->id] + $options);
if (array_key_exists('breakpoints', $ret)) {
$ret['breakpoints'] = array_map(function ($breakpointData) {
return new Breakpoint($breakpointData);
}, $ret['breakpoints']);
} else {
$ret['breakpoints'] = [];
}
return $ret;
} | php | public function breakpointsWithWaitToken(array $options = [])
{
$ret = $this->connection->listBreakpoints(['debuggeeId' => $this->id] + $options);
if (array_key_exists('breakpoints', $ret)) {
$ret['breakpoints'] = array_map(function ($breakpointData) {
return new Breakpoint($breakpointData);
}, $ret['breakpoints']);
} else {
$ret['breakpoints'] = [];
}
return $ret;
} | [
"public",
"function",
"breakpointsWithWaitToken",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"ret",
"=",
"$",
"this",
"->",
"connection",
"->",
"listBreakpoints",
"(",
"[",
"'debuggeeId'",
"=>",
"$",
"this",
"->",
"id",
"]",
"+",
"$",
"options",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"'breakpoints'",
",",
"$",
"ret",
")",
")",
"{",
"$",
"ret",
"[",
"'breakpoints'",
"]",
"=",
"array_map",
"(",
"function",
"(",
"$",
"breakpointData",
")",
"{",
"return",
"new",
"Breakpoint",
"(",
"$",
"breakpointData",
")",
";",
"}",
",",
"$",
"ret",
"[",
"'breakpoints'",
"]",
")",
";",
"}",
"else",
"{",
"$",
"ret",
"[",
"'breakpoints'",
"]",
"=",
"[",
"]",
";",
"}",
"return",
"$",
"ret",
";",
"}"
] | Fetch the list of breakpoints this debugee should try to handle and a
wait token for the next request. The return value is an associative array
with keys of breakpoints and nextWaitToken.
Example:
```
$resp = $debuggee->breakpointsWithWaitToken();
$nextWaitToken = $resp['nextWaitToken'];
$breakpoints = $resp['breakpoints'];
```
@codingStandardsIgnoreStart
@see https://cloud.google.com/debugger/api/reference/rest/v2/controller.debuggees.breakpoints/list Breakpoints list API documentation.
@codingStandardsIgnoreEnd
@param array $options [optional] {
Configuration options.
@type string $waitToken A wait token that, if specified, blocks the
method call until the list of active breakpoints has changed,
or a server selected timeout has expired. The value should be
set from the last returned response.
}
@return array | [
"Fetch",
"the",
"list",
"of",
"breakpoints",
"this",
"debugee",
"should",
"try",
"to",
"handle",
"and",
"a",
"wait",
"token",
"for",
"the",
"next",
"request",
".",
"The",
"return",
"value",
"is",
"an",
"associative",
"array",
"with",
"keys",
"of",
"breakpoints",
"and",
"nextWaitToken",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Debugger/src/Debuggee.php#L261-L273 | train |
googleapis/google-cloud-php | Debugger/src/Debuggee.php | Debuggee.updateBreakpoint | public function updateBreakpoint(Breakpoint $breakpoint, array $options = [])
{
$this->connection->updateBreakpoint([
'debuggeeId' => $this->id,
'id' => $breakpoint->id(),
'breakpoint' => $breakpoint->info()
] + $options);
} | php | public function updateBreakpoint(Breakpoint $breakpoint, array $options = [])
{
$this->connection->updateBreakpoint([
'debuggeeId' => $this->id,
'id' => $breakpoint->id(),
'breakpoint' => $breakpoint->info()
] + $options);
} | [
"public",
"function",
"updateBreakpoint",
"(",
"Breakpoint",
"$",
"breakpoint",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"connection",
"->",
"updateBreakpoint",
"(",
"[",
"'debuggeeId'",
"=>",
"$",
"this",
"->",
"id",
",",
"'id'",
"=>",
"$",
"breakpoint",
"->",
"id",
"(",
")",
",",
"'breakpoint'",
"=>",
"$",
"breakpoint",
"->",
"info",
"(",
")",
"]",
"+",
"$",
"options",
")",
";",
"}"
] | Update the provided, modified breakpoint.
Example:
```
$debuggee->updateBreakpoint($breakpoint);
```
@codingStandardsIgnoreStart
@see https://cloud.google.com/debugger/api/reference/rest/v2/controller.debuggees.breakpoints/update Breakpoint update API documentation.
@codingStandardsIgnoreEnd
@param Breakpoint $breakpoint The modified breakpoint.
@param array $options [optional] Configuration options. See
{@see Google\Cloud\Core\RequestWrapper::__construct()} for
configuration options which apply to all network requests.
@return void
@throws ServiceException | [
"Update",
"the",
"provided",
"modified",
"breakpoint",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Debugger/src/Debuggee.php#L294-L301 | train |
googleapis/google-cloud-php | Debugger/src/Debuggee.php | Debuggee.setBreakpoint | public function setBreakpoint($path, $line, array $options = [])
{
$resp = $this->connection->setBreakpoint([
'debuggeeId' => $this->id,
'location' => [
'path' => $path,
'line' => $line
]
] + $options);
return new Breakpoint($resp['breakpoint']);
} | php | public function setBreakpoint($path, $line, array $options = [])
{
$resp = $this->connection->setBreakpoint([
'debuggeeId' => $this->id,
'location' => [
'path' => $path,
'line' => $line
]
] + $options);
return new Breakpoint($resp['breakpoint']);
} | [
"public",
"function",
"setBreakpoint",
"(",
"$",
"path",
",",
"$",
"line",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"resp",
"=",
"$",
"this",
"->",
"connection",
"->",
"setBreakpoint",
"(",
"[",
"'debuggeeId'",
"=>",
"$",
"this",
"->",
"id",
",",
"'location'",
"=>",
"[",
"'path'",
"=>",
"$",
"path",
",",
"'line'",
"=>",
"$",
"line",
"]",
"]",
"+",
"$",
"options",
")",
";",
"return",
"new",
"Breakpoint",
"(",
"$",
"resp",
"[",
"'breakpoint'",
"]",
")",
";",
"}"
] | Set a breakpoint for this debuggee.
Example:
```
$breakpoint = $debuggee->setBreakpoint('DebuggerClient.php', 10);
```
@codingStandardsIgnoreStart
@see https://cloud.google.com/debugger/api/reference/rest/v2/debugger.debuggees.breakpoints/set Breakpoint set API documentation.
@codingStandardsIgnoreEnd
@param string $path Path to the source file.
@param int $line Line within the source file.
@param array $options [optional] Array of Breakpoint constructor arguments. See
{@see Google\Cloud\Debugger\Breakpoint::__construct()} for
configuration details. See
{@see Google\Cloud\Core\RequestWrapper::__construct()} for
configuration options which apply to all network requests. | [
"Set",
"a",
"breakpoint",
"for",
"this",
"debuggee",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Debugger/src/Debuggee.php#L323-L333 | train |
googleapis/google-cloud-php | Debugger/src/Debuggee.php | Debuggee.updateBreakpointBatch | public function updateBreakpointBatch(array $breakpoints, array $options = [])
{
foreach ($breakpoints as $breakpoint) {
$this->updateBreakpoint($breakpoint, $options);
}
} | php | public function updateBreakpointBatch(array $breakpoints, array $options = [])
{
foreach ($breakpoints as $breakpoint) {
$this->updateBreakpoint($breakpoint, $options);
}
} | [
"public",
"function",
"updateBreakpointBatch",
"(",
"array",
"$",
"breakpoints",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"foreach",
"(",
"$",
"breakpoints",
"as",
"$",
"breakpoint",
")",
"{",
"$",
"this",
"->",
"updateBreakpoint",
"(",
"$",
"breakpoint",
",",
"$",
"options",
")",
";",
"}",
"}"
] | Update multiple breakpoints.
Example:
```
$debuggee->updateBreakpointBatch([$breakpoint1, $breakpoint2]);
```
@codingStandardsIgnoreStart
@see https://cloud.google.com/debugger/api/reference/rest/v2/controller.debuggees.breakpoints/update Breakpoint update API documentation.
@codingStandardsIgnoreEnd
@param Breakpoint[] $breakpoints The modified breakpoints.
@param array $options [optional] Configuration options. See
{@see Google\Cloud\Core\RequestWrapper::__construct()} for
configuration options which apply to all network requests.
@return void
@throws ServiceException | [
"Update",
"multiple",
"breakpoints",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Debugger/src/Debuggee.php#L354-L359 | train |
googleapis/google-cloud-php | Core/src/GrpcRequestWrapper.php | GrpcRequestWrapper.handleResponse | private function handleResponse($response)
{
if ($response instanceof PagedListResponse || $response instanceof GaxPagedListResponse) {
$response = $response->getPage()->getResponseObject();
}
if ($response instanceof Message) {
return $this->serializer->encodeMessage($response);
}
if ($response instanceof OperationResponse || $response instanceof GaxOperationResponse) {
return $response;
}
if ($response instanceof ServerStream || $response instanceof GaxServerStream) {
return $this->handleStream($response);
}
return null;
} | php | private function handleResponse($response)
{
if ($response instanceof PagedListResponse || $response instanceof GaxPagedListResponse) {
$response = $response->getPage()->getResponseObject();
}
if ($response instanceof Message) {
return $this->serializer->encodeMessage($response);
}
if ($response instanceof OperationResponse || $response instanceof GaxOperationResponse) {
return $response;
}
if ($response instanceof ServerStream || $response instanceof GaxServerStream) {
return $this->handleStream($response);
}
return null;
} | [
"private",
"function",
"handleResponse",
"(",
"$",
"response",
")",
"{",
"if",
"(",
"$",
"response",
"instanceof",
"PagedListResponse",
"||",
"$",
"response",
"instanceof",
"GaxPagedListResponse",
")",
"{",
"$",
"response",
"=",
"$",
"response",
"->",
"getPage",
"(",
")",
"->",
"getResponseObject",
"(",
")",
";",
"}",
"if",
"(",
"$",
"response",
"instanceof",
"Message",
")",
"{",
"return",
"$",
"this",
"->",
"serializer",
"->",
"encodeMessage",
"(",
"$",
"response",
")",
";",
"}",
"if",
"(",
"$",
"response",
"instanceof",
"OperationResponse",
"||",
"$",
"response",
"instanceof",
"GaxOperationResponse",
")",
"{",
"return",
"$",
"response",
";",
"}",
"if",
"(",
"$",
"response",
"instanceof",
"ServerStream",
"||",
"$",
"response",
"instanceof",
"GaxServerStream",
")",
"{",
"return",
"$",
"this",
"->",
"handleStream",
"(",
"$",
"response",
")",
";",
"}",
"return",
"null",
";",
"}"
] | Serializes a gRPC response.
@param mixed $response
@return \Generator|array|null | [
"Serializes",
"a",
"gRPC",
"response",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Core/src/GrpcRequestWrapper.php#L165-L184 | train |
googleapis/google-cloud-php | Core/src/GrpcRequestWrapper.php | GrpcRequestWrapper.handleStream | private function handleStream($response)
{
try {
foreach ($response->readAll() as $count => $result) {
$res = $this->serializer->encodeMessage($result);
yield $res;
}
} catch (\Exception $ex) {
throw $this->convertToGoogleException($ex);
}
} | php | private function handleStream($response)
{
try {
foreach ($response->readAll() as $count => $result) {
$res = $this->serializer->encodeMessage($result);
yield $res;
}
} catch (\Exception $ex) {
throw $this->convertToGoogleException($ex);
}
} | [
"private",
"function",
"handleStream",
"(",
"$",
"response",
")",
"{",
"try",
"{",
"foreach",
"(",
"$",
"response",
"->",
"readAll",
"(",
")",
"as",
"$",
"count",
"=>",
"$",
"result",
")",
"{",
"$",
"res",
"=",
"$",
"this",
"->",
"serializer",
"->",
"encodeMessage",
"(",
"$",
"result",
")",
";",
"yield",
"$",
"res",
";",
"}",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"ex",
")",
"{",
"throw",
"$",
"this",
"->",
"convertToGoogleException",
"(",
"$",
"ex",
")",
";",
"}",
"}"
] | Handles a streaming response.
@param ServerStream|GaxServerStream $response
@return \Generator|array|null | [
"Handles",
"a",
"streaming",
"response",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Core/src/GrpcRequestWrapper.php#L192-L202 | train |
googleapis/google-cloud-php | Core/src/GrpcRequestWrapper.php | GrpcRequestWrapper.convertToGoogleException | private function convertToGoogleException($ex)
{
switch ($ex->getCode()) {
case Code::INVALID_ARGUMENT:
$exception = Exception\BadRequestException::class;
break;
case Code::NOT_FOUND:
case Code::UNIMPLEMENTED:
$exception = Exception\NotFoundException::class;
break;
case Code::ALREADY_EXISTS:
$exception = Exception\ConflictException::class;
break;
case Code::FAILED_PRECONDITION:
$exception = Exception\FailedPreconditionException::class;
break;
case Code::UNKNOWN:
$exception = Exception\ServerException::class;
break;
case Code::INTERNAL:
$exception = Exception\ServerException::class;
break;
case Code::ABORTED:
$exception = Exception\AbortedException::class;
break;
case Code::DEADLINE_EXCEEDED:
$exception = Exception\DeadlineExceededException::class;
break;
default:
$exception = Exception\ServiceException::class;
break;
}
$metadata = [];
if ($ex->getMetadata()) {
foreach ($ex->getMetadata() as $type => $binaryValue) {
if (!isset($this->metadataTypes[$type])) {
continue;
}
$metadataElement = new $this->metadataTypes[$type];
$metadataElement->mergeFromString($binaryValue[0]);
$metadata[] = $this->serializer->encodeMessage($metadataElement);
}
}
return new $exception($ex->getMessage(), $ex->getCode(), $ex, $metadata);
} | php | private function convertToGoogleException($ex)
{
switch ($ex->getCode()) {
case Code::INVALID_ARGUMENT:
$exception = Exception\BadRequestException::class;
break;
case Code::NOT_FOUND:
case Code::UNIMPLEMENTED:
$exception = Exception\NotFoundException::class;
break;
case Code::ALREADY_EXISTS:
$exception = Exception\ConflictException::class;
break;
case Code::FAILED_PRECONDITION:
$exception = Exception\FailedPreconditionException::class;
break;
case Code::UNKNOWN:
$exception = Exception\ServerException::class;
break;
case Code::INTERNAL:
$exception = Exception\ServerException::class;
break;
case Code::ABORTED:
$exception = Exception\AbortedException::class;
break;
case Code::DEADLINE_EXCEEDED:
$exception = Exception\DeadlineExceededException::class;
break;
default:
$exception = Exception\ServiceException::class;
break;
}
$metadata = [];
if ($ex->getMetadata()) {
foreach ($ex->getMetadata() as $type => $binaryValue) {
if (!isset($this->metadataTypes[$type])) {
continue;
}
$metadataElement = new $this->metadataTypes[$type];
$metadataElement->mergeFromString($binaryValue[0]);
$metadata[] = $this->serializer->encodeMessage($metadataElement);
}
}
return new $exception($ex->getMessage(), $ex->getCode(), $ex, $metadata);
} | [
"private",
"function",
"convertToGoogleException",
"(",
"$",
"ex",
")",
"{",
"switch",
"(",
"$",
"ex",
"->",
"getCode",
"(",
")",
")",
"{",
"case",
"Code",
"::",
"INVALID_ARGUMENT",
":",
"$",
"exception",
"=",
"Exception",
"\\",
"BadRequestException",
"::",
"class",
";",
"break",
";",
"case",
"Code",
"::",
"NOT_FOUND",
":",
"case",
"Code",
"::",
"UNIMPLEMENTED",
":",
"$",
"exception",
"=",
"Exception",
"\\",
"NotFoundException",
"::",
"class",
";",
"break",
";",
"case",
"Code",
"::",
"ALREADY_EXISTS",
":",
"$",
"exception",
"=",
"Exception",
"\\",
"ConflictException",
"::",
"class",
";",
"break",
";",
"case",
"Code",
"::",
"FAILED_PRECONDITION",
":",
"$",
"exception",
"=",
"Exception",
"\\",
"FailedPreconditionException",
"::",
"class",
";",
"break",
";",
"case",
"Code",
"::",
"UNKNOWN",
":",
"$",
"exception",
"=",
"Exception",
"\\",
"ServerException",
"::",
"class",
";",
"break",
";",
"case",
"Code",
"::",
"INTERNAL",
":",
"$",
"exception",
"=",
"Exception",
"\\",
"ServerException",
"::",
"class",
";",
"break",
";",
"case",
"Code",
"::",
"ABORTED",
":",
"$",
"exception",
"=",
"Exception",
"\\",
"AbortedException",
"::",
"class",
";",
"break",
";",
"case",
"Code",
"::",
"DEADLINE_EXCEEDED",
":",
"$",
"exception",
"=",
"Exception",
"\\",
"DeadlineExceededException",
"::",
"class",
";",
"break",
";",
"default",
":",
"$",
"exception",
"=",
"Exception",
"\\",
"ServiceException",
"::",
"class",
";",
"break",
";",
"}",
"$",
"metadata",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"ex",
"->",
"getMetadata",
"(",
")",
")",
"{",
"foreach",
"(",
"$",
"ex",
"->",
"getMetadata",
"(",
")",
"as",
"$",
"type",
"=>",
"$",
"binaryValue",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"metadataTypes",
"[",
"$",
"type",
"]",
")",
")",
"{",
"continue",
";",
"}",
"$",
"metadataElement",
"=",
"new",
"$",
"this",
"->",
"metadataTypes",
"[",
"$",
"type",
"]",
";",
"$",
"metadataElement",
"->",
"mergeFromString",
"(",
"$",
"binaryValue",
"[",
"0",
"]",
")",
";",
"$",
"metadata",
"[",
"]",
"=",
"$",
"this",
"->",
"serializer",
"->",
"encodeMessage",
"(",
"$",
"metadataElement",
")",
";",
"}",
"}",
"return",
"new",
"$",
"exception",
"(",
"$",
"ex",
"->",
"getMessage",
"(",
")",
",",
"$",
"ex",
"->",
"getCode",
"(",
")",
",",
"$",
"ex",
",",
"$",
"metadata",
")",
";",
"}"
] | Convert a ApiCore exception to a Google Exception.
@param ApiException|GaxApiException $ex
@return Exception\ServiceException | [
"Convert",
"a",
"ApiCore",
"exception",
"to",
"a",
"Google",
"Exception",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Core/src/GrpcRequestWrapper.php#L210-L264 | train |
googleapis/google-cloud-php | Vision/src/V1/ImageContext.php | ImageContext.setLatLongRect | public function setLatLongRect($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\LatLongRect::class);
$this->lat_long_rect = $var;
return $this;
} | php | public function setLatLongRect($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\LatLongRect::class);
$this->lat_long_rect = $var;
return $this;
} | [
"public",
"function",
"setLatLongRect",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Vision",
"\\",
"V1",
"\\",
"LatLongRect",
"::",
"class",
")",
";",
"$",
"this",
"->",
"lat_long_rect",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Not used.
Generated from protobuf field <code>.google.cloud.vision.v1.LatLongRect lat_long_rect = 1;</code>
@param \Google\Cloud\Vision\V1\LatLongRect $var
@return $this | [
"Not",
"used",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Vision/src/V1/ImageContext.php#L104-L110 | train |
googleapis/google-cloud-php | Vision/src/V1/ImageContext.php | ImageContext.setCropHintsParams | public function setCropHintsParams($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\CropHintsParams::class);
$this->crop_hints_params = $var;
return $this;
} | php | public function setCropHintsParams($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\CropHintsParams::class);
$this->crop_hints_params = $var;
return $this;
} | [
"public",
"function",
"setCropHintsParams",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Vision",
"\\",
"V1",
"\\",
"CropHintsParams",
"::",
"class",
")",
";",
"$",
"this",
"->",
"crop_hints_params",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Parameters for crop hints annotation request.
Generated from protobuf field <code>.google.cloud.vision.v1.CropHintsParams crop_hints_params = 4;</code>
@param \Google\Cloud\Vision\V1\CropHintsParams $var
@return $this | [
"Parameters",
"for",
"crop",
"hints",
"annotation",
"request",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Vision/src/V1/ImageContext.php#L170-L176 | train |
googleapis/google-cloud-php | Vision/src/V1/ImageContext.php | ImageContext.setProductSearchParams | public function setProductSearchParams($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ProductSearchParams::class);
$this->product_search_params = $var;
return $this;
} | php | public function setProductSearchParams($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ProductSearchParams::class);
$this->product_search_params = $var;
return $this;
} | [
"public",
"function",
"setProductSearchParams",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Vision",
"\\",
"V1",
"\\",
"ProductSearchParams",
"::",
"class",
")",
";",
"$",
"this",
"->",
"product_search_params",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Parameters for product search.
Generated from protobuf field <code>.google.cloud.vision.v1.ProductSearchParams product_search_params = 5;</code>
@param \Google\Cloud\Vision\V1\ProductSearchParams $var
@return $this | [
"Parameters",
"for",
"product",
"search",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Vision/src/V1/ImageContext.php#L196-L202 | train |
googleapis/google-cloud-php | Vision/src/V1/ImageContext.php | ImageContext.setWebDetectionParams | public function setWebDetectionParams($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\WebDetectionParams::class);
$this->web_detection_params = $var;
return $this;
} | php | public function setWebDetectionParams($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\WebDetectionParams::class);
$this->web_detection_params = $var;
return $this;
} | [
"public",
"function",
"setWebDetectionParams",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Vision",
"\\",
"V1",
"\\",
"WebDetectionParams",
"::",
"class",
")",
";",
"$",
"this",
"->",
"web_detection_params",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Parameters for web detection.
Generated from protobuf field <code>.google.cloud.vision.v1.WebDetectionParams web_detection_params = 6;</code>
@param \Google\Cloud\Vision\V1\WebDetectionParams $var
@return $this | [
"Parameters",
"for",
"web",
"detection",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Vision/src/V1/ImageContext.php#L222-L228 | train |
googleapis/google-cloud-php | Datastore/src/V1/QueryResultBatch.php | QueryResultBatch.setEntityResultType | public function setEntityResultType($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Datastore\V1\EntityResult_ResultType::class);
$this->entity_result_type = $var;
return $this;
} | php | public function setEntityResultType($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Datastore\V1\EntityResult_ResultType::class);
$this->entity_result_type = $var;
return $this;
} | [
"public",
"function",
"setEntityResultType",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Datastore",
"\\",
"V1",
"\\",
"EntityResult_ResultType",
"::",
"class",
")",
";",
"$",
"this",
"->",
"entity_result_type",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | The result type for every entity in `entity_results`.
Generated from protobuf field <code>.google.datastore.v1.EntityResult.ResultType entity_result_type = 1;</code>
@param int $var
@return $this | [
"The",
"result",
"type",
"for",
"every",
"entity",
"in",
"entity_results",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Datastore/src/V1/QueryResultBatch.php#L176-L182 | train |
googleapis/google-cloud-php | Datastore/src/V1/QueryResultBatch.php | QueryResultBatch.setEntityResults | public function setEntityResults($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Datastore\V1\EntityResult::class);
$this->entity_results = $arr;
return $this;
} | php | public function setEntityResults($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Datastore\V1\EntityResult::class);
$this->entity_results = $arr;
return $this;
} | [
"public",
"function",
"setEntityResults",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Datastore",
"\\",
"V1",
"\\",
"EntityResult",
"::",
"class",
")",
";",
"$",
"this",
"->",
"entity_results",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | The results for this batch.
Generated from protobuf field <code>repeated .google.datastore.v1.EntityResult entity_results = 2;</code>
@param \Google\Cloud\Datastore\V1\EntityResult[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"The",
"results",
"for",
"this",
"batch",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Datastore/src/V1/QueryResultBatch.php#L202-L208 | train |
googleapis/google-cloud-php | Datastore/src/V1/QueryResultBatch.php | QueryResultBatch.setMoreResults | public function setMoreResults($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Datastore\V1\QueryResultBatch_MoreResultsType::class);
$this->more_results = $var;
return $this;
} | php | public function setMoreResults($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Datastore\V1\QueryResultBatch_MoreResultsType::class);
$this->more_results = $var;
return $this;
} | [
"public",
"function",
"setMoreResults",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Datastore",
"\\",
"V1",
"\\",
"QueryResultBatch_MoreResultsType",
"::",
"class",
")",
";",
"$",
"this",
"->",
"more_results",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | The state of the query after the current batch.
Generated from protobuf field <code>.google.datastore.v1.QueryResultBatch.MoreResultsType more_results = 5;</code>
@param int $var
@return $this | [
"The",
"state",
"of",
"the",
"query",
"after",
"the",
"current",
"batch",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Datastore/src/V1/QueryResultBatch.php#L254-L260 | train |
googleapis/google-cloud-php | Dlp/src/V2/InspectDataSourceDetails/Result.php | Result.setInfoTypeStats | public function setInfoTypeStats($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dlp\V2\InfoTypeStats::class);
$this->info_type_stats = $arr;
return $this;
} | php | public function setInfoTypeStats($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dlp\V2\InfoTypeStats::class);
$this->info_type_stats = $arr;
return $this;
} | [
"public",
"function",
"setInfoTypeStats",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dlp",
"\\",
"V2",
"\\",
"InfoTypeStats",
"::",
"class",
")",
";",
"$",
"this",
"->",
"info_type_stats",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | Statistics of how many instances of each info type were found during
inspect job.
Generated from protobuf field <code>repeated .google.privacy.dlp.v2.InfoTypeStats info_type_stats = 3;</code>
@param \Google\Cloud\Dlp\V2\InfoTypeStats[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"Statistics",
"of",
"how",
"many",
"instances",
"of",
"each",
"info",
"type",
"were",
"found",
"during",
"inspect",
"job",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/InspectDataSourceDetails/Result.php#L130-L136 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.