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
sequence | docstring
stringlengths 3
47.2k
| docstring_tokens
sequence | sha
stringlengths 40
40
| url
stringlengths 91
247
| partition
stringclasses 1
value |
---|---|---|---|---|---|---|---|---|---|---|---|
googleapis/google-cloud-php | AutoMl/src/V1beta1/ListModelEvaluationsResponse.php | ListModelEvaluationsResponse.setModelEvaluation | public function setModelEvaluation($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\AutoMl\V1beta1\ModelEvaluation::class);
$this->model_evaluation = $arr;
return $this;
} | php | public function setModelEvaluation($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\AutoMl\V1beta1\ModelEvaluation::class);
$this->model_evaluation = $arr;
return $this;
} | [
"public",
"function",
"setModelEvaluation",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"AutoMl",
"\\",
"V1beta1",
"\\",
"ModelEvaluation",
"::",
"class",
")",
";",
"$",
"this",
"->",
"model_evaluation",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | List of model evaluations in the requested page.
Generated from protobuf field <code>repeated .google.cloud.automl.v1beta1.ModelEvaluation model_evaluation = 1;</code>
@param \Google\Cloud\AutoMl\V1beta1\ModelEvaluation[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"List",
"of",
"model",
"evaluations",
"in",
"the",
"requested",
"page",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/AutoMl/src/V1beta1/ListModelEvaluationsResponse.php#L68-L74 | train |
googleapis/google-cloud-php | Bigtable/src/Admin/V2/CreateTableRequest.php | CreateTableRequest.setTable | public function setTable($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\Admin\V2\Table::class);
$this->table = $var;
return $this;
} | php | public function setTable($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\Admin\V2\Table::class);
$this->table = $var;
return $this;
} | [
"public",
"function",
"setTable",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Bigtable",
"\\",
"Admin",
"\\",
"V2",
"\\",
"Table",
"::",
"class",
")",
";",
"$",
"this",
"->",
"table",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | The Table to create.
Generated from protobuf field <code>.google.bigtable.admin.v2.Table table = 3;</code>
@param \Google\Cloud\Bigtable\Admin\V2\Table $var
@return $this | [
"The",
"Table",
"to",
"create",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Bigtable/src/Admin/V2/CreateTableRequest.php#L169-L175 | train |
googleapis/google-cloud-php | Dialogflow/src/V2/Intent/Message/SelectItemInfo.php | SelectItemInfo.setSynonyms | public function setSynonyms($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->synonyms = $arr;
return $this;
} | php | public function setSynonyms($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->synonyms = $arr;
return $this;
} | [
"public",
"function",
"setSynonyms",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"STRING",
")",
";",
"$",
"this",
"->",
"synonyms",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | Optional. A list of synonyms that can also be used to trigger this
item in dialog.
Generated from protobuf field <code>repeated string synonyms = 2;</code>
@param string[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"Optional",
".",
"A",
"list",
"of",
"synonyms",
"that",
"can",
"also",
"be",
"used",
"to",
"trigger",
"this",
"item",
"in",
"dialog",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dialogflow/src/V2/Intent/Message/SelectItemInfo.php#L101-L107 | train |
googleapis/google-cloud-php | Vision/src/V1/SafeSearchAnnotation.php | SafeSearchAnnotation.setAdult | public function setAdult($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Likelihood::class);
$this->adult = $var;
return $this;
} | php | public function setAdult($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Likelihood::class);
$this->adult = $var;
return $this;
} | [
"public",
"function",
"setAdult",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Vision",
"\\",
"V1",
"\\",
"Likelihood",
"::",
"class",
")",
";",
"$",
"this",
"->",
"adult",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Represents the adult content likelihood for the image. Adult content may
contain elements such as nudity, pornographic images or cartoons, or
sexual activities.
Generated from protobuf field <code>.google.cloud.vision.v1.Likelihood adult = 1;</code>
@param int $var
@return $this | [
"Represents",
"the",
"adult",
"content",
"likelihood",
"for",
"the",
"image",
".",
"Adult",
"content",
"may",
"contain",
"elements",
"such",
"as",
"nudity",
"pornographic",
"images",
"or",
"cartoons",
"or",
"sexual",
"activities",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Vision/src/V1/SafeSearchAnnotation.php#L110-L116 | train |
googleapis/google-cloud-php | Vision/src/V1/SafeSearchAnnotation.php | SafeSearchAnnotation.setSpoof | public function setSpoof($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Likelihood::class);
$this->spoof = $var;
return $this;
} | php | public function setSpoof($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Likelihood::class);
$this->spoof = $var;
return $this;
} | [
"public",
"function",
"setSpoof",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Vision",
"\\",
"V1",
"\\",
"Likelihood",
"::",
"class",
")",
";",
"$",
"this",
"->",
"spoof",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Spoof likelihood. The likelihood that an modification
was made to the image's canonical version to make it appear
funny or offensive.
Generated from protobuf field <code>.google.cloud.vision.v1.Likelihood spoof = 2;</code>
@param int $var
@return $this | [
"Spoof",
"likelihood",
".",
"The",
"likelihood",
"that",
"an",
"modification",
"was",
"made",
"to",
"the",
"image",
"s",
"canonical",
"version",
"to",
"make",
"it",
"appear",
"funny",
"or",
"offensive",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Vision/src/V1/SafeSearchAnnotation.php#L140-L146 | train |
googleapis/google-cloud-php | Vision/src/V1/SafeSearchAnnotation.php | SafeSearchAnnotation.setMedical | public function setMedical($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Likelihood::class);
$this->medical = $var;
return $this;
} | php | public function setMedical($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Likelihood::class);
$this->medical = $var;
return $this;
} | [
"public",
"function",
"setMedical",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Vision",
"\\",
"V1",
"\\",
"Likelihood",
"::",
"class",
")",
";",
"$",
"this",
"->",
"medical",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Likelihood that this is a medical image.
Generated from protobuf field <code>.google.cloud.vision.v1.Likelihood medical = 3;</code>
@param int $var
@return $this | [
"Likelihood",
"that",
"this",
"is",
"a",
"medical",
"image",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Vision/src/V1/SafeSearchAnnotation.php#L166-L172 | train |
googleapis/google-cloud-php | Vision/src/V1/SafeSearchAnnotation.php | SafeSearchAnnotation.setViolence | public function setViolence($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Likelihood::class);
$this->violence = $var;
return $this;
} | php | public function setViolence($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Likelihood::class);
$this->violence = $var;
return $this;
} | [
"public",
"function",
"setViolence",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Vision",
"\\",
"V1",
"\\",
"Likelihood",
"::",
"class",
")",
";",
"$",
"this",
"->",
"violence",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Likelihood that this image contains violent content.
Generated from protobuf field <code>.google.cloud.vision.v1.Likelihood violence = 4;</code>
@param int $var
@return $this | [
"Likelihood",
"that",
"this",
"image",
"contains",
"violent",
"content",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Vision/src/V1/SafeSearchAnnotation.php#L192-L198 | train |
googleapis/google-cloud-php | Dialogflow/src/V2/Gapic/SessionEntityTypesGapicClient.php | SessionEntityTypesGapicClient.sessionEntityTypeName | public static function sessionEntityTypeName($project, $session, $entityType)
{
return self::getSessionEntityTypeNameTemplate()->render([
'project' => $project,
'session' => $session,
'entity_type' => $entityType,
]);
} | php | public static function sessionEntityTypeName($project, $session, $entityType)
{
return self::getSessionEntityTypeNameTemplate()->render([
'project' => $project,
'session' => $session,
'entity_type' => $entityType,
]);
} | [
"public",
"static",
"function",
"sessionEntityTypeName",
"(",
"$",
"project",
",",
"$",
"session",
",",
"$",
"entityType",
")",
"{",
"return",
"self",
"::",
"getSessionEntityTypeNameTemplate",
"(",
")",
"->",
"render",
"(",
"[",
"'project'",
"=>",
"$",
"project",
",",
"'session'",
"=>",
"$",
"session",
",",
"'entity_type'",
"=>",
"$",
"entityType",
",",
"]",
")",
";",
"}"
] | Formats a string containing the fully-qualified path to represent
a session_entity_type resource.
@param string $project
@param string $session
@param string $entityType
@return string The formatted session_entity_type resource.
@experimental | [
"Formats",
"a",
"string",
"containing",
"the",
"fully",
"-",
"qualified",
"path",
"to",
"represent",
"a",
"session_entity_type",
"resource",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dialogflow/src/V2/Gapic/SessionEntityTypesGapicClient.php#L211-L218 | train |
googleapis/google-cloud-php | Talent/src/V4beta1/SearchProfilesRequest.php | SearchProfilesRequest.setRequestMetadata | public function setRequestMetadata($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Talent\V4beta1\RequestMetadata::class);
$this->request_metadata = $var;
return $this;
} | php | public function setRequestMetadata($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Talent\V4beta1\RequestMetadata::class);
$this->request_metadata = $var;
return $this;
} | [
"public",
"function",
"setRequestMetadata",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Talent",
"\\",
"V4beta1",
"\\",
"RequestMetadata",
"::",
"class",
")",
";",
"$",
"this",
"->",
"request_metadata",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Required.
The meta information collected about the profile search user. This is used
to improve the search quality of the service. These values are provided by
users, and must be precise and consistent.
Generated from protobuf field <code>.google.cloud.talent.v4beta1.RequestMetadata request_metadata = 2;</code>
@param \Google\Cloud\Talent\V4beta1\RequestMetadata $var
@return $this | [
"Required",
".",
"The",
"meta",
"information",
"collected",
"about",
"the",
"profile",
"search",
"user",
".",
"This",
"is",
"used",
"to",
"improve",
"the",
"search",
"quality",
"of",
"the",
"service",
".",
"These",
"values",
"are",
"provided",
"by",
"users",
"and",
"must",
"be",
"precise",
"and",
"consistent",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Talent/src/V4beta1/SearchProfilesRequest.php#L426-L432 | train |
googleapis/google-cloud-php | Kms/src/V1/ListCryptoKeysRequest.php | ListCryptoKeysRequest.setVersionView | public function setVersionView($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Kms\V1\CryptoKeyVersion_CryptoKeyVersionView::class);
$this->version_view = $var;
return $this;
} | php | public function setVersionView($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Kms\V1\CryptoKeyVersion_CryptoKeyVersionView::class);
$this->version_view = $var;
return $this;
} | [
"public",
"function",
"setVersionView",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Kms",
"\\",
"V1",
"\\",
"CryptoKeyVersion_CryptoKeyVersionView",
"::",
"class",
")",
";",
"$",
"this",
"->",
"version_view",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | The fields of the primary version to include in the response.
Generated from protobuf field <code>.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView version_view = 4;</code>
@param int $var
@return $this | [
"The",
"fields",
"of",
"the",
"primary",
"version",
"to",
"include",
"in",
"the",
"response",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Kms/src/V1/ListCryptoKeysRequest.php#L193-L199 | train |
googleapis/google-cloud-php | Dataproc/src/V1/WorkflowMetadata.php | WorkflowMetadata.setDeleteCluster | public function setDeleteCluster($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dataproc\V1\ClusterOperation::class);
$this->delete_cluster = $var;
return $this;
} | php | public function setDeleteCluster($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dataproc\V1\ClusterOperation::class);
$this->delete_cluster = $var;
return $this;
} | [
"public",
"function",
"setDeleteCluster",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dataproc",
"\\",
"V1",
"\\",
"ClusterOperation",
"::",
"class",
")",
";",
"$",
"this",
"->",
"delete_cluster",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Output only. The delete cluster operation metadata.
Generated from protobuf field <code>.google.cloud.dataproc.v1.ClusterOperation delete_cluster = 5;</code>
@param \Google\Cloud\Dataproc\V1\ClusterOperation $var
@return $this | [
"Output",
"only",
".",
"The",
"delete",
"cluster",
"operation",
"metadata",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dataproc/src/V1/WorkflowMetadata.php#L246-L252 | train |
googleapis/google-cloud-php | Dataproc/src/V1/WorkflowMetadata.php | WorkflowMetadata.setState | public function setState($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Dataproc\V1\WorkflowMetadata_State::class);
$this->state = $var;
return $this;
} | php | public function setState($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Dataproc\V1\WorkflowMetadata_State::class);
$this->state = $var;
return $this;
} | [
"public",
"function",
"setState",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dataproc",
"\\",
"V1",
"\\",
"WorkflowMetadata_State",
"::",
"class",
")",
";",
"$",
"this",
"->",
"state",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Output only. The workflow state.
Generated from protobuf field <code>.google.cloud.dataproc.v1.WorkflowMetadata.State state = 6;</code>
@param int $var
@return $this | [
"Output",
"only",
".",
"The",
"workflow",
"state",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dataproc/src/V1/WorkflowMetadata.php#L272-L278 | train |
googleapis/google-cloud-php | Talent/src/V4beta1/SearchJobsResponse/CommuteInfo.php | CommuteInfo.setJobLocation | public function setJobLocation($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Talent\V4beta1\Location::class);
$this->job_location = $var;
return $this;
} | php | public function setJobLocation($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Talent\V4beta1\Location::class);
$this->job_location = $var;
return $this;
} | [
"public",
"function",
"setJobLocation",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Talent",
"\\",
"V4beta1",
"\\",
"Location",
"::",
"class",
")",
";",
"$",
"this",
"->",
"job_location",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Location used as the destination in the commute calculation.
Generated from protobuf field <code>.google.cloud.talent.v4beta1.Location job_location = 1;</code>
@param \Google\Cloud\Talent\V4beta1\Location $var
@return $this | [
"Location",
"used",
"as",
"the",
"destination",
"in",
"the",
"commute",
"calculation",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Talent/src/V4beta1/SearchJobsResponse/CommuteInfo.php#L73-L79 | train |
googleapis/google-cloud-php | Tasks/src/V2beta2/LeaseTasksResponse.php | LeaseTasksResponse.setTasks | public function setTasks($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Tasks\V2beta2\Task::class);
$this->tasks = $arr;
return $this;
} | php | public function setTasks($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Tasks\V2beta2\Task::class);
$this->tasks = $arr;
return $this;
} | [
"public",
"function",
"setTasks",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Tasks",
"\\",
"V2beta2",
"\\",
"Task",
"::",
"class",
")",
";",
"$",
"this",
"->",
"tasks",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | The leased tasks.
Generated from protobuf field <code>repeated .google.cloud.tasks.v2beta2.Task tasks = 1;</code>
@param \Google\Cloud\Tasks\V2beta2\Task[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"The",
"leased",
"tasks",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Tasks/src/V2beta2/LeaseTasksResponse.php#L59-L65 | train |
googleapis/google-cloud-php | Container/src/V1/MasterAuth.php | MasterAuth.setClientCertificateConfig | public function setClientCertificateConfig($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Container\V1\ClientCertificateConfig::class);
$this->client_certificate_config = $var;
return $this;
} | php | public function setClientCertificateConfig($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Container\V1\ClientCertificateConfig::class);
$this->client_certificate_config = $var;
return $this;
} | [
"public",
"function",
"setClientCertificateConfig",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Container",
"\\",
"V1",
"\\",
"ClientCertificateConfig",
"::",
"class",
")",
";",
"$",
"this",
"->",
"client_certificate_config",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Configuration for client certificate authentication on the cluster. For
clusters before v1.12, if no configuration is specified, a client
certificate is issued.
Generated from protobuf field <code>.google.container.v1.ClientCertificateConfig client_certificate_config = 3;</code>
@param \Google\Cloud\Container\V1\ClientCertificateConfig $var
@return $this | [
"Configuration",
"for",
"client",
"certificate",
"authentication",
"on",
"the",
"cluster",
".",
"For",
"clusters",
"before",
"v1",
".",
"12",
"if",
"no",
"configuration",
"is",
"specified",
"a",
"client",
"certificate",
"is",
"issued",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Container/src/V1/MasterAuth.php#L186-L192 | train |
googleapis/google-cloud-php | BigQuery/src/QueryResults.php | QueryResults.rows | public function rows(array $options = [])
{
$options += $this->queryResultsOptions;
$this->waitUntilComplete($options);
$schema = $this->info['schema']['fields'];
return new ItemIterator(
new PageIterator(
function (array $row) use ($schema) {
$mergedRow = [];
if ($row === null) {
return $mergedRow;
}
if (!array_key_exists('f', $row)) {
throw new GoogleException('Bad response - missing key "f" for a row.');
}
foreach ($row['f'] as $key => $value) {
$fieldSchema = $schema[$key];
$mergedRow[$fieldSchema['name']] = $this->mapper->fromBigQuery($value, $fieldSchema);
}
return $mergedRow;
},
[$this->connection, 'getQueryResults'],
$options + $this->identity,
[
'itemsKey' => 'rows',
'firstPage' => $this->info,
'nextResultTokenKey' => 'pageToken'
]
)
);
} | php | public function rows(array $options = [])
{
$options += $this->queryResultsOptions;
$this->waitUntilComplete($options);
$schema = $this->info['schema']['fields'];
return new ItemIterator(
new PageIterator(
function (array $row) use ($schema) {
$mergedRow = [];
if ($row === null) {
return $mergedRow;
}
if (!array_key_exists('f', $row)) {
throw new GoogleException('Bad response - missing key "f" for a row.');
}
foreach ($row['f'] as $key => $value) {
$fieldSchema = $schema[$key];
$mergedRow[$fieldSchema['name']] = $this->mapper->fromBigQuery($value, $fieldSchema);
}
return $mergedRow;
},
[$this->connection, 'getQueryResults'],
$options + $this->identity,
[
'itemsKey' => 'rows',
'firstPage' => $this->info,
'nextResultTokenKey' => 'pageToken'
]
)
);
} | [
"public",
"function",
"rows",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"+=",
"$",
"this",
"->",
"queryResultsOptions",
";",
"$",
"this",
"->",
"waitUntilComplete",
"(",
"$",
"options",
")",
";",
"$",
"schema",
"=",
"$",
"this",
"->",
"info",
"[",
"'schema'",
"]",
"[",
"'fields'",
"]",
";",
"return",
"new",
"ItemIterator",
"(",
"new",
"PageIterator",
"(",
"function",
"(",
"array",
"$",
"row",
")",
"use",
"(",
"$",
"schema",
")",
"{",
"$",
"mergedRow",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"row",
"===",
"null",
")",
"{",
"return",
"$",
"mergedRow",
";",
"}",
"if",
"(",
"!",
"array_key_exists",
"(",
"'f'",
",",
"$",
"row",
")",
")",
"{",
"throw",
"new",
"GoogleException",
"(",
"'Bad response - missing key \"f\" for a row.'",
")",
";",
"}",
"foreach",
"(",
"$",
"row",
"[",
"'f'",
"]",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"fieldSchema",
"=",
"$",
"schema",
"[",
"$",
"key",
"]",
";",
"$",
"mergedRow",
"[",
"$",
"fieldSchema",
"[",
"'name'",
"]",
"]",
"=",
"$",
"this",
"->",
"mapper",
"->",
"fromBigQuery",
"(",
"$",
"value",
",",
"$",
"fieldSchema",
")",
";",
"}",
"return",
"$",
"mergedRow",
";",
"}",
",",
"[",
"$",
"this",
"->",
"connection",
",",
"'getQueryResults'",
"]",
",",
"$",
"options",
"+",
"$",
"this",
"->",
"identity",
",",
"[",
"'itemsKey'",
"=>",
"'rows'",
",",
"'firstPage'",
"=>",
"$",
"this",
"->",
"info",
",",
"'nextResultTokenKey'",
"=>",
"'pageToken'",
"]",
")",
")",
";",
"}"
] | Retrieves the rows associated with the query and merges them together
with the table's schema.
Refer to the table below for a guide on how BigQuery types are mapped as
they come back from the API.
| **PHP Type** | **BigQuery Data Type** |
|--------------------------------------------|--------------------------------------|
| `\DateTimeInterface` | `DATETIME` |
| {@see Google\Cloud\BigQuery\Bytes} | `BYTES` |
| {@see Google\Cloud\BigQuery\Date} | `DATE` |
| {@see Google\Cloud\Core\Int64} | `INTEGER` |
| {@see Google\Cloud\BigQuery\Time} | `TIME` |
| {@see Google\Cloud\BigQuery\Timestamp} | `TIMESTAMP` |
| Associative Array | `RECORD` |
| Non-Associative Array | `RECORD` (Repeated) |
| `float` | `FLOAT` |
| `int` | `INTEGER` |
| `string` | `STRING` |
| `bool` | `BOOLEAN` |
Example:
```
$rows = $queryResults->rows();
foreach ($rows as $row) {
echo $row['name'] . PHP_EOL;
}
```
@param array $options [optional] {
Configuration options. Please note, these options will inherit the
values set by either
{@see Google\Cloud\BigQuery\BigQueryClient::runQuery()} or
{@see Google\Cloud\BigQuery\Job::queryResults()}.
@type int $maxResults Maximum number of results to read per page.
@type int $startIndex Zero-based index of the starting row.
@type int $timeoutMs How long, in milliseconds, each API call will
wait for query results to become available before timing out.
Depending on whether the $maxRetries has been exceeded, the
results will be polled again after the timeout has been reached.
**Defaults to** `10000` milliseconds (10 seconds).
@type int $maxRetries The number of times to poll the Job status,
until the job is complete. By default, will poll indefinitely.
}
@return ItemIterator
@throws JobException If the maximum number of retries while waiting for
query completion has been exceeded.
@throws GoogleException Thrown in the case of a malformed response. | [
"Retrieves",
"the",
"rows",
"associated",
"with",
"the",
"query",
"and",
"merges",
"them",
"together",
"with",
"the",
"table",
"s",
"schema",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/BigQuery/src/QueryResults.php#L155-L190 | train |
googleapis/google-cloud-php | BigQuery/src/QueryResults.php | QueryResults.waitUntilComplete | public function waitUntilComplete(array $options = [])
{
$options += $this->queryResultsOptions;
$maxRetries = $this->pluck('maxRetries', $options, false);
$this->wait(
function () {
return $this->isComplete();
},
function () use ($options) {
return $this->reload($options);
},
$this->job,
$maxRetries
);
} | php | public function waitUntilComplete(array $options = [])
{
$options += $this->queryResultsOptions;
$maxRetries = $this->pluck('maxRetries', $options, false);
$this->wait(
function () {
return $this->isComplete();
},
function () use ($options) {
return $this->reload($options);
},
$this->job,
$maxRetries
);
} | [
"public",
"function",
"waitUntilComplete",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"+=",
"$",
"this",
"->",
"queryResultsOptions",
";",
"$",
"maxRetries",
"=",
"$",
"this",
"->",
"pluck",
"(",
"'maxRetries'",
",",
"$",
"options",
",",
"false",
")",
";",
"$",
"this",
"->",
"wait",
"(",
"function",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"isComplete",
"(",
")",
";",
"}",
",",
"function",
"(",
")",
"use",
"(",
"$",
"options",
")",
"{",
"return",
"$",
"this",
"->",
"reload",
"(",
"$",
"options",
")",
";",
"}",
",",
"$",
"this",
"->",
"job",
",",
"$",
"maxRetries",
")",
";",
"}"
] | Blocks until the query is complete.
Example:
```
$queryResults->waitUntilComplete();
```
@param array $options [optional] {
Configuration options. Please note, these options will inherit the
values set by either
{@see Google\Cloud\BigQuery\BigQueryClient::runQuery()} or
{@see Google\Cloud\BigQuery\Job::queryResults()}.
@type int $maxResults Maximum number of results to read per page.
@type int $startIndex Zero-based index of the starting row.
@type int $timeoutMs How long, in milliseconds, each API call will
wait for query results to become available before timing out.
Depending on whether the $maxRetries has been exceeded, the
results will be polled again after the timeout has been reached.
**Defaults to** `10000` milliseconds (10 seconds).
@type int $maxRetries The number of times to poll the Job status,
until the job is complete. By default, will poll indefinitely.
}
@throws JobException If the maximum number of retries while waiting for
query completion has been exceeded. | [
"Blocks",
"until",
"the",
"query",
"is",
"complete",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/BigQuery/src/QueryResults.php#L219-L233 | train |
googleapis/google-cloud-php | BigQuery/src/QueryResults.php | QueryResults.reload | public function reload(array $options = [])
{
return $this->info = $this->connection->getQueryResults(
$options + $this->identity
);
} | php | public function reload(array $options = [])
{
return $this->info = $this->connection->getQueryResults(
$options + $this->identity
);
} | [
"public",
"function",
"reload",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"info",
"=",
"$",
"this",
"->",
"connection",
"->",
"getQueryResults",
"(",
"$",
"options",
"+",
"$",
"this",
"->",
"identity",
")",
";",
"}"
] | Triggers a network request to reload the query's details.
Example:
```
$queryResults->reload();
```
@see https://cloud.google.com/bigquery/docs/reference/v2/jobs/getQueryResults
Jobs getQueryResults API documentation.
@param array $options [optional] {
Configuration options.
@type int $maxResults Maximum number of results to read per page.
@type int $startIndex Zero-based index of the starting row.
@type int $timeoutMs How long to wait for the query to complete, in
milliseconds. **Defaults to** `10000` milliseconds (10 seconds).
}
@return array | [
"Triggers",
"a",
"network",
"request",
"to",
"reload",
"the",
"query",
"s",
"details",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/BigQuery/src/QueryResults.php#L275-L280 | train |
googleapis/google-cloud-php | Bigtable/src/Admin/V2/ListTablesResponse.php | ListTablesResponse.setTables | public function setTables($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Bigtable\Admin\V2\Table::class);
$this->tables = $arr;
return $this;
} | php | public function setTables($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Bigtable\Admin\V2\Table::class);
$this->tables = $arr;
return $this;
} | [
"public",
"function",
"setTables",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Bigtable",
"\\",
"Admin",
"\\",
"V2",
"\\",
"Table",
"::",
"class",
")",
";",
"$",
"this",
"->",
"tables",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | The tables present in the requested instance.
Generated from protobuf field <code>repeated .google.bigtable.admin.v2.Table tables = 1;</code>
@param \Google\Cloud\Bigtable\Admin\V2\Table[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"The",
"tables",
"present",
"in",
"the",
"requested",
"instance",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Bigtable/src/Admin/V2/ListTablesResponse.php#L71-L77 | train |
googleapis/google-cloud-php | SecurityCenter/src/V1/OrganizationSettings/AssetDiscoveryConfig.php | AssetDiscoveryConfig.setProjectIds | public function setProjectIds($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->project_ids = $arr;
return $this;
} | php | public function setProjectIds($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->project_ids = $arr;
return $this;
} | [
"public",
"function",
"setProjectIds",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"STRING",
")",
";",
"$",
"this",
"->",
"project_ids",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | The project ids to use for filtering asset discovery.
Generated from protobuf field <code>repeated string project_ids = 1;</code>
@param string[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"The",
"project",
"ids",
"to",
"use",
"for",
"filtering",
"asset",
"discovery",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/SecurityCenter/src/V1/OrganizationSettings/AssetDiscoveryConfig.php#L66-L72 | train |
googleapis/google-cloud-php | SecurityCenter/src/V1/OrganizationSettings/AssetDiscoveryConfig.php | AssetDiscoveryConfig.setInclusionMode | public function setInclusionMode($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\SecurityCenter\V1\OrganizationSettings_AssetDiscoveryConfig_InclusionMode::class);
$this->inclusion_mode = $var;
return $this;
} | php | public function setInclusionMode($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\SecurityCenter\V1\OrganizationSettings_AssetDiscoveryConfig_InclusionMode::class);
$this->inclusion_mode = $var;
return $this;
} | [
"public",
"function",
"setInclusionMode",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"SecurityCenter",
"\\",
"V1",
"\\",
"OrganizationSettings_AssetDiscoveryConfig_InclusionMode",
"::",
"class",
")",
";",
"$",
"this",
"->",
"inclusion_mode",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | The mode to use for filtering asset discovery.
Generated from protobuf field <code>.google.cloud.securitycenter.v1.OrganizationSettings.AssetDiscoveryConfig.InclusionMode inclusion_mode = 2;</code>
@param int $var
@return $this | [
"The",
"mode",
"to",
"use",
"for",
"filtering",
"asset",
"discovery",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/SecurityCenter/src/V1/OrganizationSettings/AssetDiscoveryConfig.php#L92-L98 | train |
googleapis/google-cloud-php | Dlp/src/V2/CreateInspectTemplateRequest.php | CreateInspectTemplateRequest.setInspectTemplate | public function setInspectTemplate($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\InspectTemplate::class);
$this->inspect_template = $var;
return $this;
} | php | public function setInspectTemplate($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\InspectTemplate::class);
$this->inspect_template = $var;
return $this;
} | [
"public",
"function",
"setInspectTemplate",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dlp",
"\\",
"V2",
"\\",
"InspectTemplate",
"::",
"class",
")",
";",
"$",
"this",
"->",
"inspect_template",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | The InspectTemplate to create.
Generated from protobuf field <code>.google.privacy.dlp.v2.InspectTemplate inspect_template = 2;</code>
@param \Google\Cloud\Dlp\V2\InspectTemplate $var
@return $this | [
"The",
"InspectTemplate",
"to",
"create",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/CreateInspectTemplateRequest.php#L110-L116 | train |
googleapis/google-cloud-php | Dlp/src/V2/StorageConfig.php | StorageConfig.setDatastoreOptions | public function setDatastoreOptions($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\DatastoreOptions::class);
$this->writeOneof(2, $var);
return $this;
} | php | public function setDatastoreOptions($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\DatastoreOptions::class);
$this->writeOneof(2, $var);
return $this;
} | [
"public",
"function",
"setDatastoreOptions",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dlp",
"\\",
"V2",
"\\",
"DatastoreOptions",
"::",
"class",
")",
";",
"$",
"this",
"->",
"writeOneof",
"(",
"2",
",",
"$",
"var",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Google Cloud Datastore options specification.
Generated from protobuf field <code>.google.privacy.dlp.v2.DatastoreOptions datastore_options = 2;</code>
@param \Google\Cloud\Dlp\V2\DatastoreOptions $var
@return $this | [
"Google",
"Cloud",
"Datastore",
"options",
"specification",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/StorageConfig.php#L62-L68 | train |
googleapis/google-cloud-php | Dlp/src/V2/StorageConfig.php | StorageConfig.setCloudStorageOptions | public function setCloudStorageOptions($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\CloudStorageOptions::class);
$this->writeOneof(3, $var);
return $this;
} | php | public function setCloudStorageOptions($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\CloudStorageOptions::class);
$this->writeOneof(3, $var);
return $this;
} | [
"public",
"function",
"setCloudStorageOptions",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dlp",
"\\",
"V2",
"\\",
"CloudStorageOptions",
"::",
"class",
")",
";",
"$",
"this",
"->",
"writeOneof",
"(",
"3",
",",
"$",
"var",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Google Cloud Storage options specification.
Generated from protobuf field <code>.google.privacy.dlp.v2.CloudStorageOptions cloud_storage_options = 3;</code>
@param \Google\Cloud\Dlp\V2\CloudStorageOptions $var
@return $this | [
"Google",
"Cloud",
"Storage",
"options",
"specification",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/StorageConfig.php#L88-L94 | train |
googleapis/google-cloud-php | Dlp/src/V2/StorageConfig.php | StorageConfig.setBigQueryOptions | public function setBigQueryOptions($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\BigQueryOptions::class);
$this->writeOneof(4, $var);
return $this;
} | php | public function setBigQueryOptions($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\BigQueryOptions::class);
$this->writeOneof(4, $var);
return $this;
} | [
"public",
"function",
"setBigQueryOptions",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dlp",
"\\",
"V2",
"\\",
"BigQueryOptions",
"::",
"class",
")",
";",
"$",
"this",
"->",
"writeOneof",
"(",
"4",
",",
"$",
"var",
")",
";",
"return",
"$",
"this",
";",
"}"
] | BigQuery options specification.
Generated from protobuf field <code>.google.privacy.dlp.v2.BigQueryOptions big_query_options = 4;</code>
@param \Google\Cloud\Dlp\V2\BigQueryOptions $var
@return $this | [
"BigQuery",
"options",
"specification",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/StorageConfig.php#L114-L120 | train |
googleapis/google-cloud-php | AutoMl/src/V1beta1/ListModelsResponse.php | ListModelsResponse.setModel | public function setModel($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\AutoMl\V1beta1\Model::class);
$this->model = $arr;
return $this;
} | php | public function setModel($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\AutoMl\V1beta1\Model::class);
$this->model = $arr;
return $this;
} | [
"public",
"function",
"setModel",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"AutoMl",
"\\",
"V1beta1",
"\\",
"Model",
"::",
"class",
")",
";",
"$",
"this",
"->",
"model",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | List of models in the requested page.
Generated from protobuf field <code>repeated .google.cloud.automl.v1beta1.Model model = 1;</code>
@param \Google\Cloud\AutoMl\V1beta1\Model[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"List",
"of",
"models",
"in",
"the",
"requested",
"page",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/AutoMl/src/V1beta1/ListModelsResponse.php#L68-L74 | train |
googleapis/google-cloud-php | Trace/src/V2/StackTrace/StackFrame.php | StackFrame.setLoadModule | public function setLoadModule($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Trace\V2\Module::class);
$this->load_module = $var;
return $this;
} | php | public function setLoadModule($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Trace\V2\Module::class);
$this->load_module = $var;
return $this;
} | [
"public",
"function",
"setLoadModule",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Trace",
"\\",
"V2",
"\\",
"Module",
"::",
"class",
")",
";",
"$",
"this",
"->",
"load_module",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | The binary module from where the code was loaded.
Generated from protobuf field <code>.google.devtools.cloudtrace.v2.Module load_module = 6;</code>
@param \Google\Cloud\Trace\V2\Module $var
@return $this | [
"The",
"binary",
"module",
"from",
"where",
"the",
"code",
"was",
"loaded",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Trace/src/V2/StackTrace/StackFrame.php#L256-L262 | train |
googleapis/google-cloud-php | Dialogflow/src/V2/SynthesizeSpeechConfig.php | SynthesizeSpeechConfig.setVoice | public function setVoice($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\VoiceSelectionParams::class);
$this->voice = $var;
return $this;
} | php | public function setVoice($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\VoiceSelectionParams::class);
$this->voice = $var;
return $this;
} | [
"public",
"function",
"setVoice",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dialogflow",
"\\",
"V2",
"\\",
"VoiceSelectionParams",
"::",
"class",
")",
";",
"$",
"this",
"->",
"voice",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Optional. The desired voice of the synthesized audio.
Generated from protobuf field <code>.google.cloud.dialogflow.v2.VoiceSelectionParams voice = 4;</code>
@param \Google\Cloud\Dialogflow\V2\VoiceSelectionParams $var
@return $this | [
"Optional",
".",
"The",
"desired",
"voice",
"of",
"the",
"synthesized",
"audio",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dialogflow/src/V2/SynthesizeSpeechConfig.php#L250-L256 | train |
googleapis/google-cloud-php | AutoMl/src/V1beta1/Image.php | Image.setInputConfig | public function setInputConfig($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\AutoMl\V1beta1\InputConfig::class);
$this->writeOneof(6, $var);
return $this;
} | php | public function setInputConfig($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\AutoMl\V1beta1\InputConfig::class);
$this->writeOneof(6, $var);
return $this;
} | [
"public",
"function",
"setInputConfig",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"AutoMl",
"\\",
"V1beta1",
"\\",
"InputConfig",
"::",
"class",
")",
";",
"$",
"this",
"->",
"writeOneof",
"(",
"6",
",",
"$",
"var",
")",
";",
"return",
"$",
"this",
";",
"}"
] | An input config specifying the content of the image.
Generated from protobuf field <code>.google.cloud.automl.v1beta1.InputConfig input_config = 6;</code>
@param \Google\Cloud\AutoMl\V1beta1\InputConfig $var
@return $this | [
"An",
"input",
"config",
"specifying",
"the",
"content",
"of",
"the",
"image",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/AutoMl/src/V1beta1/Image.php#L95-L101 | train |
googleapis/google-cloud-php | Datastore/src/V1/BeginTransactionRequest.php | BeginTransactionRequest.setTransactionOptions | public function setTransactionOptions($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Datastore\V1\TransactionOptions::class);
$this->transaction_options = $var;
return $this;
} | php | public function setTransactionOptions($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Datastore\V1\TransactionOptions::class);
$this->transaction_options = $var;
return $this;
} | [
"public",
"function",
"setTransactionOptions",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Datastore",
"\\",
"V1",
"\\",
"TransactionOptions",
"::",
"class",
")",
";",
"$",
"this",
"->",
"transaction_options",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Options for a new transaction.
Generated from protobuf field <code>.google.datastore.v1.TransactionOptions transaction_options = 10;</code>
@param \Google\Cloud\Datastore\V1\TransactionOptions $var
@return $this | [
"Options",
"for",
"a",
"new",
"transaction",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Datastore/src/V1/BeginTransactionRequest.php#L93-L99 | train |
googleapis/google-cloud-php | Vision/src/V1/UpdateProductRequest.php | UpdateProductRequest.setProduct | public function setProduct($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\Product::class);
$this->product = $var;
return $this;
} | php | public function setProduct($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\Product::class);
$this->product = $var;
return $this;
} | [
"public",
"function",
"setProduct",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Vision",
"\\",
"V1",
"\\",
"Product",
"::",
"class",
")",
";",
"$",
"this",
"->",
"product",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | The Product resource which replaces the one on the server.
product.name is immutable.
Generated from protobuf field <code>.google.cloud.vision.v1.Product product = 1;</code>
@param \Google\Cloud\Vision\V1\Product $var
@return $this | [
"The",
"Product",
"resource",
"which",
"replaces",
"the",
"one",
"on",
"the",
"server",
".",
"product",
".",
"name",
"is",
"immutable",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Vision/src/V1/UpdateProductRequest.php#L78-L84 | train |
googleapis/google-cloud-php | Dlp/src/V2/BigQueryKey.php | BigQueryKey.setTableReference | public function setTableReference($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\BigQueryTable::class);
$this->table_reference = $var;
return $this;
} | php | public function setTableReference($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\BigQueryTable::class);
$this->table_reference = $var;
return $this;
} | [
"public",
"function",
"setTableReference",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dlp",
"\\",
"V2",
"\\",
"BigQueryTable",
"::",
"class",
")",
";",
"$",
"this",
"->",
"table_reference",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Complete BigQuery table reference.
Generated from protobuf field <code>.google.privacy.dlp.v2.BigQueryTable table_reference = 1;</code>
@param \Google\Cloud\Dlp\V2\BigQueryTable $var
@return $this | [
"Complete",
"BigQuery",
"table",
"reference",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/BigQueryKey.php#L68-L74 | train |
googleapis/google-cloud-php | Redis/src/V1beta1/FailoverInstanceRequest.php | FailoverInstanceRequest.setDataProtectionMode | public function setDataProtectionMode($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Redis\V1beta1\FailoverInstanceRequest_DataProtectionMode::class);
$this->data_protection_mode = $var;
return $this;
} | php | public function setDataProtectionMode($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Redis\V1beta1\FailoverInstanceRequest_DataProtectionMode::class);
$this->data_protection_mode = $var;
return $this;
} | [
"public",
"function",
"setDataProtectionMode",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Redis",
"\\",
"V1beta1",
"\\",
"FailoverInstanceRequest_DataProtectionMode",
"::",
"class",
")",
";",
"$",
"this",
"->",
"data_protection_mode",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Optional. Available data protection modes that the user can choose. If it's
unspecified, data protection mode will be LIMITED_DATA_LOSS by default.
Generated from protobuf field <code>.google.cloud.redis.v1beta1.FailoverInstanceRequest.DataProtectionMode data_protection_mode = 2;</code>
@param int $var
@return $this | [
"Optional",
".",
"Available",
"data",
"protection",
"modes",
"that",
"the",
"user",
"can",
"choose",
".",
"If",
"it",
"s",
"unspecified",
"data",
"protection",
"mode",
"will",
"be",
"LIMITED_DATA_LOSS",
"by",
"default",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Redis/src/V1beta1/FailoverInstanceRequest.php#L105-L111 | train |
googleapis/google-cloud-php | Dialogflow/src/V2/Gapic/ContextsGapicClient.php | ContextsGapicClient.contextName | public static function contextName($project, $session, $context)
{
return self::getContextNameTemplate()->render([
'project' => $project,
'session' => $session,
'context' => $context,
]);
} | php | public static function contextName($project, $session, $context)
{
return self::getContextNameTemplate()->render([
'project' => $project,
'session' => $session,
'context' => $context,
]);
} | [
"public",
"static",
"function",
"contextName",
"(",
"$",
"project",
",",
"$",
"session",
",",
"$",
"context",
")",
"{",
"return",
"self",
"::",
"getContextNameTemplate",
"(",
")",
"->",
"render",
"(",
"[",
"'project'",
"=>",
"$",
"project",
",",
"'session'",
"=>",
"$",
"session",
",",
"'context'",
"=>",
"$",
"context",
",",
"]",
")",
";",
"}"
] | Formats a string containing the fully-qualified path to represent
a context resource.
@param string $project
@param string $session
@param string $context
@return string The formatted context resource.
@experimental | [
"Formats",
"a",
"string",
"containing",
"the",
"fully",
"-",
"qualified",
"path",
"to",
"represent",
"a",
"context",
"resource",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dialogflow/src/V2/Gapic/ContextsGapicClient.php#L199-L206 | train |
googleapis/google-cloud-php | Logging/src/V2/ListMonitoredResourceDescriptorsResponse.php | ListMonitoredResourceDescriptorsResponse.setResourceDescriptors | public function setResourceDescriptors($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\MonitoredResourceDescriptor::class);
$this->resource_descriptors = $arr;
return $this;
} | php | public function setResourceDescriptors($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\MonitoredResourceDescriptor::class);
$this->resource_descriptors = $arr;
return $this;
} | [
"public",
"function",
"setResourceDescriptors",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Api",
"\\",
"MonitoredResourceDescriptor",
"::",
"class",
")",
";",
"$",
"this",
"->",
"resource_descriptors",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | A list of resource descriptors.
Generated from protobuf field <code>repeated .google.api.MonitoredResourceDescriptor resource_descriptors = 1;</code>
@param \Google\Api\MonitoredResourceDescriptor[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"A",
"list",
"of",
"resource",
"descriptors",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Logging/src/V2/ListMonitoredResourceDescriptorsResponse.php#L70-L76 | train |
googleapis/google-cloud-php | Bigtable/src/Admin/V2/Gapic/BigtableInstanceAdminGapicClient.php | BigtableInstanceAdminGapicClient.appProfileName | public static function appProfileName($project, $instance, $appProfile)
{
return self::getAppProfileNameTemplate()->render([
'project' => $project,
'instance' => $instance,
'app_profile' => $appProfile,
]);
} | php | public static function appProfileName($project, $instance, $appProfile)
{
return self::getAppProfileNameTemplate()->render([
'project' => $project,
'instance' => $instance,
'app_profile' => $appProfile,
]);
} | [
"public",
"static",
"function",
"appProfileName",
"(",
"$",
"project",
",",
"$",
"instance",
",",
"$",
"appProfile",
")",
"{",
"return",
"self",
"::",
"getAppProfileNameTemplate",
"(",
")",
"->",
"render",
"(",
"[",
"'project'",
"=>",
"$",
"project",
",",
"'instance'",
"=>",
"$",
"instance",
",",
"'app_profile'",
"=>",
"$",
"appProfile",
",",
"]",
")",
";",
"}"
] | Formats a string containing the fully-qualified path to represent
a app_profile resource.
@param string $project
@param string $instance
@param string $appProfile
@return string The formatted app_profile resource.
@experimental | [
"Formats",
"a",
"string",
"containing",
"the",
"fully",
"-",
"qualified",
"path",
"to",
"represent",
"a",
"app_profile",
"resource",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Bigtable/src/Admin/V2/Gapic/BigtableInstanceAdminGapicClient.php#L263-L270 | train |
googleapis/google-cloud-php | Bigtable/src/Admin/V2/Gapic/BigtableInstanceAdminGapicClient.php | BigtableInstanceAdminGapicClient.clusterName | public static function clusterName($project, $instance, $cluster)
{
return self::getClusterNameTemplate()->render([
'project' => $project,
'instance' => $instance,
'cluster' => $cluster,
]);
} | php | public static function clusterName($project, $instance, $cluster)
{
return self::getClusterNameTemplate()->render([
'project' => $project,
'instance' => $instance,
'cluster' => $cluster,
]);
} | [
"public",
"static",
"function",
"clusterName",
"(",
"$",
"project",
",",
"$",
"instance",
",",
"$",
"cluster",
")",
"{",
"return",
"self",
"::",
"getClusterNameTemplate",
"(",
")",
"->",
"render",
"(",
"[",
"'project'",
"=>",
"$",
"project",
",",
"'instance'",
"=>",
"$",
"instance",
",",
"'cluster'",
"=>",
"$",
"cluster",
",",
"]",
")",
";",
"}"
] | Formats a string containing the fully-qualified path to represent
a cluster resource.
@param string $project
@param string $instance
@param string $cluster
@return string The formatted cluster resource.
@experimental | [
"Formats",
"a",
"string",
"containing",
"the",
"fully",
"-",
"qualified",
"path",
"to",
"represent",
"a",
"cluster",
"resource",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Bigtable/src/Admin/V2/Gapic/BigtableInstanceAdminGapicClient.php#L283-L290 | train |
googleapis/google-cloud-php | Spanner/src/V1/PartitionResponse.php | PartitionResponse.setPartitions | public function setPartitions($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\V1\Partition::class);
$this->partitions = $arr;
return $this;
} | php | public function setPartitions($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\V1\Partition::class);
$this->partitions = $arr;
return $this;
} | [
"public",
"function",
"setPartitions",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Spanner",
"\\",
"V1",
"\\",
"Partition",
"::",
"class",
")",
";",
"$",
"this",
"->",
"partitions",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | Partitions created by this request.
Generated from protobuf field <code>repeated .google.spanner.v1.Partition partitions = 1;</code>
@param \Google\Cloud\Spanner\V1\Partition[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"Partitions",
"created",
"by",
"this",
"request",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/V1/PartitionResponse.php#L67-L73 | train |
googleapis/google-cloud-php | Spanner/src/V1/PartitionResponse.php | PartitionResponse.setTransaction | public function setTransaction($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\Transaction::class);
$this->transaction = $var;
return $this;
} | php | public function setTransaction($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\Transaction::class);
$this->transaction = $var;
return $this;
} | [
"public",
"function",
"setTransaction",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Spanner",
"\\",
"V1",
"\\",
"Transaction",
"::",
"class",
")",
";",
"$",
"this",
"->",
"transaction",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Transaction created by this request.
Generated from protobuf field <code>.google.spanner.v1.Transaction transaction = 2;</code>
@param \Google\Cloud\Spanner\V1\Transaction $var
@return $this | [
"Transaction",
"created",
"by",
"this",
"request",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/V1/PartitionResponse.php#L93-L99 | train |
googleapis/google-cloud-php | Talent/src/V4beta1/CreateApplicationRequest.php | CreateApplicationRequest.setApplication | public function setApplication($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Talent\V4beta1\Application::class);
$this->application = $var;
return $this;
} | php | public function setApplication($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Talent\V4beta1\Application::class);
$this->application = $var;
return $this;
} | [
"public",
"function",
"setApplication",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Talent",
"\\",
"V4beta1",
"\\",
"Application",
"::",
"class",
")",
";",
"$",
"this",
"->",
"application",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Required.
The application to be created.
Generated from protobuf field <code>.google.cloud.talent.v4beta1.Application application = 2;</code>
@param \Google\Cloud\Talent\V4beta1\Application $var
@return $this | [
"Required",
".",
"The",
"application",
"to",
"be",
"created",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Talent/src/V4beta1/CreateApplicationRequest.php#L112-L118 | train |
googleapis/google-cloud-php | Trace/src/TimestampTrait.php | TimestampTrait.formatDate | private function formatDate($when = null)
{
if (is_string($when)) {
return $when;
} elseif (!$when) {
list($usec, $sec) = explode(' ', microtime());
$micro = sprintf("%06d", $usec * 1000000);
$when = new \DateTime(date('Y-m-d H:i:s.' . $micro));
} elseif (is_numeric($when)) {
// Expect that this is a timestamp
$micro = sprintf("%06d", ($when - floor($when)) * 1000000);
$when = new \DateTime(date('Y-m-d H:i:s.'. $micro, (int) $when));
}
$when->setTimezone(new \DateTimeZone('UTC'));
return $when->format('Y-m-d\TH:i:s.u000\Z');
} | php | private function formatDate($when = null)
{
if (is_string($when)) {
return $when;
} elseif (!$when) {
list($usec, $sec) = explode(' ', microtime());
$micro = sprintf("%06d", $usec * 1000000);
$when = new \DateTime(date('Y-m-d H:i:s.' . $micro));
} elseif (is_numeric($when)) {
// Expect that this is a timestamp
$micro = sprintf("%06d", ($when - floor($when)) * 1000000);
$when = new \DateTime(date('Y-m-d H:i:s.'. $micro, (int) $when));
}
$when->setTimezone(new \DateTimeZone('UTC'));
return $when->format('Y-m-d\TH:i:s.u000\Z');
} | [
"private",
"function",
"formatDate",
"(",
"$",
"when",
"=",
"null",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"when",
")",
")",
"{",
"return",
"$",
"when",
";",
"}",
"elseif",
"(",
"!",
"$",
"when",
")",
"{",
"list",
"(",
"$",
"usec",
",",
"$",
"sec",
")",
"=",
"explode",
"(",
"' '",
",",
"microtime",
"(",
")",
")",
";",
"$",
"micro",
"=",
"sprintf",
"(",
"\"%06d\"",
",",
"$",
"usec",
"*",
"1000000",
")",
";",
"$",
"when",
"=",
"new",
"\\",
"DateTime",
"(",
"date",
"(",
"'Y-m-d H:i:s.'",
".",
"$",
"micro",
")",
")",
";",
"}",
"elseif",
"(",
"is_numeric",
"(",
"$",
"when",
")",
")",
"{",
"// Expect that this is a timestamp",
"$",
"micro",
"=",
"sprintf",
"(",
"\"%06d\"",
",",
"(",
"$",
"when",
"-",
"floor",
"(",
"$",
"when",
")",
")",
"*",
"1000000",
")",
";",
"$",
"when",
"=",
"new",
"\\",
"DateTime",
"(",
"date",
"(",
"'Y-m-d H:i:s.'",
".",
"$",
"micro",
",",
"(",
"int",
")",
"$",
"when",
")",
")",
";",
"}",
"$",
"when",
"->",
"setTimezone",
"(",
"new",
"\\",
"DateTimeZone",
"(",
"'UTC'",
")",
")",
";",
"return",
"$",
"when",
"->",
"format",
"(",
"'Y-m-d\\TH:i:s.u000\\Z'",
")",
";",
"}"
] | Returns a "Zulu" formatted string representing the provided \DateTime.
@param \DateTimeInterface|int|float|string $when [optional] The end time of this span.
**Defaults to** now. If provided as a string, it must be in "Zulu" format.
If provided as an int or float, it is expected to be a Unix timestamp.
@return string | [
"Returns",
"a",
"Zulu",
"formatted",
"string",
"representing",
"the",
"provided",
"\\",
"DateTime",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Trace/src/TimestampTrait.php#L33-L48 | train |
googleapis/google-cloud-php | AutoMl/src/V1beta1/CreateDatasetRequest.php | CreateDatasetRequest.setDataset | public function setDataset($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\AutoMl\V1beta1\Dataset::class);
$this->dataset = $var;
return $this;
} | php | public function setDataset($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\AutoMl\V1beta1\Dataset::class);
$this->dataset = $var;
return $this;
} | [
"public",
"function",
"setDataset",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"AutoMl",
"\\",
"V1beta1",
"\\",
"Dataset",
"::",
"class",
")",
";",
"$",
"this",
"->",
"dataset",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | The dataset to create.
Generated from protobuf field <code>.google.cloud.automl.v1beta1.Dataset dataset = 2;</code>
@param \Google\Cloud\AutoMl\V1beta1\Dataset $var
@return $this | [
"The",
"dataset",
"to",
"create",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/AutoMl/src/V1beta1/CreateDatasetRequest.php#L92-L98 | train |
googleapis/google-cloud-php | Redis/src/V1beta1/Instance.php | Instance.setState | public function setState($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Redis\V1beta1\Instance_State::class);
$this->state = $var;
return $this;
} | php | public function setState($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Redis\V1beta1\Instance_State::class);
$this->state = $var;
return $this;
} | [
"public",
"function",
"setState",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Redis",
"\\",
"V1beta1",
"\\",
"Instance_State",
"::",
"class",
")",
";",
"$",
"this",
"->",
"state",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Output only. The current state of this instance.
Generated from protobuf field <code>.google.cloud.redis.v1beta1.Instance.State state = 14;</code>
@param int $var
@return $this | [
"Output",
"only",
".",
"The",
"current",
"state",
"of",
"this",
"instance",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Redis/src/V1beta1/Instance.php#L602-L608 | train |
googleapis/google-cloud-php | Redis/src/V1beta1/Instance.php | Instance.setTier | public function setTier($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Redis\V1beta1\Instance_Tier::class);
$this->tier = $var;
return $this;
} | php | public function setTier($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Redis\V1beta1\Instance_Tier::class);
$this->tier = $var;
return $this;
} | [
"public",
"function",
"setTier",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Redis",
"\\",
"V1beta1",
"\\",
"Instance_Tier",
"::",
"class",
")",
";",
"$",
"this",
"->",
"tier",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Required. The service tier of the instance.
Generated from protobuf field <code>.google.cloud.redis.v1beta1.Instance.Tier tier = 17;</code>
@param int $var
@return $this | [
"Required",
".",
"The",
"service",
"tier",
"of",
"the",
"instance",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Redis/src/V1beta1/Instance.php#L700-L706 | train |
googleapis/google-cloud-php | Dialogflow/src/V2/Intent/Message/ListSelect/Item.php | Item.setInfo | public function setInfo($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\Intent_Message_SelectItemInfo::class);
$this->info = $var;
return $this;
} | php | public function setInfo($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\Intent_Message_SelectItemInfo::class);
$this->info = $var;
return $this;
} | [
"public",
"function",
"setInfo",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dialogflow",
"\\",
"V2",
"\\",
"Intent_Message_SelectItemInfo",
"::",
"class",
")",
";",
"$",
"this",
"->",
"info",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Required. Additional information about this option.
Generated from protobuf field <code>.google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo info = 1;</code>
@param \Google\Cloud\Dialogflow\V2\Intent\Message\SelectItemInfo $var
@return $this | [
"Required",
".",
"Additional",
"information",
"about",
"this",
"option",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dialogflow/src/V2/Intent/Message/ListSelect/Item.php#L82-L88 | train |
googleapis/google-cloud-php | Dialogflow/src/V2/Intent/Message/ListSelect/Item.php | Item.setImage | public function setImage($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\Intent_Message_Image::class);
$this->image = $var;
return $this;
} | php | public function setImage($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\Intent_Message_Image::class);
$this->image = $var;
return $this;
} | [
"public",
"function",
"setImage",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dialogflow",
"\\",
"V2",
"\\",
"Intent_Message_Image",
"::",
"class",
")",
";",
"$",
"this",
"->",
"image",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Optional. The image to display.
Generated from protobuf field <code>.google.cloud.dialogflow.v2.Intent.Message.Image image = 4;</code>
@param \Google\Cloud\Dialogflow\V2\Intent\Message\Image $var
@return $this | [
"Optional",
".",
"The",
"image",
"to",
"display",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dialogflow/src/V2/Intent/Message/ListSelect/Item.php#L160-L166 | train |
googleapis/google-cloud-php | Talent/src/V4beta1/JobQuery.php | JobQuery.setPublishTimeRange | public function setPublishTimeRange($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Talent\V4beta1\TimestampRange::class);
$this->publish_time_range = $var;
return $this;
} | php | public function setPublishTimeRange($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Talent\V4beta1\TimestampRange::class);
$this->publish_time_range = $var;
return $this;
} | [
"public",
"function",
"setPublishTimeRange",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Talent",
"\\",
"V4beta1",
"\\",
"TimestampRange",
"::",
"class",
")",
";",
"$",
"this",
"->",
"publish_time_range",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Optional.
Jobs published within a range specified by this filter are searched
against.
Generated from protobuf field <code>.google.cloud.talent.v4beta1.TimestampRange publish_time_range = 12;</code>
@param \Google\Cloud\Talent\V4beta1\TimestampRange $var
@return $this | [
"Optional",
".",
"Jobs",
"published",
"within",
"a",
"range",
"specified",
"by",
"this",
"filter",
"are",
"searched",
"against",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Talent/src/V4beta1/JobQuery.php#L789-L795 | train |
googleapis/google-cloud-php | Talent/src/V4beta1/JobQuery.php | JobQuery.setExcludedJobs | public function setExcludedJobs($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->excluded_jobs = $arr;
return $this;
} | php | public function setExcludedJobs($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->excluded_jobs = $arr;
return $this;
} | [
"public",
"function",
"setExcludedJobs",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"STRING",
")",
";",
"$",
"this",
"->",
"excluded_jobs",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | Optional.
This filter specifies a list of job names to be excluded during search.
At most 200 excluded job names are allowed.
Generated from protobuf field <code>repeated string excluded_jobs = 13;</code>
@param string[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"Optional",
".",
"This",
"filter",
"specifies",
"a",
"list",
"of",
"job",
"names",
"to",
"be",
"excluded",
"during",
"search",
".",
"At",
"most",
"200",
"excluded",
"job",
"names",
"are",
"allowed",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Talent/src/V4beta1/JobQuery.php#L819-L825 | train |
googleapis/google-cloud-php | Talent/src/V4beta1/ListJobsResponse.php | ListJobsResponse.setJobs | public function setJobs($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Talent\V4beta1\Job::class);
$this->jobs = $arr;
return $this;
} | php | public function setJobs($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Talent\V4beta1\Job::class);
$this->jobs = $arr;
return $this;
} | [
"public",
"function",
"setJobs",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Talent",
"\\",
"V4beta1",
"\\",
"Job",
"::",
"class",
")",
";",
"$",
"this",
"->",
"jobs",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | The Jobs for a given company.
The maximum number of items returned is based on the limit field
provided in the request.
Generated from protobuf field <code>repeated .google.cloud.talent.v4beta1.Job jobs = 1;</code>
@param \Google\Cloud\Talent\V4beta1\Job[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"The",
"Jobs",
"for",
"a",
"given",
"company",
".",
"The",
"maximum",
"number",
"of",
"items",
"returned",
"is",
"based",
"on",
"the",
"limit",
"field",
"provided",
"in",
"the",
"request",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Talent/src/V4beta1/ListJobsResponse.php#L85-L91 | train |
googleapis/google-cloud-php | Talent/src/V4beta1/ListJobsResponse.php | ListJobsResponse.setMetadata | public function setMetadata($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Talent\V4beta1\ResponseMetadata::class);
$this->metadata = $var;
return $this;
} | php | public function setMetadata($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Talent\V4beta1\ResponseMetadata::class);
$this->metadata = $var;
return $this;
} | [
"public",
"function",
"setMetadata",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Talent",
"\\",
"V4beta1",
"\\",
"ResponseMetadata",
"::",
"class",
")",
";",
"$",
"this",
"->",
"metadata",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Additional information for the API invocation, such as the request
tracking id.
Generated from protobuf field <code>.google.cloud.talent.v4beta1.ResponseMetadata metadata = 3;</code>
@param \Google\Cloud\Talent\V4beta1\ResponseMetadata $var
@return $this | [
"Additional",
"information",
"for",
"the",
"API",
"invocation",
"such",
"as",
"the",
"request",
"tracking",
"id",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Talent/src/V4beta1/ListJobsResponse.php#L139-L145 | train |
googleapis/google-cloud-php | Dlp/src/V2/Action.php | Action.setSaveFindings | public function setSaveFindings($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\Action_SaveFindings::class);
$this->writeOneof(1, $var);
return $this;
} | php | public function setSaveFindings($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\Action_SaveFindings::class);
$this->writeOneof(1, $var);
return $this;
} | [
"public",
"function",
"setSaveFindings",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dlp",
"\\",
"V2",
"\\",
"Action_SaveFindings",
"::",
"class",
")",
";",
"$",
"this",
"->",
"writeOneof",
"(",
"1",
",",
"$",
"var",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Save resulting findings in a provided location.
Generated from protobuf field <code>.google.privacy.dlp.v2.Action.SaveFindings save_findings = 1;</code>
@param \Google\Cloud\Dlp\V2\Action\SaveFindings $var
@return $this | [
"Save",
"resulting",
"findings",
"in",
"a",
"provided",
"location",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/Action.php#L61-L67 | train |
googleapis/google-cloud-php | Dlp/src/V2/Action.php | Action.setPubSub | public function setPubSub($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\Action_PublishToPubSub::class);
$this->writeOneof(2, $var);
return $this;
} | php | public function setPubSub($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\Action_PublishToPubSub::class);
$this->writeOneof(2, $var);
return $this;
} | [
"public",
"function",
"setPubSub",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dlp",
"\\",
"V2",
"\\",
"Action_PublishToPubSub",
"::",
"class",
")",
";",
"$",
"this",
"->",
"writeOneof",
"(",
"2",
",",
"$",
"var",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Publish a notification to a pubsub topic.
Generated from protobuf field <code>.google.privacy.dlp.v2.Action.PublishToPubSub pub_sub = 2;</code>
@param \Google\Cloud\Dlp\V2\Action\PublishToPubSub $var
@return $this | [
"Publish",
"a",
"notification",
"to",
"a",
"pubsub",
"topic",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/Action.php#L87-L93 | train |
googleapis/google-cloud-php | Asset/src/V1/TemporalAsset.php | TemporalAsset.setWindow | public function setWindow($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Asset\V1\TimeWindow::class);
$this->window = $var;
return $this;
} | php | public function setWindow($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Asset\V1\TimeWindow::class);
$this->window = $var;
return $this;
} | [
"public",
"function",
"setWindow",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Asset",
"\\",
"V1",
"\\",
"TimeWindow",
"::",
"class",
")",
";",
"$",
"this",
"->",
"window",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | The time window when the asset data and state was observed.
Generated from protobuf field <code>.google.cloud.asset.v1.TimeWindow window = 1;</code>
@param \Google\Cloud\Asset\V1\TimeWindow $var
@return $this | [
"The",
"time",
"window",
"when",
"the",
"asset",
"data",
"and",
"state",
"was",
"observed",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Asset/src/V1/TemporalAsset.php#L75-L81 | train |
googleapis/google-cloud-php | dev/src/Split/GitHub.php | GitHub.doesTagExist | public function doesTagExist($target, $tagName)
{
$res = $this->client->get(sprintf(
self::GITHUB_RELEASES_ENDPOINT,
$this->cleanTarget($target), $tagName
), [
'http_errors' => false,
'auth' => [null, $this->token]
]);
return ($res->getStatusCode() === 200);
} | php | public function doesTagExist($target, $tagName)
{
$res = $this->client->get(sprintf(
self::GITHUB_RELEASES_ENDPOINT,
$this->cleanTarget($target), $tagName
), [
'http_errors' => false,
'auth' => [null, $this->token]
]);
return ($res->getStatusCode() === 200);
} | [
"public",
"function",
"doesTagExist",
"(",
"$",
"target",
",",
"$",
"tagName",
")",
"{",
"$",
"res",
"=",
"$",
"this",
"->",
"client",
"->",
"get",
"(",
"sprintf",
"(",
"self",
"::",
"GITHUB_RELEASES_ENDPOINT",
",",
"$",
"this",
"->",
"cleanTarget",
"(",
"$",
"target",
")",
",",
"$",
"tagName",
")",
",",
"[",
"'http_errors'",
"=>",
"false",
",",
"'auth'",
"=>",
"[",
"null",
",",
"$",
"this",
"->",
"token",
"]",
"]",
")",
";",
"return",
"(",
"$",
"res",
"->",
"getStatusCode",
"(",
")",
"===",
"200",
")",
";",
"}"
] | Check if a given tag exists on a given GitHub repository.
@param string $target The GitHub organization and repository ID separated
by a forward slash, i.e. `organization/repository'.
@param string $tagName The tag to check.
@return bool | [
"Check",
"if",
"a",
"given",
"tag",
"exists",
"on",
"a",
"given",
"GitHub",
"repository",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/dev/src/Split/GitHub.php#L62-L73 | train |
googleapis/google-cloud-php | dev/src/Split/GitHub.php | GitHub.createRelease | public function createRelease($target, $tagName, $display, $notes)
{
$requestBody = [
'tag_name' => $tagName,
'name' => $display,
'body' => $notes
];
$res = $this->client->post(sprintf(
self::GITHUB_RELEASE_CREATE_ENDPOINT,
$this->cleanTarget($target)
), [
'http_errors' => false,
'json' => $requestBody,
'auth' => [null, $this->token]
]);
return $this->doesTagExist($target, $tagName);
} | php | public function createRelease($target, $tagName, $display, $notes)
{
$requestBody = [
'tag_name' => $tagName,
'name' => $display,
'body' => $notes
];
$res = $this->client->post(sprintf(
self::GITHUB_RELEASE_CREATE_ENDPOINT,
$this->cleanTarget($target)
), [
'http_errors' => false,
'json' => $requestBody,
'auth' => [null, $this->token]
]);
return $this->doesTagExist($target, $tagName);
} | [
"public",
"function",
"createRelease",
"(",
"$",
"target",
",",
"$",
"tagName",
",",
"$",
"display",
",",
"$",
"notes",
")",
"{",
"$",
"requestBody",
"=",
"[",
"'tag_name'",
"=>",
"$",
"tagName",
",",
"'name'",
"=>",
"$",
"display",
",",
"'body'",
"=>",
"$",
"notes",
"]",
";",
"$",
"res",
"=",
"$",
"this",
"->",
"client",
"->",
"post",
"(",
"sprintf",
"(",
"self",
"::",
"GITHUB_RELEASE_CREATE_ENDPOINT",
",",
"$",
"this",
"->",
"cleanTarget",
"(",
"$",
"target",
")",
")",
",",
"[",
"'http_errors'",
"=>",
"false",
",",
"'json'",
"=>",
"$",
"requestBody",
",",
"'auth'",
"=>",
"[",
"null",
",",
"$",
"this",
"->",
"token",
"]",
"]",
")",
";",
"return",
"$",
"this",
"->",
"doesTagExist",
"(",
"$",
"target",
",",
"$",
"tagName",
")",
";",
"}"
] | Create a tag on the given GitHub repository and sends a request to verify.
@param string $target The GitHub organization and repository ID separated
by a forward slash, i.e. `organization/repository'.
@param string $tagName The name of the tag to create.
@param string $display The tag display name.
@param string $notes The tag release notes.
@return bool True if successful, false if failed. | [
"Create",
"a",
"tag",
"on",
"the",
"given",
"GitHub",
"repository",
"and",
"sends",
"a",
"request",
"to",
"verify",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/dev/src/Split/GitHub.php#L85-L103 | train |
googleapis/google-cloud-php | dev/src/Split/GitHub.php | GitHub.push | public function push($target, $ref, $targetBranch = 'master', $force = true)
{
$cmd = [
'git push -q',
sprintf('https://%s@github.com/%s', $this->token, $target),
sprintf('%s:%s', $ref, $targetBranch)
];
if ($force) {
$cmd[] = '--force';
}
return $this->shell->execute(implode(' ' , $cmd));
} | php | public function push($target, $ref, $targetBranch = 'master', $force = true)
{
$cmd = [
'git push -q',
sprintf('https://%s@github.com/%s', $this->token, $target),
sprintf('%s:%s', $ref, $targetBranch)
];
if ($force) {
$cmd[] = '--force';
}
return $this->shell->execute(implode(' ' , $cmd));
} | [
"public",
"function",
"push",
"(",
"$",
"target",
",",
"$",
"ref",
",",
"$",
"targetBranch",
"=",
"'master'",
",",
"$",
"force",
"=",
"true",
")",
"{",
"$",
"cmd",
"=",
"[",
"'git push -q'",
",",
"sprintf",
"(",
"'https://%s@github.com/%s'",
",",
"$",
"this",
"->",
"token",
",",
"$",
"target",
")",
",",
"sprintf",
"(",
"'%s:%s'",
",",
"$",
"ref",
",",
"$",
"targetBranch",
")",
"]",
";",
"if",
"(",
"$",
"force",
")",
"{",
"$",
"cmd",
"[",
"]",
"=",
"'--force'",
";",
"}",
"return",
"$",
"this",
"->",
"shell",
"->",
"execute",
"(",
"implode",
"(",
"' '",
",",
"$",
"cmd",
")",
")",
";",
"}"
] | Push a given commit ref to GitHub.
@param string $target The GitHub organization and repository ID separated
by a forward slash, i.e. `organization/repository'.
@param string $ref The commit reference.
@param string $targetBranch The remote branch to push to. **Defaults to**
`master`.
@param bool $force If true, will use `--force` flag. **Defaults to**
`true`.
@return array A list containing [(bool) $success, (string) $output]. | [
"Push",
"a",
"given",
"commit",
"ref",
"to",
"GitHub",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/dev/src/Split/GitHub.php#L117-L130 | train |
googleapis/google-cloud-php | Monitoring/src/V3/AlertPolicy.php | AlertPolicy.setDocumentation | public function setDocumentation($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\AlertPolicy_Documentation::class);
$this->documentation = $var;
return $this;
} | php | public function setDocumentation($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\AlertPolicy_Documentation::class);
$this->documentation = $var;
return $this;
} | [
"public",
"function",
"setDocumentation",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Monitoring",
"\\",
"V3",
"\\",
"AlertPolicy_Documentation",
"::",
"class",
")",
";",
"$",
"this",
"->",
"documentation",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Documentation that is included with notifications and incidents related to
this policy. Best practice is for the documentation to include information
to help responders understand, mitigate, escalate, and correct the
underlying problems detected by the alerting policy. Notification channels
that have limited capacity might not show this documentation.
Generated from protobuf field <code>.google.monitoring.v3.AlertPolicy.Documentation documentation = 13;</code>
@param \Google\Cloud\Monitoring\V3\AlertPolicy\Documentation $var
@return $this | [
"Documentation",
"that",
"is",
"included",
"with",
"notifications",
"and",
"incidents",
"related",
"to",
"this",
"policy",
".",
"Best",
"practice",
"is",
"for",
"the",
"documentation",
"to",
"include",
"information",
"to",
"help",
"responders",
"understand",
"mitigate",
"escalate",
"and",
"correct",
"the",
"underlying",
"problems",
"detected",
"by",
"the",
"alerting",
"policy",
".",
"Notification",
"channels",
"that",
"have",
"limited",
"capacity",
"might",
"not",
"show",
"this",
"documentation",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Monitoring/src/V3/AlertPolicy.php#L287-L293 | train |
googleapis/google-cloud-php | Monitoring/src/V3/AlertPolicy.php | AlertPolicy.setConditions | public function setConditions($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Monitoring\V3\AlertPolicy\Condition::class);
$this->conditions = $arr;
return $this;
} | php | public function setConditions($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Monitoring\V3\AlertPolicy\Condition::class);
$this->conditions = $arr;
return $this;
} | [
"public",
"function",
"setConditions",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Monitoring",
"\\",
"V3",
"\\",
"AlertPolicy",
"\\",
"Condition",
"::",
"class",
")",
";",
"$",
"this",
"->",
"conditions",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | A list of conditions for the policy. The conditions are combined by AND or
OR according to the `combiner` field. If the combined conditions evaluate
to true, then an incident is created. A policy can have from one to six
conditions.
Generated from protobuf field <code>repeated .google.monitoring.v3.AlertPolicy.Condition conditions = 12;</code>
@param \Google\Cloud\Monitoring\V3\AlertPolicy\Condition[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"A",
"list",
"of",
"conditions",
"for",
"the",
"policy",
".",
"The",
"conditions",
"are",
"combined",
"by",
"AND",
"or",
"OR",
"according",
"to",
"the",
"combiner",
"field",
".",
"If",
"the",
"combined",
"conditions",
"evaluate",
"to",
"true",
"then",
"an",
"incident",
"is",
"created",
".",
"A",
"policy",
"can",
"have",
"from",
"one",
"to",
"six",
"conditions",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Monitoring/src/V3/AlertPolicy.php#L355-L361 | train |
googleapis/google-cloud-php | Monitoring/src/V3/AlertPolicy.php | AlertPolicy.setCombiner | public function setCombiner($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Monitoring\V3\AlertPolicy_ConditionCombinerType::class);
$this->combiner = $var;
return $this;
} | php | public function setCombiner($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Monitoring\V3\AlertPolicy_ConditionCombinerType::class);
$this->combiner = $var;
return $this;
} | [
"public",
"function",
"setCombiner",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Monitoring",
"\\",
"V3",
"\\",
"AlertPolicy_ConditionCombinerType",
"::",
"class",
")",
";",
"$",
"this",
"->",
"combiner",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | How to combine the results of multiple conditions
to determine if an incident should be opened.
Generated from protobuf field <code>.google.monitoring.v3.AlertPolicy.ConditionCombinerType combiner = 6;</code>
@param int $var
@return $this | [
"How",
"to",
"combine",
"the",
"results",
"of",
"multiple",
"conditions",
"to",
"determine",
"if",
"an",
"incident",
"should",
"be",
"opened",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Monitoring/src/V3/AlertPolicy.php#L383-L389 | train |
googleapis/google-cloud-php | Monitoring/src/V3/AlertPolicy.php | AlertPolicy.setCreationRecord | public function setCreationRecord($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\MutationRecord::class);
$this->creation_record = $var;
return $this;
} | php | public function setCreationRecord($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\MutationRecord::class);
$this->creation_record = $var;
return $this;
} | [
"public",
"function",
"setCreationRecord",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Monitoring",
"\\",
"V3",
"\\",
"MutationRecord",
"::",
"class",
")",
";",
"$",
"this",
"->",
"creation_record",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | A read-only record of the creation of the alerting policy. If provided
in a call to create or update, this field will be ignored.
Generated from protobuf field <code>.google.monitoring.v3.MutationRecord creation_record = 10;</code>
@param \Google\Cloud\Monitoring\V3\MutationRecord $var
@return $this | [
"A",
"read",
"-",
"only",
"record",
"of",
"the",
"creation",
"of",
"the",
"alerting",
"policy",
".",
"If",
"provided",
"in",
"a",
"call",
"to",
"create",
"or",
"update",
"this",
"field",
"will",
"be",
"ignored",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Monitoring/src/V3/AlertPolicy.php#L524-L530 | train |
googleapis/google-cloud-php | Monitoring/src/V3/AlertPolicy.php | AlertPolicy.setMutationRecord | public function setMutationRecord($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\MutationRecord::class);
$this->mutation_record = $var;
return $this;
} | php | public function setMutationRecord($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\MutationRecord::class);
$this->mutation_record = $var;
return $this;
} | [
"public",
"function",
"setMutationRecord",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Monitoring",
"\\",
"V3",
"\\",
"MutationRecord",
"::",
"class",
")",
";",
"$",
"this",
"->",
"mutation_record",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | A read-only record of the most recent change to the alerting policy. If
provided in a call to create or update, this field will be ignored.
Generated from protobuf field <code>.google.monitoring.v3.MutationRecord mutation_record = 11;</code>
@param \Google\Cloud\Monitoring\V3\MutationRecord $var
@return $this | [
"A",
"read",
"-",
"only",
"record",
"of",
"the",
"most",
"recent",
"change",
"to",
"the",
"alerting",
"policy",
".",
"If",
"provided",
"in",
"a",
"call",
"to",
"create",
"or",
"update",
"this",
"field",
"will",
"be",
"ignored",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Monitoring/src/V3/AlertPolicy.php#L552-L558 | train |
googleapis/google-cloud-php | Language/src/V1/AnnotateTextRequest.php | AnnotateTextRequest.setDocument | public function setDocument($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Language\V1\Document::class);
$this->document = $var;
return $this;
} | php | public function setDocument($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Language\V1\Document::class);
$this->document = $var;
return $this;
} | [
"public",
"function",
"setDocument",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Language",
"\\",
"V1",
"\\",
"Document",
"::",
"class",
")",
";",
"$",
"this",
"->",
"document",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Input document.
Generated from protobuf field <code>.google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED];</code>
@param \Google\Cloud\Language\V1\Document $var
@return $this | [
"Input",
"document",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Language/src/V1/AnnotateTextRequest.php#L75-L81 | train |
googleapis/google-cloud-php | Language/src/V1/AnnotateTextRequest.php | AnnotateTextRequest.setFeatures | public function setFeatures($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Language\V1\AnnotateTextRequest_Features::class);
$this->features = $var;
return $this;
} | php | public function setFeatures($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Language\V1\AnnotateTextRequest_Features::class);
$this->features = $var;
return $this;
} | [
"public",
"function",
"setFeatures",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Language",
"\\",
"V1",
"\\",
"AnnotateTextRequest_Features",
"::",
"class",
")",
";",
"$",
"this",
"->",
"features",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | The enabled features.
Generated from protobuf field <code>.google.cloud.language.v1.AnnotateTextRequest.Features features = 2 [(.google.api.field_behavior) = REQUIRED];</code>
@param \Google\Cloud\Language\V1\AnnotateTextRequest\Features $var
@return $this | [
"The",
"enabled",
"features",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Language/src/V1/AnnotateTextRequest.php#L101-L107 | train |
googleapis/google-cloud-php | Language/src/V1/AnnotateTextRequest.php | AnnotateTextRequest.setEncodingType | public function setEncodingType($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Language\V1\EncodingType::class);
$this->encoding_type = $var;
return $this;
} | php | public function setEncodingType($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Language\V1\EncodingType::class);
$this->encoding_type = $var;
return $this;
} | [
"public",
"function",
"setEncodingType",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Language",
"\\",
"V1",
"\\",
"EncodingType",
"::",
"class",
")",
";",
"$",
"this",
"->",
"encoding_type",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | The encoding type used by the API to calculate offsets.
Generated from protobuf field <code>.google.cloud.language.v1.EncodingType encoding_type = 3;</code>
@param int $var
@return $this | [
"The",
"encoding",
"type",
"used",
"by",
"the",
"API",
"to",
"calculate",
"offsets",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Language/src/V1/AnnotateTextRequest.php#L127-L133 | train |
googleapis/google-cloud-php | Spanner/src/TransactionConfigurationTrait.php | TransactionConfigurationTrait.transactionSelector | private function transactionSelector(array &$options, array $previous = [])
{
$options += [
'begin' => false,
'transactionType' => SessionPoolInterface::CONTEXT_READ,
];
$res = $this->transactionOptions($options, $previous);
// TransactionSelector uses a different key name for singleUseTransaction
// and transactionId than transactionOptions, so we'll rewrite those here
// so transactionOptions works as expected for commitRequest.
$type = $res[1];
if ($type === 'singleUseTransaction') {
$type = 'singleUse';
} elseif ($type === 'transactionId') {
$type = 'id';
}
return [
[$type => $res[0]],
$res[2]
];
} | php | private function transactionSelector(array &$options, array $previous = [])
{
$options += [
'begin' => false,
'transactionType' => SessionPoolInterface::CONTEXT_READ,
];
$res = $this->transactionOptions($options, $previous);
// TransactionSelector uses a different key name for singleUseTransaction
// and transactionId than transactionOptions, so we'll rewrite those here
// so transactionOptions works as expected for commitRequest.
$type = $res[1];
if ($type === 'singleUseTransaction') {
$type = 'singleUse';
} elseif ($type === 'transactionId') {
$type = 'id';
}
return [
[$type => $res[0]],
$res[2]
];
} | [
"private",
"function",
"transactionSelector",
"(",
"array",
"&",
"$",
"options",
",",
"array",
"$",
"previous",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"+=",
"[",
"'begin'",
"=>",
"false",
",",
"'transactionType'",
"=>",
"SessionPoolInterface",
"::",
"CONTEXT_READ",
",",
"]",
";",
"$",
"res",
"=",
"$",
"this",
"->",
"transactionOptions",
"(",
"$",
"options",
",",
"$",
"previous",
")",
";",
"// TransactionSelector uses a different key name for singleUseTransaction",
"// and transactionId than transactionOptions, so we'll rewrite those here",
"// so transactionOptions works as expected for commitRequest.",
"$",
"type",
"=",
"$",
"res",
"[",
"1",
"]",
";",
"if",
"(",
"$",
"type",
"===",
"'singleUseTransaction'",
")",
"{",
"$",
"type",
"=",
"'singleUse'",
";",
"}",
"elseif",
"(",
"$",
"type",
"===",
"'transactionId'",
")",
"{",
"$",
"type",
"=",
"'id'",
";",
"}",
"return",
"[",
"[",
"$",
"type",
"=>",
"$",
"res",
"[",
"0",
"]",
"]",
",",
"$",
"res",
"[",
"2",
"]",
"]",
";",
"}"
] | Format a transaction from read or execute.
Depending on given options, can be singleUse or begin, and can be read
or read/write.
@param array $options call options.
@param array $previous Previously given call options (for single-use snapshots).
@return array [(array) transaction selector, (string) context] | [
"Format",
"a",
"transaction",
"from",
"read",
"or",
"execute",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/TransactionConfigurationTrait.php#L40-L64 | train |
googleapis/google-cloud-php | Spanner/src/TransactionConfigurationTrait.php | TransactionConfigurationTrait.transactionOptions | private function transactionOptions(array &$options, array $previous = [])
{
$options += [
'begin' => false,
'transactionType' => SessionPoolInterface::CONTEXT_READWRITE,
'transactionId' => null,
];
$type = null;
$context = $this->pluck('transactionType', $options);
$id = $this->pluck('transactionId', $options);
$begin = $this->pluck('begin', $options);
if ($id === null) {
if ($begin) {
$type = 'begin';
} else {
$type = 'singleUseTransaction';
$options['singleUse'] = true;
}
}
if ($id !== null) {
$type = 'transactionId';
$transactionOptions = $id;
} elseif ($context === SessionPoolInterface::CONTEXT_READ) {
$transactionOptions = $this->configureSnapshotOptions($options, $previous);
} elseif ($context === SessionPoolInterface::CONTEXT_READWRITE) {
$transactionOptions = $this->configureTransactionOptions();
} else {
throw new \BadMethodCallException(sprintf(
'Invalid transaction context %s',
$context
));
}
return [$transactionOptions, $type, $context];
} | php | private function transactionOptions(array &$options, array $previous = [])
{
$options += [
'begin' => false,
'transactionType' => SessionPoolInterface::CONTEXT_READWRITE,
'transactionId' => null,
];
$type = null;
$context = $this->pluck('transactionType', $options);
$id = $this->pluck('transactionId', $options);
$begin = $this->pluck('begin', $options);
if ($id === null) {
if ($begin) {
$type = 'begin';
} else {
$type = 'singleUseTransaction';
$options['singleUse'] = true;
}
}
if ($id !== null) {
$type = 'transactionId';
$transactionOptions = $id;
} elseif ($context === SessionPoolInterface::CONTEXT_READ) {
$transactionOptions = $this->configureSnapshotOptions($options, $previous);
} elseif ($context === SessionPoolInterface::CONTEXT_READWRITE) {
$transactionOptions = $this->configureTransactionOptions();
} else {
throw new \BadMethodCallException(sprintf(
'Invalid transaction context %s',
$context
));
}
return [$transactionOptions, $type, $context];
} | [
"private",
"function",
"transactionOptions",
"(",
"array",
"&",
"$",
"options",
",",
"array",
"$",
"previous",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"+=",
"[",
"'begin'",
"=>",
"false",
",",
"'transactionType'",
"=>",
"SessionPoolInterface",
"::",
"CONTEXT_READWRITE",
",",
"'transactionId'",
"=>",
"null",
",",
"]",
";",
"$",
"type",
"=",
"null",
";",
"$",
"context",
"=",
"$",
"this",
"->",
"pluck",
"(",
"'transactionType'",
",",
"$",
"options",
")",
";",
"$",
"id",
"=",
"$",
"this",
"->",
"pluck",
"(",
"'transactionId'",
",",
"$",
"options",
")",
";",
"$",
"begin",
"=",
"$",
"this",
"->",
"pluck",
"(",
"'begin'",
",",
"$",
"options",
")",
";",
"if",
"(",
"$",
"id",
"===",
"null",
")",
"{",
"if",
"(",
"$",
"begin",
")",
"{",
"$",
"type",
"=",
"'begin'",
";",
"}",
"else",
"{",
"$",
"type",
"=",
"'singleUseTransaction'",
";",
"$",
"options",
"[",
"'singleUse'",
"]",
"=",
"true",
";",
"}",
"}",
"if",
"(",
"$",
"id",
"!==",
"null",
")",
"{",
"$",
"type",
"=",
"'transactionId'",
";",
"$",
"transactionOptions",
"=",
"$",
"id",
";",
"}",
"elseif",
"(",
"$",
"context",
"===",
"SessionPoolInterface",
"::",
"CONTEXT_READ",
")",
"{",
"$",
"transactionOptions",
"=",
"$",
"this",
"->",
"configureSnapshotOptions",
"(",
"$",
"options",
",",
"$",
"previous",
")",
";",
"}",
"elseif",
"(",
"$",
"context",
"===",
"SessionPoolInterface",
"::",
"CONTEXT_READWRITE",
")",
"{",
"$",
"transactionOptions",
"=",
"$",
"this",
"->",
"configureTransactionOptions",
"(",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"\\",
"BadMethodCallException",
"(",
"sprintf",
"(",
"'Invalid transaction context %s'",
",",
"$",
"context",
")",
")",
";",
"}",
"return",
"[",
"$",
"transactionOptions",
",",
"$",
"type",
",",
"$",
"context",
"]",
";",
"}"
] | Return transaction options based on given configuration options.
@param array $options call options.
@param array $previous Previously given call options (for single-use snapshots).
@return array [(array) transaction options, (string) transaction type, (string) context] | [
"Return",
"transaction",
"options",
"based",
"on",
"given",
"configuration",
"options",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/TransactionConfigurationTrait.php#L73-L111 | train |
googleapis/google-cloud-php | Spanner/src/TransactionConfigurationTrait.php | TransactionConfigurationTrait.configureSnapshotOptions | private function configureSnapshotOptions(array &$options, array $previous = [])
{
$options += [
'singleUse' => false,
'returnReadTimestamp' => null,
'strong' => null,
'readTimestamp' => null,
'exactStaleness' => null,
'minReadTimestamp' => null,
'maxStaleness' => null,
];
$previousOptions = isset($previous['transactionOptions']['readOnly'])
? $previous['transactionOptions']['readOnly']
: [];
// These are only available in single-use transactions.
if (!$options['singleUse'] && ($options['maxStaleness'] || $options['minReadTimestamp'])) {
throw new \BadMethodCallException(
'maxStaleness and minReadTimestamp are only available in single-use transactions.'
);
}
$transactionOptions = [
'readOnly' => $this->arrayFilterRemoveNull([
'returnReadTimestamp' => $this->pluck('returnReadTimestamp', $options),
'strong' => $this->pluck('strong', $options),
'minReadTimestamp' => $this->pluck('minReadTimestamp', $options),
'maxStaleness' => $this->pluck('maxStaleness', $options),
'readTimestamp' => $this->pluck('readTimestamp', $options),
'exactStaleness' => $this->pluck('exactStaleness', $options),
]) + $previousOptions
];
if (empty($transactionOptions['readOnly'])) {
$transactionOptions['readOnly']['strong'] = true;
}
$timestampFields = [
'minReadTimestamp',
'readTimestamp'
];
$durationFields = [
'exactStaleness',
'maxStaleness'
];
foreach ($timestampFields as $tsf) {
if (isset($transactionOptions['readOnly'][$tsf]) && !isset($previousOptions[$tsf])) {
$field = $transactionOptions['readOnly'][$tsf];
if (!($field instanceof Timestamp)) {
throw new \BadMethodCallException(sprintf(
'Read Only Transaction Configuration Field %s must be an instance of `%s`.',
$tsf,
Timestamp::class
));
}
$transactionOptions['readOnly'][$tsf] = $field->formatAsString();
}
}
foreach ($durationFields as $df) {
if (isset($transactionOptions['readOnly'][$df]) && !isset($previousOptions[$df])) {
$field = $transactionOptions['readOnly'][$df];
if (!($field instanceof Duration)) {
throw new \BadMethodCallException(sprintf(
'Read Only Transaction Configuration Field %s must be an instance of `%s`.',
$df,
Duration::class
));
}
$transactionOptions['readOnly'][$df] = $field->get();
}
}
return $transactionOptions;
} | php | private function configureSnapshotOptions(array &$options, array $previous = [])
{
$options += [
'singleUse' => false,
'returnReadTimestamp' => null,
'strong' => null,
'readTimestamp' => null,
'exactStaleness' => null,
'minReadTimestamp' => null,
'maxStaleness' => null,
];
$previousOptions = isset($previous['transactionOptions']['readOnly'])
? $previous['transactionOptions']['readOnly']
: [];
// These are only available in single-use transactions.
if (!$options['singleUse'] && ($options['maxStaleness'] || $options['minReadTimestamp'])) {
throw new \BadMethodCallException(
'maxStaleness and minReadTimestamp are only available in single-use transactions.'
);
}
$transactionOptions = [
'readOnly' => $this->arrayFilterRemoveNull([
'returnReadTimestamp' => $this->pluck('returnReadTimestamp', $options),
'strong' => $this->pluck('strong', $options),
'minReadTimestamp' => $this->pluck('minReadTimestamp', $options),
'maxStaleness' => $this->pluck('maxStaleness', $options),
'readTimestamp' => $this->pluck('readTimestamp', $options),
'exactStaleness' => $this->pluck('exactStaleness', $options),
]) + $previousOptions
];
if (empty($transactionOptions['readOnly'])) {
$transactionOptions['readOnly']['strong'] = true;
}
$timestampFields = [
'minReadTimestamp',
'readTimestamp'
];
$durationFields = [
'exactStaleness',
'maxStaleness'
];
foreach ($timestampFields as $tsf) {
if (isset($transactionOptions['readOnly'][$tsf]) && !isset($previousOptions[$tsf])) {
$field = $transactionOptions['readOnly'][$tsf];
if (!($field instanceof Timestamp)) {
throw new \BadMethodCallException(sprintf(
'Read Only Transaction Configuration Field %s must be an instance of `%s`.',
$tsf,
Timestamp::class
));
}
$transactionOptions['readOnly'][$tsf] = $field->formatAsString();
}
}
foreach ($durationFields as $df) {
if (isset($transactionOptions['readOnly'][$df]) && !isset($previousOptions[$df])) {
$field = $transactionOptions['readOnly'][$df];
if (!($field instanceof Duration)) {
throw new \BadMethodCallException(sprintf(
'Read Only Transaction Configuration Field %s must be an instance of `%s`.',
$df,
Duration::class
));
}
$transactionOptions['readOnly'][$df] = $field->get();
}
}
return $transactionOptions;
} | [
"private",
"function",
"configureSnapshotOptions",
"(",
"array",
"&",
"$",
"options",
",",
"array",
"$",
"previous",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"+=",
"[",
"'singleUse'",
"=>",
"false",
",",
"'returnReadTimestamp'",
"=>",
"null",
",",
"'strong'",
"=>",
"null",
",",
"'readTimestamp'",
"=>",
"null",
",",
"'exactStaleness'",
"=>",
"null",
",",
"'minReadTimestamp'",
"=>",
"null",
",",
"'maxStaleness'",
"=>",
"null",
",",
"]",
";",
"$",
"previousOptions",
"=",
"isset",
"(",
"$",
"previous",
"[",
"'transactionOptions'",
"]",
"[",
"'readOnly'",
"]",
")",
"?",
"$",
"previous",
"[",
"'transactionOptions'",
"]",
"[",
"'readOnly'",
"]",
":",
"[",
"]",
";",
"// These are only available in single-use transactions.",
"if",
"(",
"!",
"$",
"options",
"[",
"'singleUse'",
"]",
"&&",
"(",
"$",
"options",
"[",
"'maxStaleness'",
"]",
"||",
"$",
"options",
"[",
"'minReadTimestamp'",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"BadMethodCallException",
"(",
"'maxStaleness and minReadTimestamp are only available in single-use transactions.'",
")",
";",
"}",
"$",
"transactionOptions",
"=",
"[",
"'readOnly'",
"=>",
"$",
"this",
"->",
"arrayFilterRemoveNull",
"(",
"[",
"'returnReadTimestamp'",
"=>",
"$",
"this",
"->",
"pluck",
"(",
"'returnReadTimestamp'",
",",
"$",
"options",
")",
",",
"'strong'",
"=>",
"$",
"this",
"->",
"pluck",
"(",
"'strong'",
",",
"$",
"options",
")",
",",
"'minReadTimestamp'",
"=>",
"$",
"this",
"->",
"pluck",
"(",
"'minReadTimestamp'",
",",
"$",
"options",
")",
",",
"'maxStaleness'",
"=>",
"$",
"this",
"->",
"pluck",
"(",
"'maxStaleness'",
",",
"$",
"options",
")",
",",
"'readTimestamp'",
"=>",
"$",
"this",
"->",
"pluck",
"(",
"'readTimestamp'",
",",
"$",
"options",
")",
",",
"'exactStaleness'",
"=>",
"$",
"this",
"->",
"pluck",
"(",
"'exactStaleness'",
",",
"$",
"options",
")",
",",
"]",
")",
"+",
"$",
"previousOptions",
"]",
";",
"if",
"(",
"empty",
"(",
"$",
"transactionOptions",
"[",
"'readOnly'",
"]",
")",
")",
"{",
"$",
"transactionOptions",
"[",
"'readOnly'",
"]",
"[",
"'strong'",
"]",
"=",
"true",
";",
"}",
"$",
"timestampFields",
"=",
"[",
"'minReadTimestamp'",
",",
"'readTimestamp'",
"]",
";",
"$",
"durationFields",
"=",
"[",
"'exactStaleness'",
",",
"'maxStaleness'",
"]",
";",
"foreach",
"(",
"$",
"timestampFields",
"as",
"$",
"tsf",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"transactionOptions",
"[",
"'readOnly'",
"]",
"[",
"$",
"tsf",
"]",
")",
"&&",
"!",
"isset",
"(",
"$",
"previousOptions",
"[",
"$",
"tsf",
"]",
")",
")",
"{",
"$",
"field",
"=",
"$",
"transactionOptions",
"[",
"'readOnly'",
"]",
"[",
"$",
"tsf",
"]",
";",
"if",
"(",
"!",
"(",
"$",
"field",
"instanceof",
"Timestamp",
")",
")",
"{",
"throw",
"new",
"\\",
"BadMethodCallException",
"(",
"sprintf",
"(",
"'Read Only Transaction Configuration Field %s must be an instance of `%s`.'",
",",
"$",
"tsf",
",",
"Timestamp",
"::",
"class",
")",
")",
";",
"}",
"$",
"transactionOptions",
"[",
"'readOnly'",
"]",
"[",
"$",
"tsf",
"]",
"=",
"$",
"field",
"->",
"formatAsString",
"(",
")",
";",
"}",
"}",
"foreach",
"(",
"$",
"durationFields",
"as",
"$",
"df",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"transactionOptions",
"[",
"'readOnly'",
"]",
"[",
"$",
"df",
"]",
")",
"&&",
"!",
"isset",
"(",
"$",
"previousOptions",
"[",
"$",
"df",
"]",
")",
")",
"{",
"$",
"field",
"=",
"$",
"transactionOptions",
"[",
"'readOnly'",
"]",
"[",
"$",
"df",
"]",
";",
"if",
"(",
"!",
"(",
"$",
"field",
"instanceof",
"Duration",
")",
")",
"{",
"throw",
"new",
"\\",
"BadMethodCallException",
"(",
"sprintf",
"(",
"'Read Only Transaction Configuration Field %s must be an instance of `%s`.'",
",",
"$",
"df",
",",
"Duration",
"::",
"class",
")",
")",
";",
"}",
"$",
"transactionOptions",
"[",
"'readOnly'",
"]",
"[",
"$",
"df",
"]",
"=",
"$",
"field",
"->",
"get",
"(",
")",
";",
"}",
"}",
"return",
"$",
"transactionOptions",
";",
"}"
] | Configure a Read-Only transaction.
@param array $options Configuration Options.
@param array $previous Previously given call options (for single-use snapshots).
@return array | [
"Configure",
"a",
"Read",
"-",
"Only",
"transaction",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/TransactionConfigurationTrait.php#L127-L206 | train |
googleapis/google-cloud-php | Iot/src/V1/RegistryCredential.php | RegistryCredential.setPublicKeyCertificate | public function setPublicKeyCertificate($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Iot\V1\PublicKeyCertificate::class);
$this->writeOneof(1, $var);
return $this;
} | php | public function setPublicKeyCertificate($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Iot\V1\PublicKeyCertificate::class);
$this->writeOneof(1, $var);
return $this;
} | [
"public",
"function",
"setPublicKeyCertificate",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Iot",
"\\",
"V1",
"\\",
"PublicKeyCertificate",
"::",
"class",
")",
";",
"$",
"this",
"->",
"writeOneof",
"(",
"1",
",",
"$",
"var",
")",
";",
"return",
"$",
"this",
";",
"}"
] | A public key certificate used to verify the device credentials.
Generated from protobuf field <code>.google.cloud.iot.v1.PublicKeyCertificate public_key_certificate = 1;</code>
@param \Google\Cloud\Iot\V1\PublicKeyCertificate $var
@return $this | [
"A",
"public",
"key",
"certificate",
"used",
"to",
"verify",
"the",
"device",
"credentials",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Iot/src/V1/RegistryCredential.php#L53-L59 | train |
googleapis/google-cloud-php | Debugger/src/V2/StackFrame.php | StackFrame.setArguments | public function setArguments($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Debugger\V2\Variable::class);
$this->arguments = $arr;
return $this;
} | php | public function setArguments($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Debugger\V2\Variable::class);
$this->arguments = $arr;
return $this;
} | [
"public",
"function",
"setArguments",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Debugger",
"\\",
"V2",
"\\",
"Variable",
"::",
"class",
")",
";",
"$",
"this",
"->",
"arguments",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | Set of arguments passed to this function.
Note that this might not be populated for all stack frames.
Generated from protobuf field <code>repeated .google.devtools.clouddebugger.v2.Variable arguments = 3;</code>
@param \Google\Cloud\Debugger\V2\Variable[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"Set",
"of",
"arguments",
"passed",
"to",
"this",
"function",
".",
"Note",
"that",
"this",
"might",
"not",
"be",
"populated",
"for",
"all",
"stack",
"frames",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Debugger/src/V2/StackFrame.php#L140-L146 | train |
googleapis/google-cloud-php | Debugger/src/V2/StackFrame.php | StackFrame.setLocals | public function setLocals($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Debugger\V2\Variable::class);
$this->locals = $arr;
return $this;
} | php | public function setLocals($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Debugger\V2\Variable::class);
$this->locals = $arr;
return $this;
} | [
"public",
"function",
"setLocals",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Debugger",
"\\",
"V2",
"\\",
"Variable",
"::",
"class",
")",
";",
"$",
"this",
"->",
"locals",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | Set of local variables at the stack frame location.
Note that this might not be populated for all stack frames.
Generated from protobuf field <code>repeated .google.devtools.clouddebugger.v2.Variable locals = 4;</code>
@param \Google\Cloud\Debugger\V2\Variable[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"Set",
"of",
"local",
"variables",
"at",
"the",
"stack",
"frame",
"location",
".",
"Note",
"that",
"this",
"might",
"not",
"be",
"populated",
"for",
"all",
"stack",
"frames",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Debugger/src/V2/StackFrame.php#L168-L174 | train |
googleapis/google-cloud-php | Monitoring/src/V3/UptimeCheckConfig/ResourceGroup.php | ResourceGroup.setResourceType | public function setResourceType($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Monitoring\V3\GroupResourceType::class);
$this->resource_type = $var;
return $this;
} | php | public function setResourceType($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Monitoring\V3\GroupResourceType::class);
$this->resource_type = $var;
return $this;
} | [
"public",
"function",
"setResourceType",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Monitoring",
"\\",
"V3",
"\\",
"GroupResourceType",
"::",
"class",
")",
";",
"$",
"this",
"->",
"resource_type",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | The resource type of the group members.
Generated from protobuf field <code>.google.monitoring.v3.GroupResourceType resource_type = 2;</code>
@param int $var
@return $this | [
"The",
"resource",
"type",
"of",
"the",
"group",
"members",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Monitoring/src/V3/UptimeCheckConfig/ResourceGroup.php#L97-L103 | train |
googleapis/google-cloud-php | Storage/src/StreamWrapper.php | StreamWrapper.register | public static function register(StorageClient $client, $protocol = null)
{
$protocol = $protocol ?: self::DEFAULT_PROTOCOL;
if (!in_array($protocol, stream_get_wrappers())) {
if (!stream_wrapper_register($protocol, StreamWrapper::class, STREAM_IS_URL)) {
throw new \RuntimeException("Failed to register '$protocol://' protocol");
}
self::$clients[$protocol] = $client;
return true;
}
return false;
} | php | public static function register(StorageClient $client, $protocol = null)
{
$protocol = $protocol ?: self::DEFAULT_PROTOCOL;
if (!in_array($protocol, stream_get_wrappers())) {
if (!stream_wrapper_register($protocol, StreamWrapper::class, STREAM_IS_URL)) {
throw new \RuntimeException("Failed to register '$protocol://' protocol");
}
self::$clients[$protocol] = $client;
return true;
}
return false;
} | [
"public",
"static",
"function",
"register",
"(",
"StorageClient",
"$",
"client",
",",
"$",
"protocol",
"=",
"null",
")",
"{",
"$",
"protocol",
"=",
"$",
"protocol",
"?",
":",
"self",
"::",
"DEFAULT_PROTOCOL",
";",
"if",
"(",
"!",
"in_array",
"(",
"$",
"protocol",
",",
"stream_get_wrappers",
"(",
")",
")",
")",
"{",
"if",
"(",
"!",
"stream_wrapper_register",
"(",
"$",
"protocol",
",",
"StreamWrapper",
"::",
"class",
",",
"STREAM_IS_URL",
")",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"\"Failed to register '$protocol://' protocol\"",
")",
";",
"}",
"self",
"::",
"$",
"clients",
"[",
"$",
"protocol",
"]",
"=",
"$",
"client",
";",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | Register a StreamWrapper for reading and writing to Google Storage
@param StorageClient $client The StorageClient configuration to use.
@param string $protocol The name of the protocol to use. **Defaults to**
`gs`.
@throws \RuntimeException | [
"Register",
"a",
"StreamWrapper",
"for",
"reading",
"and",
"writing",
"to",
"Google",
"Storage"
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Storage/src/StreamWrapper.php#L99-L110 | train |
googleapis/google-cloud-php | Storage/src/StreamWrapper.php | StreamWrapper.unregister | public static function unregister($protocol = null)
{
$protocol = $protocol ?: self::DEFAULT_PROTOCOL;
stream_wrapper_unregister($protocol);
unset(self::$clients[$protocol]);
} | php | public static function unregister($protocol = null)
{
$protocol = $protocol ?: self::DEFAULT_PROTOCOL;
stream_wrapper_unregister($protocol);
unset(self::$clients[$protocol]);
} | [
"public",
"static",
"function",
"unregister",
"(",
"$",
"protocol",
"=",
"null",
")",
"{",
"$",
"protocol",
"=",
"$",
"protocol",
"?",
":",
"self",
"::",
"DEFAULT_PROTOCOL",
";",
"stream_wrapper_unregister",
"(",
"$",
"protocol",
")",
";",
"unset",
"(",
"self",
"::",
"$",
"clients",
"[",
"$",
"protocol",
"]",
")",
";",
"}"
] | Unregisters the SteamWrapper
@param string $protocol The name of the protocol to unregister. **Defaults
to** `gs`. | [
"Unregisters",
"the",
"SteamWrapper"
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Storage/src/StreamWrapper.php#L118-L123 | train |
googleapis/google-cloud-php | Storage/src/StreamWrapper.php | StreamWrapper.getClient | public static function getClient($protocol = null)
{
$protocol = $protocol ?: self::DEFAULT_PROTOCOL;
return self::$clients[$protocol];
} | php | public static function getClient($protocol = null)
{
$protocol = $protocol ?: self::DEFAULT_PROTOCOL;
return self::$clients[$protocol];
} | [
"public",
"static",
"function",
"getClient",
"(",
"$",
"protocol",
"=",
"null",
")",
"{",
"$",
"protocol",
"=",
"$",
"protocol",
"?",
":",
"self",
"::",
"DEFAULT_PROTOCOL",
";",
"return",
"self",
"::",
"$",
"clients",
"[",
"$",
"protocol",
"]",
";",
"}"
] | Get the default client to use for streams.
@param string $protocol The name of the protocol to get the client for.
**Defaults to** `gs`.
@return StorageClient | [
"Get",
"the",
"default",
"client",
"to",
"use",
"for",
"streams",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Storage/src/StreamWrapper.php#L132-L136 | train |
googleapis/google-cloud-php | Storage/src/StreamWrapper.php | StreamWrapper.stream_open | public function stream_open($path, $mode, $flags, &$openedPath)
{
$client = $this->openPath($path);
// strip off 'b' or 't' from the mode
$mode = rtrim($mode, 'bt');
$options = [];
if ($this->context) {
$contextOptions = stream_context_get_options($this->context);
if (array_key_exists($this->protocol, $contextOptions)) {
$options = $contextOptions[$this->protocol] ?: [];
}
}
if ($mode == 'w') {
$this->stream = new WriteStream(null, $options);
$this->stream->setUploader(
$this->bucket->getStreamableUploader(
$this->stream,
$options + ['name' => $this->file]
)
);
} elseif ($mode == 'r') {
try {
// Lazy read from the source
$options['restOptions']['stream'] = true;
$this->stream = new ReadStream(
$this->bucket->object($this->file)->downloadAsStream($options)
);
// Wrap the response in a caching stream to make it seekable
if (!$this->stream->isSeekable() && ($flags & STREAM_MUST_SEEK)) {
$this->stream = new CachingStream($this->stream);
}
} catch (ServiceException $ex) {
return $this->returnError($ex->getMessage(), $flags);
}
} else {
return $this->returnError('Unknown stream_open mode.', $flags);
}
if ($flags & STREAM_USE_PATH) {
$openedPath = $path;
}
return true;
} | php | public function stream_open($path, $mode, $flags, &$openedPath)
{
$client = $this->openPath($path);
// strip off 'b' or 't' from the mode
$mode = rtrim($mode, 'bt');
$options = [];
if ($this->context) {
$contextOptions = stream_context_get_options($this->context);
if (array_key_exists($this->protocol, $contextOptions)) {
$options = $contextOptions[$this->protocol] ?: [];
}
}
if ($mode == 'w') {
$this->stream = new WriteStream(null, $options);
$this->stream->setUploader(
$this->bucket->getStreamableUploader(
$this->stream,
$options + ['name' => $this->file]
)
);
} elseif ($mode == 'r') {
try {
// Lazy read from the source
$options['restOptions']['stream'] = true;
$this->stream = new ReadStream(
$this->bucket->object($this->file)->downloadAsStream($options)
);
// Wrap the response in a caching stream to make it seekable
if (!$this->stream->isSeekable() && ($flags & STREAM_MUST_SEEK)) {
$this->stream = new CachingStream($this->stream);
}
} catch (ServiceException $ex) {
return $this->returnError($ex->getMessage(), $flags);
}
} else {
return $this->returnError('Unknown stream_open mode.', $flags);
}
if ($flags & STREAM_USE_PATH) {
$openedPath = $path;
}
return true;
} | [
"public",
"function",
"stream_open",
"(",
"$",
"path",
",",
"$",
"mode",
",",
"$",
"flags",
",",
"&",
"$",
"openedPath",
")",
"{",
"$",
"client",
"=",
"$",
"this",
"->",
"openPath",
"(",
"$",
"path",
")",
";",
"// strip off 'b' or 't' from the mode",
"$",
"mode",
"=",
"rtrim",
"(",
"$",
"mode",
",",
"'bt'",
")",
";",
"$",
"options",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"context",
")",
"{",
"$",
"contextOptions",
"=",
"stream_context_get_options",
"(",
"$",
"this",
"->",
"context",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"this",
"->",
"protocol",
",",
"$",
"contextOptions",
")",
")",
"{",
"$",
"options",
"=",
"$",
"contextOptions",
"[",
"$",
"this",
"->",
"protocol",
"]",
"?",
":",
"[",
"]",
";",
"}",
"}",
"if",
"(",
"$",
"mode",
"==",
"'w'",
")",
"{",
"$",
"this",
"->",
"stream",
"=",
"new",
"WriteStream",
"(",
"null",
",",
"$",
"options",
")",
";",
"$",
"this",
"->",
"stream",
"->",
"setUploader",
"(",
"$",
"this",
"->",
"bucket",
"->",
"getStreamableUploader",
"(",
"$",
"this",
"->",
"stream",
",",
"$",
"options",
"+",
"[",
"'name'",
"=>",
"$",
"this",
"->",
"file",
"]",
")",
")",
";",
"}",
"elseif",
"(",
"$",
"mode",
"==",
"'r'",
")",
"{",
"try",
"{",
"// Lazy read from the source",
"$",
"options",
"[",
"'restOptions'",
"]",
"[",
"'stream'",
"]",
"=",
"true",
";",
"$",
"this",
"->",
"stream",
"=",
"new",
"ReadStream",
"(",
"$",
"this",
"->",
"bucket",
"->",
"object",
"(",
"$",
"this",
"->",
"file",
")",
"->",
"downloadAsStream",
"(",
"$",
"options",
")",
")",
";",
"// Wrap the response in a caching stream to make it seekable",
"if",
"(",
"!",
"$",
"this",
"->",
"stream",
"->",
"isSeekable",
"(",
")",
"&&",
"(",
"$",
"flags",
"&",
"STREAM_MUST_SEEK",
")",
")",
"{",
"$",
"this",
"->",
"stream",
"=",
"new",
"CachingStream",
"(",
"$",
"this",
"->",
"stream",
")",
";",
"}",
"}",
"catch",
"(",
"ServiceException",
"$",
"ex",
")",
"{",
"return",
"$",
"this",
"->",
"returnError",
"(",
"$",
"ex",
"->",
"getMessage",
"(",
")",
",",
"$",
"flags",
")",
";",
"}",
"}",
"else",
"{",
"return",
"$",
"this",
"->",
"returnError",
"(",
"'Unknown stream_open mode.'",
",",
"$",
"flags",
")",
";",
"}",
"if",
"(",
"$",
"flags",
"&",
"STREAM_USE_PATH",
")",
"{",
"$",
"openedPath",
"=",
"$",
"path",
";",
"}",
"return",
"true",
";",
"}"
] | Callback handler for when a stream is opened. For reads, we need to
download the file to see if it can be opened.
@param string $path The path of the resource to open
@param string $mode The fopen mode. Currently only supports ('r', 'rb', 'rt', 'w', 'wb', 'wt')
@param int $flags Bitwise options STREAM_USE_PATH|STREAM_REPORT_ERRORS|STREAM_MUST_SEEK
@param string $openedPath Will be set to the path on success if STREAM_USE_PATH option is set
@return bool | [
"Callback",
"handler",
"for",
"when",
"a",
"stream",
"is",
"opened",
".",
"For",
"reads",
"we",
"need",
"to",
"download",
"the",
"file",
"to",
"see",
"if",
"it",
"can",
"be",
"opened",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Storage/src/StreamWrapper.php#L148-L194 | train |
googleapis/google-cloud-php | Storage/src/StreamWrapper.php | StreamWrapper.stream_stat | public function stream_stat()
{
$mode = $this->stream->isWritable()
? self::FILE_WRITABLE_MODE
: self::FILE_READABLE_MODE;
return $this->makeStatArray([
'mode' => $mode,
'size' => $this->stream->getSize()
]);
} | php | public function stream_stat()
{
$mode = $this->stream->isWritable()
? self::FILE_WRITABLE_MODE
: self::FILE_READABLE_MODE;
return $this->makeStatArray([
'mode' => $mode,
'size' => $this->stream->getSize()
]);
} | [
"public",
"function",
"stream_stat",
"(",
")",
"{",
"$",
"mode",
"=",
"$",
"this",
"->",
"stream",
"->",
"isWritable",
"(",
")",
"?",
"self",
"::",
"FILE_WRITABLE_MODE",
":",
"self",
"::",
"FILE_READABLE_MODE",
";",
"return",
"$",
"this",
"->",
"makeStatArray",
"(",
"[",
"'mode'",
"=>",
"$",
"mode",
",",
"'size'",
"=>",
"$",
"this",
"->",
"stream",
"->",
"getSize",
"(",
")",
"]",
")",
";",
"}"
] | Callback handler for getting data about the stream.
@return array | [
"Callback",
"handler",
"for",
"getting",
"data",
"about",
"the",
"stream",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Storage/src/StreamWrapper.php#L225-L234 | train |
googleapis/google-cloud-php | Storage/src/StreamWrapper.php | StreamWrapper.stream_seek | public function stream_seek($offset, $whence = SEEK_SET)
{
if ($this->stream->isSeekable()) {
$this->stream->seek($offset, $whence);
return true;
}
return false;
} | php | public function stream_seek($offset, $whence = SEEK_SET)
{
if ($this->stream->isSeekable()) {
$this->stream->seek($offset, $whence);
return true;
}
return false;
} | [
"public",
"function",
"stream_seek",
"(",
"$",
"offset",
",",
"$",
"whence",
"=",
"SEEK_SET",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"stream",
"->",
"isSeekable",
"(",
")",
")",
"{",
"$",
"this",
"->",
"stream",
"->",
"seek",
"(",
"$",
"offset",
",",
"$",
"whence",
")",
";",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | Callback handler for trying to seek to a certain location in the stream.
@param int $offset The stream offset to seek to
@param int $whence Flag for what the offset is relative to. See:
http://php.net/manual/en/streamwrapper.stream-seek.php
@return bool | [
"Callback",
"handler",
"for",
"trying",
"to",
"seek",
"to",
"a",
"certain",
"location",
"in",
"the",
"stream",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Storage/src/StreamWrapper.php#L264-L271 | train |
googleapis/google-cloud-php | Storage/src/StreamWrapper.php | StreamWrapper.dir_readdir | public function dir_readdir()
{
$object = $this->directoryIterator->current();
if ($object) {
$this->directoryIterator->next();
return $object->name();
}
return false;
} | php | public function dir_readdir()
{
$object = $this->directoryIterator->current();
if ($object) {
$this->directoryIterator->next();
return $object->name();
}
return false;
} | [
"public",
"function",
"dir_readdir",
"(",
")",
"{",
"$",
"object",
"=",
"$",
"this",
"->",
"directoryIterator",
"->",
"current",
"(",
")",
";",
"if",
"(",
"$",
"object",
")",
"{",
"$",
"this",
"->",
"directoryIterator",
"->",
"next",
"(",
")",
";",
"return",
"$",
"object",
"->",
"name",
"(",
")",
";",
"}",
"return",
"false",
";",
"}"
] | Callback handler for reading an entry from a directory handle.
@return string|bool | [
"Callback",
"handler",
"for",
"reading",
"an",
"entry",
"from",
"a",
"directory",
"handle",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Storage/src/StreamWrapper.php#L311-L320 | train |
googleapis/google-cloud-php | Storage/src/StreamWrapper.php | StreamWrapper.dir_rewinddir | public function dir_rewinddir()
{
try {
$this->directoryIterator = $this->bucket->objects([
'prefix' => $this->file,
'fields' => 'items/name,nextPageToken'
]);
} catch (ServiceException $e) {
return false;
}
return true;
} | php | public function dir_rewinddir()
{
try {
$this->directoryIterator = $this->bucket->objects([
'prefix' => $this->file,
'fields' => 'items/name,nextPageToken'
]);
} catch (ServiceException $e) {
return false;
}
return true;
} | [
"public",
"function",
"dir_rewinddir",
"(",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"directoryIterator",
"=",
"$",
"this",
"->",
"bucket",
"->",
"objects",
"(",
"[",
"'prefix'",
"=>",
"$",
"this",
"->",
"file",
",",
"'fields'",
"=>",
"'items/name,nextPageToken'",
"]",
")",
";",
"}",
"catch",
"(",
"ServiceException",
"$",
"e",
")",
"{",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] | Callback handler for rewind the directory handle.
@return bool | [
"Callback",
"handler",
"for",
"rewind",
"the",
"directory",
"handle",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Storage/src/StreamWrapper.php#L327-L338 | train |
googleapis/google-cloud-php | Storage/src/StreamWrapper.php | StreamWrapper.mkdir | public function mkdir($path, $mode, $options)
{
$path = $this->makeDirectory($path);
$client = $this->openPath($path);
$predefinedAcl = $this->determineAclFromMode($mode);
try {
if ($options & STREAM_MKDIR_RECURSIVE || $this->file == '') {
if (!$this->bucket->exists()) {
$client->createBucket($this->bucket->name(), [
'predefinedAcl' => $predefinedAcl,
'predefinedDefaultObjectAcl' => $predefinedAcl
]);
}
}
// If the file name is empty, we were trying to create a bucket. In this case,
// don't create the placeholder file.
if ($this->file != '') {
// Fake a directory by creating an empty placeholder file whose name ends in '/'
$this->bucket->upload('', [
'name' => $this->file,
'predefinedAcl' => $predefinedAcl
]);
}
} catch (ServiceException $e) {
return false;
}
return true;
} | php | public function mkdir($path, $mode, $options)
{
$path = $this->makeDirectory($path);
$client = $this->openPath($path);
$predefinedAcl = $this->determineAclFromMode($mode);
try {
if ($options & STREAM_MKDIR_RECURSIVE || $this->file == '') {
if (!$this->bucket->exists()) {
$client->createBucket($this->bucket->name(), [
'predefinedAcl' => $predefinedAcl,
'predefinedDefaultObjectAcl' => $predefinedAcl
]);
}
}
// If the file name is empty, we were trying to create a bucket. In this case,
// don't create the placeholder file.
if ($this->file != '') {
// Fake a directory by creating an empty placeholder file whose name ends in '/'
$this->bucket->upload('', [
'name' => $this->file,
'predefinedAcl' => $predefinedAcl
]);
}
} catch (ServiceException $e) {
return false;
}
return true;
} | [
"public",
"function",
"mkdir",
"(",
"$",
"path",
",",
"$",
"mode",
",",
"$",
"options",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"makeDirectory",
"(",
"$",
"path",
")",
";",
"$",
"client",
"=",
"$",
"this",
"->",
"openPath",
"(",
"$",
"path",
")",
";",
"$",
"predefinedAcl",
"=",
"$",
"this",
"->",
"determineAclFromMode",
"(",
"$",
"mode",
")",
";",
"try",
"{",
"if",
"(",
"$",
"options",
"&",
"STREAM_MKDIR_RECURSIVE",
"||",
"$",
"this",
"->",
"file",
"==",
"''",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"bucket",
"->",
"exists",
"(",
")",
")",
"{",
"$",
"client",
"->",
"createBucket",
"(",
"$",
"this",
"->",
"bucket",
"->",
"name",
"(",
")",
",",
"[",
"'predefinedAcl'",
"=>",
"$",
"predefinedAcl",
",",
"'predefinedDefaultObjectAcl'",
"=>",
"$",
"predefinedAcl",
"]",
")",
";",
"}",
"}",
"// If the file name is empty, we were trying to create a bucket. In this case,",
"// don't create the placeholder file.",
"if",
"(",
"$",
"this",
"->",
"file",
"!=",
"''",
")",
"{",
"// Fake a directory by creating an empty placeholder file whose name ends in '/'",
"$",
"this",
"->",
"bucket",
"->",
"upload",
"(",
"''",
",",
"[",
"'name'",
"=>",
"$",
"this",
"->",
"file",
",",
"'predefinedAcl'",
"=>",
"$",
"predefinedAcl",
"]",
")",
";",
"}",
"}",
"catch",
"(",
"ServiceException",
"$",
"e",
")",
"{",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] | Callback handler for trying to create a directory. If no file path is specified,
or STREAM_MKDIR_RECURSIVE option is set, then create the bucket if it does not exist.
@param string $path The url directory to create
@param int $mode The permissions on the directory
@param int $options Bitwise mask of options. STREAM_MKDIR_RECURSIVE
@return bool | [
"Callback",
"handler",
"for",
"trying",
"to",
"create",
"a",
"directory",
".",
"If",
"no",
"file",
"path",
"is",
"specified",
"or",
"STREAM_MKDIR_RECURSIVE",
"option",
"is",
"set",
"then",
"create",
"the",
"bucket",
"if",
"it",
"does",
"not",
"exist",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Storage/src/StreamWrapper.php#L349-L378 | train |
googleapis/google-cloud-php | Storage/src/StreamWrapper.php | StreamWrapper.rename | public function rename($from, $to)
{
$url = (array) parse_url($to) + [
'path' => '',
'host' => ''
];
$destinationBucket = $url['host'];
$destinationPath = substr($url['path'], 1);
$this->dir_opendir($from, []);
foreach ($this->directoryIterator as $file) {
$name = $file->name();
$newPath = str_replace($this->file, $destinationPath, $name);
$obj = $this->bucket->object($name);
try {
$obj->rename($newPath, ['destinationBucket' => $destinationBucket]);
} catch (ServiceException $e) {
// If any rename calls fail, abort and return false
return false;
}
}
return true;
} | php | public function rename($from, $to)
{
$url = (array) parse_url($to) + [
'path' => '',
'host' => ''
];
$destinationBucket = $url['host'];
$destinationPath = substr($url['path'], 1);
$this->dir_opendir($from, []);
foreach ($this->directoryIterator as $file) {
$name = $file->name();
$newPath = str_replace($this->file, $destinationPath, $name);
$obj = $this->bucket->object($name);
try {
$obj->rename($newPath, ['destinationBucket' => $destinationBucket]);
} catch (ServiceException $e) {
// If any rename calls fail, abort and return false
return false;
}
}
return true;
} | [
"public",
"function",
"rename",
"(",
"$",
"from",
",",
"$",
"to",
")",
"{",
"$",
"url",
"=",
"(",
"array",
")",
"parse_url",
"(",
"$",
"to",
")",
"+",
"[",
"'path'",
"=>",
"''",
",",
"'host'",
"=>",
"''",
"]",
";",
"$",
"destinationBucket",
"=",
"$",
"url",
"[",
"'host'",
"]",
";",
"$",
"destinationPath",
"=",
"substr",
"(",
"$",
"url",
"[",
"'path'",
"]",
",",
"1",
")",
";",
"$",
"this",
"->",
"dir_opendir",
"(",
"$",
"from",
",",
"[",
"]",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"directoryIterator",
"as",
"$",
"file",
")",
"{",
"$",
"name",
"=",
"$",
"file",
"->",
"name",
"(",
")",
";",
"$",
"newPath",
"=",
"str_replace",
"(",
"$",
"this",
"->",
"file",
",",
"$",
"destinationPath",
",",
"$",
"name",
")",
";",
"$",
"obj",
"=",
"$",
"this",
"->",
"bucket",
"->",
"object",
"(",
"$",
"name",
")",
";",
"try",
"{",
"$",
"obj",
"->",
"rename",
"(",
"$",
"newPath",
",",
"[",
"'destinationBucket'",
"=>",
"$",
"destinationBucket",
"]",
")",
";",
"}",
"catch",
"(",
"ServiceException",
"$",
"e",
")",
"{",
"// If any rename calls fail, abort and return false",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] | Callback handler for trying to move a file or directory.
@param string $from The URL to the current file
@param string $to The URL of the new file location
@return bool | [
"Callback",
"handler",
"for",
"trying",
"to",
"move",
"a",
"file",
"or",
"directory",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Storage/src/StreamWrapper.php#L387-L411 | train |
googleapis/google-cloud-php | Storage/src/StreamWrapper.php | StreamWrapper.unlink | public function unlink($path)
{
$client = $this->openPath($path);
$object = $this->bucket->object($this->file);
try {
$object->delete();
return true;
} catch (ServiceException $e) {
return false;
}
} | php | public function unlink($path)
{
$client = $this->openPath($path);
$object = $this->bucket->object($this->file);
try {
$object->delete();
return true;
} catch (ServiceException $e) {
return false;
}
} | [
"public",
"function",
"unlink",
"(",
"$",
"path",
")",
"{",
"$",
"client",
"=",
"$",
"this",
"->",
"openPath",
"(",
"$",
"path",
")",
";",
"$",
"object",
"=",
"$",
"this",
"->",
"bucket",
"->",
"object",
"(",
"$",
"this",
"->",
"file",
")",
";",
"try",
"{",
"$",
"object",
"->",
"delete",
"(",
")",
";",
"return",
"true",
";",
"}",
"catch",
"(",
"ServiceException",
"$",
"e",
")",
"{",
"return",
"false",
";",
"}",
"}"
] | Callback handler for deleting a file
@param string $path The URL of the file to delete
@return bool | [
"Callback",
"handler",
"for",
"deleting",
"a",
"file"
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Storage/src/StreamWrapper.php#L459-L470 | train |
googleapis/google-cloud-php | Storage/src/StreamWrapper.php | StreamWrapper.url_stat | public function url_stat($path, $flags)
{
$client = $this->openPath($path);
// if directory
if ($this->isDirectory($this->file)) {
return $this->urlStatDirectory();
}
return $this->urlStatFile();
} | php | public function url_stat($path, $flags)
{
$client = $this->openPath($path);
// if directory
if ($this->isDirectory($this->file)) {
return $this->urlStatDirectory();
}
return $this->urlStatFile();
} | [
"public",
"function",
"url_stat",
"(",
"$",
"path",
",",
"$",
"flags",
")",
"{",
"$",
"client",
"=",
"$",
"this",
"->",
"openPath",
"(",
"$",
"path",
")",
";",
"// if directory",
"if",
"(",
"$",
"this",
"->",
"isDirectory",
"(",
"$",
"this",
"->",
"file",
")",
")",
"{",
"return",
"$",
"this",
"->",
"urlStatDirectory",
"(",
")",
";",
"}",
"return",
"$",
"this",
"->",
"urlStatFile",
"(",
")",
";",
"}"
] | Callback handler for retrieving information about a file
@param string $path The URI to the file
@param int $flags Bitwise mask of options
@return array|bool | [
"Callback",
"handler",
"for",
"retrieving",
"information",
"about",
"a",
"file"
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Storage/src/StreamWrapper.php#L479-L489 | train |
googleapis/google-cloud-php | Storage/src/StreamWrapper.php | StreamWrapper.openPath | private function openPath($path)
{
$url = (array) parse_url($path) + [
'scheme' => '',
'path' => '',
'host' => ''
];
$this->protocol = $url['scheme'];
$this->file = ltrim($url['path'], '/');
$client = self::getClient($this->protocol);
$this->bucket = $client->bucket($url['host']);
return $client;
} | php | private function openPath($path)
{
$url = (array) parse_url($path) + [
'scheme' => '',
'path' => '',
'host' => ''
];
$this->protocol = $url['scheme'];
$this->file = ltrim($url['path'], '/');
$client = self::getClient($this->protocol);
$this->bucket = $client->bucket($url['host']);
return $client;
} | [
"private",
"function",
"openPath",
"(",
"$",
"path",
")",
"{",
"$",
"url",
"=",
"(",
"array",
")",
"parse_url",
"(",
"$",
"path",
")",
"+",
"[",
"'scheme'",
"=>",
"''",
",",
"'path'",
"=>",
"''",
",",
"'host'",
"=>",
"''",
"]",
";",
"$",
"this",
"->",
"protocol",
"=",
"$",
"url",
"[",
"'scheme'",
"]",
";",
"$",
"this",
"->",
"file",
"=",
"ltrim",
"(",
"$",
"url",
"[",
"'path'",
"]",
",",
"'/'",
")",
";",
"$",
"client",
"=",
"self",
"::",
"getClient",
"(",
"$",
"this",
"->",
"protocol",
")",
";",
"$",
"this",
"->",
"bucket",
"=",
"$",
"client",
"->",
"bucket",
"(",
"$",
"url",
"[",
"'host'",
"]",
")",
";",
"return",
"$",
"client",
";",
"}"
] | Parse the URL and set protocol, filename and bucket.
@param string $path URL to open
@return StorageClient | [
"Parse",
"the",
"URL",
"and",
"set",
"protocol",
"filename",
"and",
"bucket",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Storage/src/StreamWrapper.php#L497-L509 | train |
googleapis/google-cloud-php | Storage/src/StreamWrapper.php | StreamWrapper.urlStatDirectory | private function urlStatDirectory()
{
$stats = [];
// 1. try to look up the directory as a file
try {
$this->object = $this->bucket->object($this->file);
$info = $this->object->info();
// equivalent to 40777 and 40444 in octal
$stats['mode'] = $this->bucket->isWritable()
? self::DIRECTORY_WRITABLE_MODE
: self::DIRECTORY_READABLE_MODE;
$this->statsFromFileInfo($info, $stats);
return $this->makeStatArray($stats);
} catch (NotFoundException $e) {
} catch (ServiceException $e) {
return false;
}
// 2. try list files in that directory
try {
$objects = $this->bucket->objects([
'prefix' => $this->file,
]);
if (!$objects->current()) {
// can't list objects or doesn't exist
return false;
}
} catch (ServiceException $e) {
return false;
}
// equivalent to 40777 and 40444 in octal
$mode = $this->bucket->isWritable()
? self::DIRECTORY_WRITABLE_MODE
: self::DIRECTORY_READABLE_MODE;
return $this->makeStatArray([
'mode' => $mode
]);
} | php | private function urlStatDirectory()
{
$stats = [];
// 1. try to look up the directory as a file
try {
$this->object = $this->bucket->object($this->file);
$info = $this->object->info();
// equivalent to 40777 and 40444 in octal
$stats['mode'] = $this->bucket->isWritable()
? self::DIRECTORY_WRITABLE_MODE
: self::DIRECTORY_READABLE_MODE;
$this->statsFromFileInfo($info, $stats);
return $this->makeStatArray($stats);
} catch (NotFoundException $e) {
} catch (ServiceException $e) {
return false;
}
// 2. try list files in that directory
try {
$objects = $this->bucket->objects([
'prefix' => $this->file,
]);
if (!$objects->current()) {
// can't list objects or doesn't exist
return false;
}
} catch (ServiceException $e) {
return false;
}
// equivalent to 40777 and 40444 in octal
$mode = $this->bucket->isWritable()
? self::DIRECTORY_WRITABLE_MODE
: self::DIRECTORY_READABLE_MODE;
return $this->makeStatArray([
'mode' => $mode
]);
} | [
"private",
"function",
"urlStatDirectory",
"(",
")",
"{",
"$",
"stats",
"=",
"[",
"]",
";",
"// 1. try to look up the directory as a file",
"try",
"{",
"$",
"this",
"->",
"object",
"=",
"$",
"this",
"->",
"bucket",
"->",
"object",
"(",
"$",
"this",
"->",
"file",
")",
";",
"$",
"info",
"=",
"$",
"this",
"->",
"object",
"->",
"info",
"(",
")",
";",
"// equivalent to 40777 and 40444 in octal",
"$",
"stats",
"[",
"'mode'",
"]",
"=",
"$",
"this",
"->",
"bucket",
"->",
"isWritable",
"(",
")",
"?",
"self",
"::",
"DIRECTORY_WRITABLE_MODE",
":",
"self",
"::",
"DIRECTORY_READABLE_MODE",
";",
"$",
"this",
"->",
"statsFromFileInfo",
"(",
"$",
"info",
",",
"$",
"stats",
")",
";",
"return",
"$",
"this",
"->",
"makeStatArray",
"(",
"$",
"stats",
")",
";",
"}",
"catch",
"(",
"NotFoundException",
"$",
"e",
")",
"{",
"}",
"catch",
"(",
"ServiceException",
"$",
"e",
")",
"{",
"return",
"false",
";",
"}",
"// 2. try list files in that directory",
"try",
"{",
"$",
"objects",
"=",
"$",
"this",
"->",
"bucket",
"->",
"objects",
"(",
"[",
"'prefix'",
"=>",
"$",
"this",
"->",
"file",
",",
"]",
")",
";",
"if",
"(",
"!",
"$",
"objects",
"->",
"current",
"(",
")",
")",
"{",
"// can't list objects or doesn't exist",
"return",
"false",
";",
"}",
"}",
"catch",
"(",
"ServiceException",
"$",
"e",
")",
"{",
"return",
"false",
";",
"}",
"// equivalent to 40777 and 40444 in octal",
"$",
"mode",
"=",
"$",
"this",
"->",
"bucket",
"->",
"isWritable",
"(",
")",
"?",
"self",
"::",
"DIRECTORY_WRITABLE_MODE",
":",
"self",
"::",
"DIRECTORY_READABLE_MODE",
";",
"return",
"$",
"this",
"->",
"makeStatArray",
"(",
"[",
"'mode'",
"=>",
"$",
"mode",
"]",
")",
";",
"}"
] | Calculate the `url_stat` response for a directory
@return array|bool | [
"Calculate",
"the",
"url_stat",
"response",
"for",
"a",
"directory"
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Storage/src/StreamWrapper.php#L531-L572 | train |
googleapis/google-cloud-php | Storage/src/StreamWrapper.php | StreamWrapper.urlStatFile | private function urlStatFile()
{
try {
$this->object = $this->bucket->object($this->file);
$info = $this->object->info();
} catch (ServiceException $e) {
// couldn't stat file
return false;
}
// equivalent to 100666 and 100444 in octal
$stats = array(
'mode' => $this->bucket->isWritable()
? self::FILE_WRITABLE_MODE
: self::FILE_READABLE_MODE
);
$this->statsFromFileInfo($info, $stats);
return $this->makeStatArray($stats);
} | php | private function urlStatFile()
{
try {
$this->object = $this->bucket->object($this->file);
$info = $this->object->info();
} catch (ServiceException $e) {
// couldn't stat file
return false;
}
// equivalent to 100666 and 100444 in octal
$stats = array(
'mode' => $this->bucket->isWritable()
? self::FILE_WRITABLE_MODE
: self::FILE_READABLE_MODE
);
$this->statsFromFileInfo($info, $stats);
return $this->makeStatArray($stats);
} | [
"private",
"function",
"urlStatFile",
"(",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"object",
"=",
"$",
"this",
"->",
"bucket",
"->",
"object",
"(",
"$",
"this",
"->",
"file",
")",
";",
"$",
"info",
"=",
"$",
"this",
"->",
"object",
"->",
"info",
"(",
")",
";",
"}",
"catch",
"(",
"ServiceException",
"$",
"e",
")",
"{",
"// couldn't stat file",
"return",
"false",
";",
"}",
"// equivalent to 100666 and 100444 in octal",
"$",
"stats",
"=",
"array",
"(",
"'mode'",
"=>",
"$",
"this",
"->",
"bucket",
"->",
"isWritable",
"(",
")",
"?",
"self",
"::",
"FILE_WRITABLE_MODE",
":",
"self",
"::",
"FILE_READABLE_MODE",
")",
";",
"$",
"this",
"->",
"statsFromFileInfo",
"(",
"$",
"info",
",",
"$",
"stats",
")",
";",
"return",
"$",
"this",
"->",
"makeStatArray",
"(",
"$",
"stats",
")",
";",
"}"
] | Calculate the `url_stat` response for a file
@return array|bool | [
"Calculate",
"the",
"url_stat",
"response",
"for",
"a",
"file"
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Storage/src/StreamWrapper.php#L579-L597 | train |
googleapis/google-cloud-php | Dlp/src/V2/CustomInfoType/Regex.php | Regex.setGroupIndexes | public function setGroupIndexes($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32);
$this->group_indexes = $arr;
return $this;
} | php | public function setGroupIndexes($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32);
$this->group_indexes = $arr;
return $this;
} | [
"public",
"function",
"setGroupIndexes",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"INT32",
")",
";",
"$",
"this",
"->",
"group_indexes",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | The index of the submatch to extract as findings. When not
specified, the entire match is returned. No more than 3 may be included.
Generated from protobuf field <code>repeated int32 group_indexes = 2;</code>
@param int[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"The",
"index",
"of",
"the",
"submatch",
"to",
"extract",
"as",
"findings",
".",
"When",
"not",
"specified",
"the",
"entire",
"match",
"is",
"returned",
".",
"No",
"more",
"than",
"3",
"may",
"be",
"included",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/CustomInfoType/Regex.php#L104-L110 | train |
googleapis/google-cloud-php | Monitoring/src/V3/UptimeCheckServiceGrpcClient.php | UptimeCheckServiceGrpcClient.ListUptimeCheckIps | public function ListUptimeCheckIps(\Google\Cloud\Monitoring\V3\ListUptimeCheckIpsRequest $argument,
$metadata = [], $options = []) {
return $this->_simpleRequest('/google.monitoring.v3.UptimeCheckService/ListUptimeCheckIps',
$argument,
['\Google\Cloud\Monitoring\V3\ListUptimeCheckIpsResponse', 'decode'],
$metadata, $options);
} | php | public function ListUptimeCheckIps(\Google\Cloud\Monitoring\V3\ListUptimeCheckIpsRequest $argument,
$metadata = [], $options = []) {
return $this->_simpleRequest('/google.monitoring.v3.UptimeCheckService/ListUptimeCheckIps',
$argument,
['\Google\Cloud\Monitoring\V3\ListUptimeCheckIpsResponse', 'decode'],
$metadata, $options);
} | [
"public",
"function",
"ListUptimeCheckIps",
"(",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Monitoring",
"\\",
"V3",
"\\",
"ListUptimeCheckIpsRequest",
"$",
"argument",
",",
"$",
"metadata",
"=",
"[",
"]",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"_simpleRequest",
"(",
"'/google.monitoring.v3.UptimeCheckService/ListUptimeCheckIps'",
",",
"$",
"argument",
",",
"[",
"'\\Google\\Cloud\\Monitoring\\V3\\ListUptimeCheckIpsResponse'",
",",
"'decode'",
"]",
",",
"$",
"metadata",
",",
"$",
"options",
")",
";",
"}"
] | Returns the list of IPs that checkers run from
@param \Google\Cloud\Monitoring\V3\ListUptimeCheckIpsRequest $argument input argument
@param array $metadata metadata
@param array $options call options | [
"Returns",
"the",
"list",
"of",
"IPs",
"that",
"checkers",
"run",
"from"
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Monitoring/src/V3/UptimeCheckServiceGrpcClient.php#L125-L131 | train |
googleapis/google-cloud-php | Core/src/SysvTrait.php | SysvTrait.getSysvKey | private function getSysvKey($idNum)
{
$key = getenv('GOOGLE_CLOUD_SYSV_ID') ?: self::$productionKey;
$base = ftok(__FILE__, $key);
if ($base == PHP_INT_MAX) {
$base = 1;
}
return $base + $idNum;
} | php | private function getSysvKey($idNum)
{
$key = getenv('GOOGLE_CLOUD_SYSV_ID') ?: self::$productionKey;
$base = ftok(__FILE__, $key);
if ($base == PHP_INT_MAX) {
$base = 1;
}
return $base + $idNum;
} | [
"private",
"function",
"getSysvKey",
"(",
"$",
"idNum",
")",
"{",
"$",
"key",
"=",
"getenv",
"(",
"'GOOGLE_CLOUD_SYSV_ID'",
")",
"?",
":",
"self",
"::",
"$",
"productionKey",
";",
"$",
"base",
"=",
"ftok",
"(",
"__FILE__",
",",
"$",
"key",
")",
";",
"if",
"(",
"$",
"base",
"==",
"PHP_INT_MAX",
")",
"{",
"$",
"base",
"=",
"1",
";",
"}",
"return",
"$",
"base",
"+",
"$",
"idNum",
";",
"}"
] | Create a SystemV IPC key for the given id number.
Set GOOGLE_CLOUD_SYSV_ID envvar to change the base id.
@param int $idNum An id number.
@return int | [
"Create",
"a",
"SystemV",
"IPC",
"key",
"for",
"the",
"given",
"id",
"number",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Core/src/SysvTrait.php#L42-L50 | train |
googleapis/google-cloud-php | Dlp/src/V2/InspectConfig.php | InspectConfig.setContentOptions | public function setContentOptions($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\Dlp\V2\ContentOption::class);
$this->content_options = $arr;
return $this;
} | php | public function setContentOptions($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\Dlp\V2\ContentOption::class);
$this->content_options = $arr;
return $this;
} | [
"public",
"function",
"setContentOptions",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"ENUM",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dlp",
"\\",
"V2",
"\\",
"ContentOption",
"::",
"class",
")",
";",
"$",
"this",
"->",
"content_options",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | List of options defining data content to scan.
If empty, text, images, and other content will be included.
Generated from protobuf field <code>repeated .google.privacy.dlp.v2.ContentOption content_options = 8;</code>
@param int[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"List",
"of",
"options",
"defining",
"data",
"content",
"to",
"scan",
".",
"If",
"empty",
"text",
"images",
"and",
"other",
"content",
"will",
"be",
"included",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/InspectConfig.php#L325-L331 | train |
googleapis/google-cloud-php | Dlp/src/V2/InspectConfig.php | InspectConfig.setRuleSet | public function setRuleSet($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dlp\V2\InspectionRuleSet::class);
$this->rule_set = $arr;
return $this;
} | php | public function setRuleSet($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dlp\V2\InspectionRuleSet::class);
$this->rule_set = $arr;
return $this;
} | [
"public",
"function",
"setRuleSet",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dlp",
"\\",
"V2",
"\\",
"InspectionRuleSet",
"::",
"class",
")",
";",
"$",
"this",
"->",
"rule_set",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | Set of rules to apply to the findings for this InspectConfig.
Exclusion rules, contained in the set are executed in the end, other
rules are executed in the order they are specified for each info type.
Generated from protobuf field <code>repeated .google.privacy.dlp.v2.InspectionRuleSet rule_set = 10;</code>
@param \Google\Cloud\Dlp\V2\InspectionRuleSet[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"Set",
"of",
"rules",
"to",
"apply",
"to",
"the",
"findings",
"for",
"this",
"InspectConfig",
".",
"Exclusion",
"rules",
"contained",
"in",
"the",
"set",
"are",
"executed",
"in",
"the",
"end",
"other",
"rules",
"are",
"executed",
"in",
"the",
"order",
"they",
"are",
"specified",
"for",
"each",
"info",
"type",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/InspectConfig.php#L355-L361 | train |
googleapis/google-cloud-php | Monitoring/src/V3/ListTimeSeriesResponse.php | ListTimeSeriesResponse.setTimeSeries | public function setTimeSeries($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Monitoring\V3\TimeSeries::class);
$this->time_series = $arr;
return $this;
} | php | public function setTimeSeries($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Monitoring\V3\TimeSeries::class);
$this->time_series = $arr;
return $this;
} | [
"public",
"function",
"setTimeSeries",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Monitoring",
"\\",
"V3",
"\\",
"TimeSeries",
"::",
"class",
")",
";",
"$",
"this",
"->",
"time_series",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | One or more time series that match the filter included in the request.
Generated from protobuf field <code>repeated .google.monitoring.v3.TimeSeries time_series = 1;</code>
@param \Google\Cloud\Monitoring\V3\TimeSeries[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"One",
"or",
"more",
"time",
"series",
"that",
"match",
"the",
"filter",
"included",
"in",
"the",
"request",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Monitoring/src/V3/ListTimeSeriesResponse.php#L80-L86 | train |
googleapis/google-cloud-php | Monitoring/src/V3/ListTimeSeriesResponse.php | ListTimeSeriesResponse.setExecutionErrors | public function setExecutionErrors($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Rpc\Status::class);
$this->execution_errors = $arr;
return $this;
} | php | public function setExecutionErrors($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Rpc\Status::class);
$this->execution_errors = $arr;
return $this;
} | [
"public",
"function",
"setExecutionErrors",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Rpc",
"\\",
"Status",
"::",
"class",
")",
";",
"$",
"this",
"->",
"execution_errors",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | Query execution errors that may have caused the time series data returned
to be incomplete.
Generated from protobuf field <code>repeated .google.rpc.Status execution_errors = 3;</code>
@param \Google\Rpc\Status[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"Query",
"execution",
"errors",
"that",
"may",
"have",
"caused",
"the",
"time",
"series",
"data",
"returned",
"to",
"be",
"incomplete",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Monitoring/src/V3/ListTimeSeriesResponse.php#L138-L144 | train |
googleapis/google-cloud-php | WebRisk/src/V1beta1/ComputeThreatListDiffRequest.php | ComputeThreatListDiffRequest.setThreatType | public function setThreatType($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\WebRisk\V1beta1\ThreatType::class);
$this->threat_type = $var;
return $this;
} | php | public function setThreatType($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\WebRisk\V1beta1\ThreatType::class);
$this->threat_type = $var;
return $this;
} | [
"public",
"function",
"setThreatType",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"WebRisk",
"\\",
"V1beta1",
"\\",
"ThreatType",
"::",
"class",
")",
";",
"$",
"this",
"->",
"threat_type",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Required. The ThreatList to update.
Generated from protobuf field <code>.google.cloud.webrisk.v1beta1.ThreatType threat_type = 1;</code>
@param int $var
@return $this | [
"Required",
".",
"The",
"ThreatList",
"to",
"update",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/WebRisk/src/V1beta1/ComputeThreatListDiffRequest.php#L76-L82 | train |
googleapis/google-cloud-php | WebRisk/src/V1beta1/ComputeThreatListDiffRequest.php | ComputeThreatListDiffRequest.setConstraints | public function setConstraints($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\WebRisk\V1beta1\ComputeThreatListDiffRequest_Constraints::class);
$this->constraints = $var;
return $this;
} | php | public function setConstraints($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\WebRisk\V1beta1\ComputeThreatListDiffRequest_Constraints::class);
$this->constraints = $var;
return $this;
} | [
"public",
"function",
"setConstraints",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"WebRisk",
"\\",
"V1beta1",
"\\",
"ComputeThreatListDiffRequest_Constraints",
"::",
"class",
")",
";",
"$",
"this",
"->",
"constraints",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | The constraints associated with this request.
Generated from protobuf field <code>.google.cloud.webrisk.v1beta1.ComputeThreatListDiffRequest.Constraints constraints = 3;</code>
@param \Google\Cloud\WebRisk\V1beta1\ComputeThreatListDiffRequest\Constraints $var
@return $this | [
"The",
"constraints",
"associated",
"with",
"this",
"request",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/WebRisk/src/V1beta1/ComputeThreatListDiffRequest.php#L130-L136 | train |
googleapis/google-cloud-php | Bigtable/src/Admin/V2/ListAppProfilesResponse.php | ListAppProfilesResponse.setAppProfiles | public function setAppProfiles($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Bigtable\Admin\V2\AppProfile::class);
$this->app_profiles = $arr;
return $this;
} | php | public function setAppProfiles($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Bigtable\Admin\V2\AppProfile::class);
$this->app_profiles = $arr;
return $this;
} | [
"public",
"function",
"setAppProfiles",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Bigtable",
"\\",
"Admin",
"\\",
"V2",
"\\",
"AppProfile",
"::",
"class",
")",
";",
"$",
"this",
"->",
"app_profiles",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | The list of requested app profiles.
Generated from protobuf field <code>repeated .google.bigtable.admin.v2.AppProfile app_profiles = 1;</code>
@param \Google\Cloud\Bigtable\Admin\V2\AppProfile[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"The",
"list",
"of",
"requested",
"app",
"profiles",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Bigtable/src/Admin/V2/ListAppProfilesResponse.php#L84-L90 | train |
googleapis/google-cloud-php | Spanner/src/Operation.php | Operation.mutation | public function mutation($operation, $table, $mutation)
{
return [
$operation => [
'table' => $table,
'columns' => array_keys($mutation),
'values' => $this->mapper->encodeValuesAsSimpleType(array_values($mutation))
]
];
} | php | public function mutation($operation, $table, $mutation)
{
return [
$operation => [
'table' => $table,
'columns' => array_keys($mutation),
'values' => $this->mapper->encodeValuesAsSimpleType(array_values($mutation))
]
];
} | [
"public",
"function",
"mutation",
"(",
"$",
"operation",
",",
"$",
"table",
",",
"$",
"mutation",
")",
"{",
"return",
"[",
"$",
"operation",
"=>",
"[",
"'table'",
"=>",
"$",
"table",
",",
"'columns'",
"=>",
"array_keys",
"(",
"$",
"mutation",
")",
",",
"'values'",
"=>",
"$",
"this",
"->",
"mapper",
"->",
"encodeValuesAsSimpleType",
"(",
"array_values",
"(",
"$",
"mutation",
")",
")",
"]",
"]",
";",
"}"
] | Create a formatted mutation.
@param string $operation The operation type.
@param string $table The table name.
@param array $mutation The mutation data, represented as a set of
key/value pairs.
@return array | [
"Create",
"a",
"formatted",
"mutation",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Operation.php#L84-L93 | train |
googleapis/google-cloud-php | Spanner/src/Operation.php | Operation.deleteMutation | public function deleteMutation($table, KeySet $keySet)
{
return [
self::OP_DELETE => [
'table' => $table,
'keySet' => $this->flattenKeySet($keySet),
]
];
} | php | public function deleteMutation($table, KeySet $keySet)
{
return [
self::OP_DELETE => [
'table' => $table,
'keySet' => $this->flattenKeySet($keySet),
]
];
} | [
"public",
"function",
"deleteMutation",
"(",
"$",
"table",
",",
"KeySet",
"$",
"keySet",
")",
"{",
"return",
"[",
"self",
"::",
"OP_DELETE",
"=>",
"[",
"'table'",
"=>",
"$",
"table",
",",
"'keySet'",
"=>",
"$",
"this",
"->",
"flattenKeySet",
"(",
"$",
"keySet",
")",
",",
"]",
"]",
";",
"}"
] | Create a formatted delete mutation.
@param string $table The table name.
@param KeySet $keySet The keys to delete.
@return array | [
"Create",
"a",
"formatted",
"delete",
"mutation",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Operation.php#L102-L110 | train |
googleapis/google-cloud-php | Spanner/src/Operation.php | Operation.commit | public function commit(Session $session, array $mutations, array $options = [])
{
$options += [
'transactionId' => null
];
$res = $this->connection->commit($this->arrayFilterRemoveNull([
'mutations' => $mutations,
'session' => $session->name(),
'database' => $session->info()['database']
]) + $options);
$time = $this->parseTimeString($res['commitTimestamp']);
return new Timestamp($time[0], $time[1]);
} | php | public function commit(Session $session, array $mutations, array $options = [])
{
$options += [
'transactionId' => null
];
$res = $this->connection->commit($this->arrayFilterRemoveNull([
'mutations' => $mutations,
'session' => $session->name(),
'database' => $session->info()['database']
]) + $options);
$time = $this->parseTimeString($res['commitTimestamp']);
return new Timestamp($time[0], $time[1]);
} | [
"public",
"function",
"commit",
"(",
"Session",
"$",
"session",
",",
"array",
"$",
"mutations",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"+=",
"[",
"'transactionId'",
"=>",
"null",
"]",
";",
"$",
"res",
"=",
"$",
"this",
"->",
"connection",
"->",
"commit",
"(",
"$",
"this",
"->",
"arrayFilterRemoveNull",
"(",
"[",
"'mutations'",
"=>",
"$",
"mutations",
",",
"'session'",
"=>",
"$",
"session",
"->",
"name",
"(",
")",
",",
"'database'",
"=>",
"$",
"session",
"->",
"info",
"(",
")",
"[",
"'database'",
"]",
"]",
")",
"+",
"$",
"options",
")",
";",
"$",
"time",
"=",
"$",
"this",
"->",
"parseTimeString",
"(",
"$",
"res",
"[",
"'commitTimestamp'",
"]",
")",
";",
"return",
"new",
"Timestamp",
"(",
"$",
"time",
"[",
"0",
"]",
",",
"$",
"time",
"[",
"1",
"]",
")",
";",
"}"
] | Commit all enqueued mutations.
@codingStandardsIgnoreStart
@param Session $session The session ID to use for the commit.
@param Transaction $transaction The transaction to commit.
@param array $options [optional] {
Configuration options.
@type string $transactionId The ID of the transaction.
}
@return Timestamp The commit Timestamp. | [
"Commit",
"all",
"enqueued",
"mutations",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Operation.php#L125-L139 | train |
googleapis/google-cloud-php | Spanner/src/Operation.php | Operation.rollback | public function rollback(Session $session, $transactionId, array $options = [])
{
return $this->connection->rollback([
'transactionId' => $transactionId,
'session' => $session->name(),
'database' => $session->info()['database']
] + $options);
} | php | public function rollback(Session $session, $transactionId, array $options = [])
{
return $this->connection->rollback([
'transactionId' => $transactionId,
'session' => $session->name(),
'database' => $session->info()['database']
] + $options);
} | [
"public",
"function",
"rollback",
"(",
"Session",
"$",
"session",
",",
"$",
"transactionId",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"connection",
"->",
"rollback",
"(",
"[",
"'transactionId'",
"=>",
"$",
"transactionId",
",",
"'session'",
"=>",
"$",
"session",
"->",
"name",
"(",
")",
",",
"'database'",
"=>",
"$",
"session",
"->",
"info",
"(",
")",
"[",
"'database'",
"]",
"]",
"+",
"$",
"options",
")",
";",
"}"
] | Rollback a Transaction.
@param Session $session The session to use for the rollback.
Note that the session MUST be the same one in which the
transaction was created.
@param string $transactionId The transaction to roll back.
@param array $options [optional] Configuration Options.
@return void | [
"Rollback",
"a",
"Transaction",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Operation.php#L151-L158 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.