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 | Language/src/LanguageClient.php | LanguageClient.analyzeEntitySentiment | public function analyzeEntitySentiment($content, array $options = [])
{
return new Annotation(
$this->connection->analyzeEntitySentiment(
$this->formatRequest($content, $options)
)
);
} | php | public function analyzeEntitySentiment($content, array $options = [])
{
return new Annotation(
$this->connection->analyzeEntitySentiment(
$this->formatRequest($content, $options)
)
);
} | [
"public",
"function",
"analyzeEntitySentiment",
"(",
"$",
"content",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"return",
"new",
"Annotation",
"(",
"$",
"this",
"->",
"connection",
"->",
"analyzeEntitySentiment",
"(",
"$",
"this",
"->",
"formatRequest",
"(",
"$",
"content",
",",
"$",
"options",
")",
")",
")",
";",
"}"
] | Finds entities in the text and analyzes sentiment associated with each
entity and its mentions.
Example:
```
$annotation = $language->analyzeEntitySentiment('Google Cloud Platform is a powerful tool.');
$entities = $annotation->entities();
echo 'Entity name: ' . $entities[0]['name'] . PHP_EOL;
if ($entities[0]['sentiment']['score'] > 0) {
echo 'This is a positive message.';
}
```
@codingStandardsIgnoreStart
@see https://cloud.google.com/natural-language/docs/reference/rest/v1/documents/analyzeEntitySentiment Analyze Entity Sentiment API documentation
@codingStandardsIgnoreEnd
@param string|StorageObject $content The content to analyze. May be
either a string of UTF-8 encoded content, a URI pointing to a
Google Cloud Storage object in the format of
`gs://{bucket-name}/{object-name}` or a
{@see Google\Cloud\Storage\StorageObject}.
@param array $options [optional] {
Configuration options.
@type bool $detectGcsUri When providing $content as a string, this
flag determines whether or not to attempt to detect if the
string represents a Google Cloud Storage URI in the format of
`gs://{bucket-name}/{object-name}`. **Defaults to** `true`.
@type string $type The document type. Acceptable values are
`PLAIN_TEXT` or `HTML`. **Defaults to** `"PLAIN_TEXT"`.
@type string $language The language of the document. Both ISO
(e.g., en, es) and BCP-47 (e.g., en-US, es-ES) language codes
are accepted. If no value is provided, the language will be
detected by the service.
@type string $encodingType The text encoding type used by the API to
calculate offsets. Acceptable values are `"NONE"`, `"UTF8"`,
`"UTF16"` and `"UTF32"`. **Defaults to** `"UTF8"`. Please note
the following behaviors for the encoding type setting: `"NONE"`
will return a value of "-1" for offsets. `"UTF8"` will
return byte offsets. `"UTF16"` will return
[code unit](http://unicode.org/glossary/#code_unit) offsets.
`"UTF32"` will return
[unicode character](http://unicode.org/glossary/#character)
offsets.
}
@return Annotation | [
"Finds",
"entities",
"in",
"the",
"text",
"and",
"analyzes",
"sentiment",
"associated",
"with",
"each",
"entity",
"and",
"its",
"mentions",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Language/src/LanguageClient.php#L277-L284 | train |
googleapis/google-cloud-php | Language/src/LanguageClient.php | LanguageClient.analyzeSyntax | public function analyzeSyntax($content, array $options = [])
{
$syntaxResponse = $this->connection->analyzeSyntax(
$this->formatRequest($content, $options)
);
return new Annotation($syntaxResponse + ['entities' => []]);
} | php | public function analyzeSyntax($content, array $options = [])
{
$syntaxResponse = $this->connection->analyzeSyntax(
$this->formatRequest($content, $options)
);
return new Annotation($syntaxResponse + ['entities' => []]);
} | [
"public",
"function",
"analyzeSyntax",
"(",
"$",
"content",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"syntaxResponse",
"=",
"$",
"this",
"->",
"connection",
"->",
"analyzeSyntax",
"(",
"$",
"this",
"->",
"formatRequest",
"(",
"$",
"content",
",",
"$",
"options",
")",
")",
";",
"return",
"new",
"Annotation",
"(",
"$",
"syntaxResponse",
"+",
"[",
"'entities'",
"=>",
"[",
"]",
"]",
")",
";",
"}"
] | Analyzes the document and provides a full set of text annotations.
Example:
```
$annotation = $language->analyzeSyntax('Google Cloud Platform is a powerful tool.');
foreach ($annotation->sentences() as $sentence) {
echo $sentence['text']['beginOffset'];
}
```
@codingStandardsIgnoreStart
@see https://cloud.google.com/natural-language/docs/reference/rest/v1/documents/analyzeSyntax Analyze Syntax API documentation
@codingStandardsIgnoreEnd
@param string|StorageObject $content The content to analyze. May be
either a string of UTF-8 encoded content, a URI pointing to a
Google Cloud Storage object in the format of
`gs://{bucket-name}/{object-name}` or a
{@see Google\Cloud\Storage\StorageObject}.
@param array $options [optional] {
Configuration options.
@type bool $detectGcsUri When providing $content as a string, this
flag determines whether or not to attempt to detect if the
string represents a Google Cloud Storage URI in the format of
`gs://{bucket-name}/{object-name}`. **Defaults to** `true`.
@type string $type The document type. Acceptable values are
`PLAIN_TEXT` or `HTML`. **Defaults to** `"PLAIN_TEXT"`.
@type string $language The language of the document. Both ISO
(e.g., en, es) and BCP-47 (e.g., en-US, es-ES) language codes
are accepted. If no value is provided, the language will be
detected by the service.
@type string $encodingType The text encoding type used by the API to
calculate offsets. Acceptable values are `"NONE"`, `"UTF8"`,
`"UTF16"` and `"UTF32"`. **Defaults to** `"UTF8"`. Please note
the following behaviors for the encoding type setting: `"NONE"`
will return a value of "-1" for offsets. `"UTF8"` will
return byte offsets. `"UTF16"` will return
[code unit](http://unicode.org/glossary/#code_unit) offsets.
`"UTF32"` will return
[unicode character](http://unicode.org/glossary/#character)
offsets.
}
@return Annotation | [
"Analyzes",
"the",
"document",
"and",
"provides",
"a",
"full",
"set",
"of",
"text",
"annotations",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Language/src/LanguageClient.php#L333-L340 | train |
googleapis/google-cloud-php | Language/src/LanguageClient.php | LanguageClient.normalizeFeatures | private function normalizeFeatures(array $features)
{
$results = [];
foreach ($features as $feature) {
$featureName = array_key_exists($feature, $this->featureShortNames)
? $this->featureShortNames[$feature]
: $feature;
$results[$featureName] = true;
}
return $results;
} | php | private function normalizeFeatures(array $features)
{
$results = [];
foreach ($features as $feature) {
$featureName = array_key_exists($feature, $this->featureShortNames)
? $this->featureShortNames[$feature]
: $feature;
$results[$featureName] = true;
}
return $results;
} | [
"private",
"function",
"normalizeFeatures",
"(",
"array",
"$",
"features",
")",
"{",
"$",
"results",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"features",
"as",
"$",
"feature",
")",
"{",
"$",
"featureName",
"=",
"array_key_exists",
"(",
"$",
"feature",
",",
"$",
"this",
"->",
"featureShortNames",
")",
"?",
"$",
"this",
"->",
"featureShortNames",
"[",
"$",
"feature",
"]",
":",
"$",
"feature",
";",
"$",
"results",
"[",
"$",
"featureName",
"]",
"=",
"true",
";",
"}",
"return",
"$",
"results",
";",
"}"
] | Configures features in a way the API expects.
@param array $features An array of features to normalize.
@return array | [
"Configures",
"features",
"in",
"a",
"way",
"the",
"API",
"expects",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Language/src/LanguageClient.php#L472-L485 | train |
googleapis/google-cloud-php | Monitoring/src/V3/NotificationChannelServiceGrpcClient.php | NotificationChannelServiceGrpcClient.SendNotificationChannelVerificationCode | public function SendNotificationChannelVerificationCode(\Google\Cloud\Monitoring\V3\SendNotificationChannelVerificationCodeRequest $argument,
$metadata = [], $options = []) {
return $this->_simpleRequest('/google.monitoring.v3.NotificationChannelService/SendNotificationChannelVerificationCode',
$argument,
['\Google\Protobuf\GPBEmpty', 'decode'],
$metadata, $options);
} | php | public function SendNotificationChannelVerificationCode(\Google\Cloud\Monitoring\V3\SendNotificationChannelVerificationCodeRequest $argument,
$metadata = [], $options = []) {
return $this->_simpleRequest('/google.monitoring.v3.NotificationChannelService/SendNotificationChannelVerificationCode',
$argument,
['\Google\Protobuf\GPBEmpty', 'decode'],
$metadata, $options);
} | [
"public",
"function",
"SendNotificationChannelVerificationCode",
"(",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Monitoring",
"\\",
"V3",
"\\",
"SendNotificationChannelVerificationCodeRequest",
"$",
"argument",
",",
"$",
"metadata",
"=",
"[",
"]",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"_simpleRequest",
"(",
"'/google.monitoring.v3.NotificationChannelService/SendNotificationChannelVerificationCode'",
",",
"$",
"argument",
",",
"[",
"'\\Google\\Protobuf\\GPBEmpty'",
",",
"'decode'",
"]",
",",
"$",
"metadata",
",",
"$",
"options",
")",
";",
"}"
] | Causes a verification code to be delivered to the channel. The code
can then be supplied in `VerifyNotificationChannel` to verify the channel.
@param \Google\Cloud\Monitoring\V3\SendNotificationChannelVerificationCodeRequest $argument input argument
@param array $metadata metadata
@param array $options call options | [
"Causes",
"a",
"verification",
"code",
"to",
"be",
"delivered",
"to",
"the",
"channel",
".",
"The",
"code",
"can",
"then",
"be",
"supplied",
"in",
"VerifyNotificationChannel",
"to",
"verify",
"the",
"channel",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Monitoring/src/V3/NotificationChannelServiceGrpcClient.php#L150-L156 | train |
googleapis/google-cloud-php | Monitoring/src/V3/NotificationChannelServiceGrpcClient.php | NotificationChannelServiceGrpcClient.VerifyNotificationChannel | public function VerifyNotificationChannel(\Google\Cloud\Monitoring\V3\VerifyNotificationChannelRequest $argument,
$metadata = [], $options = []) {
return $this->_simpleRequest('/google.monitoring.v3.NotificationChannelService/VerifyNotificationChannel',
$argument,
['\Google\Cloud\Monitoring\V3\NotificationChannel', 'decode'],
$metadata, $options);
} | php | public function VerifyNotificationChannel(\Google\Cloud\Monitoring\V3\VerifyNotificationChannelRequest $argument,
$metadata = [], $options = []) {
return $this->_simpleRequest('/google.monitoring.v3.NotificationChannelService/VerifyNotificationChannel',
$argument,
['\Google\Cloud\Monitoring\V3\NotificationChannel', 'decode'],
$metadata, $options);
} | [
"public",
"function",
"VerifyNotificationChannel",
"(",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Monitoring",
"\\",
"V3",
"\\",
"VerifyNotificationChannelRequest",
"$",
"argument",
",",
"$",
"metadata",
"=",
"[",
"]",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"_simpleRequest",
"(",
"'/google.monitoring.v3.NotificationChannelService/VerifyNotificationChannel'",
",",
"$",
"argument",
",",
"[",
"'\\Google\\Cloud\\Monitoring\\V3\\NotificationChannel'",
",",
"'decode'",
"]",
",",
"$",
"metadata",
",",
"$",
"options",
")",
";",
"}"
] | Verifies a `NotificationChannel` by proving receipt of the code
delivered to the channel as a result of calling
`SendNotificationChannelVerificationCode`.
@param \Google\Cloud\Monitoring\V3\VerifyNotificationChannelRequest $argument input argument
@param array $metadata metadata
@param array $options call options | [
"Verifies",
"a",
"NotificationChannel",
"by",
"proving",
"receipt",
"of",
"the",
"code",
"delivered",
"to",
"the",
"channel",
"as",
"a",
"result",
"of",
"calling",
"SendNotificationChannelVerificationCode",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Monitoring/src/V3/NotificationChannelServiceGrpcClient.php#L200-L206 | train |
googleapis/google-cloud-php | WebRisk/src/V1beta1/RawIndices.php | RawIndices.setIndices | public function setIndices($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32);
$this->indices = $arr;
return $this;
} | php | public function setIndices($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32);
$this->indices = $arr;
return $this;
} | [
"public",
"function",
"setIndices",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"INT32",
")",
";",
"$",
"this",
"->",
"indices",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | The indices to remove from a lexicographically-sorted local list.
Generated from protobuf field <code>repeated int32 indices = 1;</code>
@param int[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"The",
"indices",
"to",
"remove",
"from",
"a",
"lexicographically",
"-",
"sorted",
"local",
"list",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/WebRisk/src/V1beta1/RawIndices.php#L58-L64 | train |
googleapis/google-cloud-php | Dataproc/src/V1beta2/Gapic/WorkflowTemplateServiceGapicClient.php | WorkflowTemplateServiceGapicClient.workflowTemplateName | public static function workflowTemplateName($project, $region, $workflowTemplate)
{
return self::getWorkflowTemplateNameTemplate()->render([
'project' => $project,
'region' => $region,
'workflow_template' => $workflowTemplate,
]);
} | php | public static function workflowTemplateName($project, $region, $workflowTemplate)
{
return self::getWorkflowTemplateNameTemplate()->render([
'project' => $project,
'region' => $region,
'workflow_template' => $workflowTemplate,
]);
} | [
"public",
"static",
"function",
"workflowTemplateName",
"(",
"$",
"project",
",",
"$",
"region",
",",
"$",
"workflowTemplate",
")",
"{",
"return",
"self",
"::",
"getWorkflowTemplateNameTemplate",
"(",
")",
"->",
"render",
"(",
"[",
"'project'",
"=>",
"$",
"project",
",",
"'region'",
"=>",
"$",
"region",
",",
"'workflow_template'",
"=>",
"$",
"workflowTemplate",
",",
"]",
")",
";",
"}"
] | Formats a string containing the fully-qualified path to represent
a workflow_template resource.
@param string $project
@param string $region
@param string $workflowTemplate
@return string The formatted workflow_template resource.
@experimental | [
"Formats",
"a",
"string",
"containing",
"the",
"fully",
"-",
"qualified",
"path",
"to",
"represent",
"a",
"workflow_template",
"resource",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dataproc/src/V1beta2/Gapic/WorkflowTemplateServiceGapicClient.php#L192-L199 | train |
googleapis/google-cloud-php | Monitoring/src/V3/ListAlertPoliciesResponse.php | ListAlertPoliciesResponse.setAlertPolicies | public function setAlertPolicies($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Monitoring\V3\AlertPolicy::class);
$this->alert_policies = $arr;
return $this;
} | php | public function setAlertPolicies($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Monitoring\V3\AlertPolicy::class);
$this->alert_policies = $arr;
return $this;
} | [
"public",
"function",
"setAlertPolicies",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Monitoring",
"\\",
"V3",
"\\",
"AlertPolicy",
"::",
"class",
")",
";",
"$",
"this",
"->",
"alert_policies",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | The returned alert policies.
Generated from protobuf field <code>repeated .google.monitoring.v3.AlertPolicy alert_policies = 3;</code>
@param \Google\Cloud\Monitoring\V3\AlertPolicy[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"The",
"returned",
"alert",
"policies",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Monitoring/src/V3/ListAlertPoliciesResponse.php#L70-L76 | train |
googleapis/google-cloud-php | Talent/src/V4beta1/Patent.php | Patent.setInventors | public function setInventors($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->inventors = $arr;
return $this;
} | php | public function setInventors($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->inventors = $arr;
return $this;
} | [
"public",
"function",
"setInventors",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"STRING",
")",
";",
"$",
"this",
"->",
"inventors",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | Optional.
A list of inventors' names.
Number of characters allowed for each is 100.
Generated from protobuf field <code>repeated string inventors = 2;</code>
@param string[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"Optional",
".",
"A",
"list",
"of",
"inventors",
"names",
".",
"Number",
"of",
"characters",
"allowed",
"for",
"each",
"is",
"100",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Talent/src/V4beta1/Patent.php#L186-L192 | train |
googleapis/google-cloud-php | Talent/src/V4beta1/Patent.php | Patent.setSkillsUsed | public function setSkillsUsed($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Talent\V4beta1\Skill::class);
$this->skills_used = $arr;
return $this;
} | php | public function setSkillsUsed($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Talent\V4beta1\Skill::class);
$this->skills_used = $arr;
return $this;
} | [
"public",
"function",
"setSkillsUsed",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Talent",
"\\",
"V4beta1",
"\\",
"Skill",
"::",
"class",
")",
";",
"$",
"this",
"->",
"skills_used",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | Optional.
The skills used in this patent.
Generated from protobuf field <code>repeated .google.cloud.talent.v4beta1.Skill skills_used = 9;</code>
@param \Google\Cloud\Talent\V4beta1\Skill[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"Optional",
".",
"The",
"skills",
"used",
"in",
"this",
"patent",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Talent/src/V4beta1/Patent.php#L390-L396 | train |
googleapis/google-cloud-php | Vision/src/V1/ListProductsResponse.php | ListProductsResponse.setProducts | public function setProducts($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\Product::class);
$this->products = $arr;
return $this;
} | php | public function setProducts($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\Product::class);
$this->products = $arr;
return $this;
} | [
"public",
"function",
"setProducts",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Vision",
"\\",
"V1",
"\\",
"Product",
"::",
"class",
")",
";",
"$",
"this",
"->",
"products",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | List of products.
Generated from protobuf field <code>repeated .google.cloud.vision.v1.Product products = 1;</code>
@param \Google\Cloud\Vision\V1\Product[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"List",
"of",
"products",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Vision/src/V1/ListProductsResponse.php#L68-L74 | train |
googleapis/google-cloud-php | Vision/src/V1/ProductSearchResults.php | ProductSearchResults.setResults | public function setResults($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\ProductSearchResults\Result::class);
$this->results = $arr;
return $this;
} | php | public function setResults($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\ProductSearchResults\Result::class);
$this->results = $arr;
return $this;
} | [
"public",
"function",
"setResults",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Vision",
"\\",
"V1",
"\\",
"ProductSearchResults",
"\\",
"Result",
"::",
"class",
")",
";",
"$",
"this",
"->",
"results",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | List of results, one for each product match.
Generated from protobuf field <code>repeated .google.cloud.vision.v1.ProductSearchResults.Result results = 5;</code>
@param \Google\Cloud\Vision\V1\ProductSearchResults\Result[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"List",
"of",
"results",
"one",
"for",
"each",
"product",
"match",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Vision/src/V1/ProductSearchResults.php#L114-L120 | train |
googleapis/google-cloud-php | Vision/src/V1/ProductSearchResults.php | ProductSearchResults.setProductGroupedResults | public function setProductGroupedResults($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\ProductSearchResults\GroupedResult::class);
$this->product_grouped_results = $arr;
return $this;
} | php | public function setProductGroupedResults($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\ProductSearchResults\GroupedResult::class);
$this->product_grouped_results = $arr;
return $this;
} | [
"public",
"function",
"setProductGroupedResults",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Vision",
"\\",
"V1",
"\\",
"ProductSearchResults",
"\\",
"GroupedResult",
"::",
"class",
")",
";",
"$",
"this",
"->",
"product_grouped_results",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | List of results grouped by products detected in the query image. Each entry
corresponds to one bounding polygon in the query image, and contains the
matching products specific to that region. There may be duplicate product
matches in the union of all the per-product results.
Generated from protobuf field <code>repeated .google.cloud.vision.v1.ProductSearchResults.GroupedResult product_grouped_results = 6;</code>
@param \Google\Cloud\Vision\V1\ProductSearchResults\GroupedResult[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"List",
"of",
"results",
"grouped",
"by",
"products",
"detected",
"in",
"the",
"query",
"image",
".",
"Each",
"entry",
"corresponds",
"to",
"one",
"bounding",
"polygon",
"in",
"the",
"query",
"image",
"and",
"contains",
"the",
"matching",
"products",
"specific",
"to",
"that",
"region",
".",
"There",
"may",
"be",
"duplicate",
"product",
"matches",
"in",
"the",
"union",
"of",
"all",
"the",
"per",
"-",
"product",
"results",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Vision/src/V1/ProductSearchResults.php#L146-L152 | train |
googleapis/google-cloud-php | Core/src/Iterator/ItemIteratorTrait.php | ItemIteratorTrait.current | public function current()
{
$page = $this->pageIterator->current();
return isset($page[$this->pageIndex])
? $page[$this->pageIndex]
: null;
} | php | public function current()
{
$page = $this->pageIterator->current();
return isset($page[$this->pageIndex])
? $page[$this->pageIndex]
: null;
} | [
"public",
"function",
"current",
"(",
")",
"{",
"$",
"page",
"=",
"$",
"this",
"->",
"pageIterator",
"->",
"current",
"(",
")",
";",
"return",
"isset",
"(",
"$",
"page",
"[",
"$",
"this",
"->",
"pageIndex",
"]",
")",
"?",
"$",
"page",
"[",
"$",
"this",
"->",
"pageIndex",
"]",
":",
"null",
";",
"}"
] | Get the current item.
@return mixed | [
"Get",
"the",
"current",
"item",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Core/src/Iterator/ItemIteratorTrait.php#L87-L94 | train |
googleapis/google-cloud-php | Core/src/Iterator/ItemIteratorTrait.php | ItemIteratorTrait.next | public function next()
{
$this->pageIndex++;
$this->position++;
if (count($this->pageIterator->current()) <= $this->pageIndex && $this->nextResultToken()) {
$this->pageIterator->next();
$this->pageIndex = 0;
}
} | php | public function next()
{
$this->pageIndex++;
$this->position++;
if (count($this->pageIterator->current()) <= $this->pageIndex && $this->nextResultToken()) {
$this->pageIterator->next();
$this->pageIndex = 0;
}
} | [
"public",
"function",
"next",
"(",
")",
"{",
"$",
"this",
"->",
"pageIndex",
"++",
";",
"$",
"this",
"->",
"position",
"++",
";",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"pageIterator",
"->",
"current",
"(",
")",
")",
"<=",
"$",
"this",
"->",
"pageIndex",
"&&",
"$",
"this",
"->",
"nextResultToken",
"(",
")",
")",
"{",
"$",
"this",
"->",
"pageIterator",
"->",
"next",
"(",
")",
";",
"$",
"this",
"->",
"pageIndex",
"=",
"0",
";",
"}",
"}"
] | Advances to the next item.
@return null | [
"Advances",
"to",
"the",
"next",
"item",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Core/src/Iterator/ItemIteratorTrait.php#L111-L120 | train |
googleapis/google-cloud-php | Core/src/Iterator/ItemIteratorTrait.php | ItemIteratorTrait.valid | public function valid()
{
$page = $this->pageIterator->current();
if (isset($page[$this->pageIndex])) {
return true;
}
// If there are no results, but a token for the next page
// exists let's continue paging until there are results.
while ($this->nextResultToken()) {
$this->pageIterator->next();
$page = $this->pageIterator->current();
if (isset($page[$this->pageIndex])) {
return true;
}
}
return false;
} | php | public function valid()
{
$page = $this->pageIterator->current();
if (isset($page[$this->pageIndex])) {
return true;
}
// If there are no results, but a token for the next page
// exists let's continue paging until there are results.
while ($this->nextResultToken()) {
$this->pageIterator->next();
$page = $this->pageIterator->current();
if (isset($page[$this->pageIndex])) {
return true;
}
}
return false;
} | [
"public",
"function",
"valid",
"(",
")",
"{",
"$",
"page",
"=",
"$",
"this",
"->",
"pageIterator",
"->",
"current",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"page",
"[",
"$",
"this",
"->",
"pageIndex",
"]",
")",
")",
"{",
"return",
"true",
";",
"}",
"// If there are no results, but a token for the next page",
"// exists let's continue paging until there are results.",
"while",
"(",
"$",
"this",
"->",
"nextResultToken",
"(",
")",
")",
"{",
"$",
"this",
"->",
"pageIterator",
"->",
"next",
"(",
")",
";",
"$",
"page",
"=",
"$",
"this",
"->",
"pageIterator",
"->",
"current",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"page",
"[",
"$",
"this",
"->",
"pageIndex",
"]",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] | Determines if the current position is valid.
@return bool | [
"Determines",
"if",
"the",
"current",
"position",
"is",
"valid",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Core/src/Iterator/ItemIteratorTrait.php#L127-L147 | train |
googleapis/google-cloud-php | Dataproc/src/V1beta2/SparkSqlJob.php | SparkSqlJob.setQueryList | public function setQueryList($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dataproc\V1beta2\QueryList::class);
$this->writeOneof(2, $var);
return $this;
} | php | public function setQueryList($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dataproc\V1beta2\QueryList::class);
$this->writeOneof(2, $var);
return $this;
} | [
"public",
"function",
"setQueryList",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dataproc",
"\\",
"V1beta2",
"\\",
"QueryList",
"::",
"class",
")",
";",
"$",
"this",
"->",
"writeOneof",
"(",
"2",
",",
"$",
"var",
")",
";",
"return",
"$",
"this",
";",
"}"
] | A list of queries.
Generated from protobuf field <code>.google.cloud.dataproc.v1beta2.QueryList query_list = 2;</code>
@param \Google\Cloud\Dataproc\V1beta2\QueryList $var
@return $this | [
"A",
"list",
"of",
"queries",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dataproc/src/V1beta2/SparkSqlJob.php#L120-L126 | train |
googleapis/google-cloud-php | Dataproc/src/V1beta2/SparkSqlJob.php | SparkSqlJob.setProperties | public function setProperties($var)
{
$arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING);
$this->properties = $arr;
return $this;
} | php | public function setProperties($var)
{
$arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING);
$this->properties = $arr;
return $this;
} | [
"public",
"function",
"setProperties",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkMapField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"STRING",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"STRING",
")",
";",
"$",
"this",
"->",
"properties",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | Optional. A mapping of property names to values, used to configure
Spark SQL's SparkConf. Properties that conflict with values set by the
Cloud Dataproc API may be overwritten.
Generated from protobuf field <code>map<string, string> properties = 4;</code>
@param array|\Google\Protobuf\Internal\MapField $var
@return $this | [
"Optional",
".",
"A",
"mapping",
"of",
"property",
"names",
"to",
"values",
"used",
"to",
"configure",
"Spark",
"SQL",
"s",
"SparkConf",
".",
"Properties",
"that",
"conflict",
"with",
"values",
"set",
"by",
"the",
"Cloud",
"Dataproc",
"API",
"may",
"be",
"overwritten",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dataproc/src/V1beta2/SparkSqlJob.php#L178-L184 | train |
googleapis/google-cloud-php | Dataproc/src/V1beta2/SparkSqlJob.php | SparkSqlJob.setJarFileUris | public function setJarFileUris($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->jar_file_uris = $arr;
return $this;
} | php | public function setJarFileUris($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->jar_file_uris = $arr;
return $this;
} | [
"public",
"function",
"setJarFileUris",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"STRING",
")",
";",
"$",
"this",
"->",
"jar_file_uris",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | Optional. HCFS URIs of jar files to be added to the Spark CLASSPATH.
Generated from protobuf field <code>repeated string jar_file_uris = 56;</code>
@param string[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"Optional",
".",
"HCFS",
"URIs",
"of",
"jar",
"files",
"to",
"be",
"added",
"to",
"the",
"Spark",
"CLASSPATH",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dataproc/src/V1beta2/SparkSqlJob.php#L204-L210 | train |
googleapis/google-cloud-php | Dataproc/src/V1beta2/SparkSqlJob.php | SparkSqlJob.setLoggingConfig | public function setLoggingConfig($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dataproc\V1beta2\LoggingConfig::class);
$this->logging_config = $var;
return $this;
} | php | public function setLoggingConfig($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dataproc\V1beta2\LoggingConfig::class);
$this->logging_config = $var;
return $this;
} | [
"public",
"function",
"setLoggingConfig",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dataproc",
"\\",
"V1beta2",
"\\",
"LoggingConfig",
"::",
"class",
")",
";",
"$",
"this",
"->",
"logging_config",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Optional. The runtime log config for job execution.
Generated from protobuf field <code>.google.cloud.dataproc.v1beta2.LoggingConfig logging_config = 6;</code>
@param \Google\Cloud\Dataproc\V1beta2\LoggingConfig $var
@return $this | [
"Optional",
".",
"The",
"runtime",
"log",
"config",
"for",
"job",
"execution",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dataproc/src/V1beta2/SparkSqlJob.php#L230-L236 | train |
googleapis/google-cloud-php | Dialogflow/src/V2/BatchDeleteEntityTypesRequest.php | BatchDeleteEntityTypesRequest.setEntityTypeNames | public function setEntityTypeNames($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->entity_type_names = $arr;
return $this;
} | php | public function setEntityTypeNames($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->entity_type_names = $arr;
return $this;
} | [
"public",
"function",
"setEntityTypeNames",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"STRING",
")",
";",
"$",
"this",
"->",
"entity_type_names",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | Required. The names entity types to delete. All names must point to the
same agent as `parent`.
Generated from protobuf field <code>repeated string entity_type_names = 2;</code>
@param string[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"Required",
".",
"The",
"names",
"entity",
"types",
"to",
"delete",
".",
"All",
"names",
"must",
"point",
"to",
"the",
"same",
"agent",
"as",
"parent",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dialogflow/src/V2/BatchDeleteEntityTypesRequest.php#L100-L106 | train |
googleapis/google-cloud-php | AutoMl/src/V1beta1/ModelEvaluation.php | ModelEvaluation.setClassificationEvaluationMetrics | public function setClassificationEvaluationMetrics($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\AutoMl\V1beta1\ClassificationEvaluationMetrics::class);
$this->writeOneof(8, $var);
return $this;
} | php | public function setClassificationEvaluationMetrics($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\AutoMl\V1beta1\ClassificationEvaluationMetrics::class);
$this->writeOneof(8, $var);
return $this;
} | [
"public",
"function",
"setClassificationEvaluationMetrics",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"AutoMl",
"\\",
"V1beta1",
"\\",
"ClassificationEvaluationMetrics",
"::",
"class",
")",
";",
"$",
"this",
"->",
"writeOneof",
"(",
"8",
",",
"$",
"var",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Evaluation metrics for models on classification problems models.
Generated from protobuf field <code>.google.cloud.automl.v1beta1.ClassificationEvaluationMetrics classification_evaluation_metrics = 8;</code>
@param \Google\Cloud\AutoMl\V1beta1\ClassificationEvaluationMetrics $var
@return $this | [
"Evaluation",
"metrics",
"for",
"models",
"on",
"classification",
"problems",
"models",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/AutoMl/src/V1beta1/ModelEvaluation.php#L105-L111 | train |
googleapis/google-cloud-php | AutoMl/src/V1beta1/ModelEvaluation.php | ModelEvaluation.setTranslationEvaluationMetrics | public function setTranslationEvaluationMetrics($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\AutoMl\V1beta1\TranslationEvaluationMetrics::class);
$this->writeOneof(9, $var);
return $this;
} | php | public function setTranslationEvaluationMetrics($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\AutoMl\V1beta1\TranslationEvaluationMetrics::class);
$this->writeOneof(9, $var);
return $this;
} | [
"public",
"function",
"setTranslationEvaluationMetrics",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"AutoMl",
"\\",
"V1beta1",
"\\",
"TranslationEvaluationMetrics",
"::",
"class",
")",
";",
"$",
"this",
"->",
"writeOneof",
"(",
"9",
",",
"$",
"var",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Evaluation metrics for models on translation models.
Generated from protobuf field <code>.google.cloud.automl.v1beta1.TranslationEvaluationMetrics translation_evaluation_metrics = 9;</code>
@param \Google\Cloud\AutoMl\V1beta1\TranslationEvaluationMetrics $var
@return $this | [
"Evaluation",
"metrics",
"for",
"models",
"on",
"translation",
"models",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/AutoMl/src/V1beta1/ModelEvaluation.php#L131-L137 | train |
googleapis/google-cloud-php | dev/src/ReleaseBuilder/ReleaseBuilder.php | ReleaseBuilder.updateComponentVersions | private function updateComponentVersions(array $release)
{
foreach ($release as $key => $releaseComponent)
{
$component = $this->getComponentComposer($this->rootPath(), $key);
$this->addToComponentManifest($releaseComponent['version'], $component);
foreach ((array) $component['entry'] as $entry) {
$entryUpdated = $this->updateComponentVersionConstant(
$releaseComponent['version'],
$component['path'],
$entry
);
}
if ($component['id'] !== 'google-cloud') {
$this->updateComponentVersionFile($releaseComponent['version'], $component);
$this->updateComposerReplacesVersion($releaseComponent['version'], $component);
}
}
} | php | private function updateComponentVersions(array $release)
{
foreach ($release as $key => $releaseComponent)
{
$component = $this->getComponentComposer($this->rootPath(), $key);
$this->addToComponentManifest($releaseComponent['version'], $component);
foreach ((array) $component['entry'] as $entry) {
$entryUpdated = $this->updateComponentVersionConstant(
$releaseComponent['version'],
$component['path'],
$entry
);
}
if ($component['id'] !== 'google-cloud') {
$this->updateComponentVersionFile($releaseComponent['version'], $component);
$this->updateComposerReplacesVersion($releaseComponent['version'], $component);
}
}
} | [
"private",
"function",
"updateComponentVersions",
"(",
"array",
"$",
"release",
")",
"{",
"foreach",
"(",
"$",
"release",
"as",
"$",
"key",
"=>",
"$",
"releaseComponent",
")",
"{",
"$",
"component",
"=",
"$",
"this",
"->",
"getComponentComposer",
"(",
"$",
"this",
"->",
"rootPath",
"(",
")",
",",
"$",
"key",
")",
";",
"$",
"this",
"->",
"addToComponentManifest",
"(",
"$",
"releaseComponent",
"[",
"'version'",
"]",
",",
"$",
"component",
")",
";",
"foreach",
"(",
"(",
"array",
")",
"$",
"component",
"[",
"'entry'",
"]",
"as",
"$",
"entry",
")",
"{",
"$",
"entryUpdated",
"=",
"$",
"this",
"->",
"updateComponentVersionConstant",
"(",
"$",
"releaseComponent",
"[",
"'version'",
"]",
",",
"$",
"component",
"[",
"'path'",
"]",
",",
"$",
"entry",
")",
";",
"}",
"if",
"(",
"$",
"component",
"[",
"'id'",
"]",
"!==",
"'google-cloud'",
")",
"{",
"$",
"this",
"->",
"updateComponentVersionFile",
"(",
"$",
"releaseComponent",
"[",
"'version'",
"]",
",",
"$",
"component",
")",
";",
"$",
"this",
"->",
"updateComposerReplacesVersion",
"(",
"$",
"releaseComponent",
"[",
"'version'",
"]",
",",
"$",
"component",
")",
";",
"}",
"}",
"}"
] | Iterate through a release and do the work of preparing a release.
@param array $release An associative array, where the key is the
component ID and the value is structured data describing the
release.
@return void | [
"Iterate",
"through",
"a",
"release",
"and",
"do",
"the",
"work",
"of",
"preparing",
"a",
"release",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/dev/src/ReleaseBuilder/ReleaseBuilder.php#L170-L190 | train |
googleapis/google-cloud-php | dev/src/ReleaseBuilder/ReleaseBuilder.php | ReleaseBuilder.determineUmbrellaLevel | private function determineUmbrellaLevel(array $release)
{
$levels = [];
array_walk($release, function ($component) use (&$levels) {
$levels[] = $component['level'];
});
$levels = array_unique($levels);
rsort($levels);
// Since we don't use major versions of the umbrella, major versions of
// components only bump the umbrella by a minor increment.
if ($levels[0] === self::LEVEL_MAJOR) {
$levels[0] = self::LEVEL_MINOR;
}
$release[self::DEFAULT_COMPONENT] = [
'level' => $levels[0]
];
return $release;
} | php | private function determineUmbrellaLevel(array $release)
{
$levels = [];
array_walk($release, function ($component) use (&$levels) {
$levels[] = $component['level'];
});
$levels = array_unique($levels);
rsort($levels);
// Since we don't use major versions of the umbrella, major versions of
// components only bump the umbrella by a minor increment.
if ($levels[0] === self::LEVEL_MAJOR) {
$levels[0] = self::LEVEL_MINOR;
}
$release[self::DEFAULT_COMPONENT] = [
'level' => $levels[0]
];
return $release;
} | [
"private",
"function",
"determineUmbrellaLevel",
"(",
"array",
"$",
"release",
")",
"{",
"$",
"levels",
"=",
"[",
"]",
";",
"array_walk",
"(",
"$",
"release",
",",
"function",
"(",
"$",
"component",
")",
"use",
"(",
"&",
"$",
"levels",
")",
"{",
"$",
"levels",
"[",
"]",
"=",
"$",
"component",
"[",
"'level'",
"]",
";",
"}",
")",
";",
"$",
"levels",
"=",
"array_unique",
"(",
"$",
"levels",
")",
";",
"rsort",
"(",
"$",
"levels",
")",
";",
"// Since we don't use major versions of the umbrella, major versions of",
"// components only bump the umbrella by a minor increment.",
"if",
"(",
"$",
"levels",
"[",
"0",
"]",
"===",
"self",
"::",
"LEVEL_MAJOR",
")",
"{",
"$",
"levels",
"[",
"0",
"]",
"=",
"self",
"::",
"LEVEL_MINOR",
";",
"}",
"$",
"release",
"[",
"self",
"::",
"DEFAULT_COMPONENT",
"]",
"=",
"[",
"'level'",
"=>",
"$",
"levels",
"[",
"0",
"]",
"]",
";",
"return",
"$",
"release",
";",
"}"
] | Determine the release level of the umbrella package by examining the
levels of all affected components and incrementing the umbrella by the
highest level of a component release.
In other words, if three components are released as patches, the umbrella
will be a patch release. If there are any minor releases, the umbrella is
released as a minor. The umbrella package will never be incrememted as a
major release.
@param array $release An associative array, where the key is the
component ID and the value is structured data describing the
release.
@return array $release | [
"Determine",
"the",
"release",
"level",
"of",
"the",
"umbrella",
"package",
"by",
"examining",
"the",
"levels",
"of",
"all",
"affected",
"components",
"and",
"incrementing",
"the",
"umbrella",
"by",
"the",
"highest",
"level",
"of",
"a",
"component",
"release",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/dev/src/ReleaseBuilder/ReleaseBuilder.php#L233-L254 | train |
googleapis/google-cloud-php | dev/src/ReleaseBuilder/ReleaseBuilder.php | ReleaseBuilder.createReleaseNotes | private function createReleaseNotes(array $release)
{
$buildDir = $this->rootPath .'/build';
$locationTemplate = $buildDir . '/release-%s.md';
if (!is_dir($buildDir)) {
mkdir($buildDir);
}
$umbrella = $release[self::DEFAULT_COMPONENT];
$location = sprintf($locationTemplate, $umbrella['version']);
unset($release[self::DEFAULT_COMPONENT]);
ksort($release);
$notes = [];
foreach ($release as $key => $component) {
$messages = [];
foreach ($component['messages'] as $message) {
$messages[] = sprintf('* %s', $message);
}
$notes[] = sprintf('### google/%s v%s', $key, $component['version'])
. PHP_EOL . PHP_EOL . implode(PHP_EOL, $messages);
}
$template = file_get_contents(__DIR__ .'/templates/release-notes.md.txt');
$template = str_replace('{version}', $umbrella['version'], $template);
$template = str_replace('{notes}', implode(PHP_EOL . PHP_EOL, $notes), $template);
file_put_contents($location, $template);
return $location;
} | php | private function createReleaseNotes(array $release)
{
$buildDir = $this->rootPath .'/build';
$locationTemplate = $buildDir . '/release-%s.md';
if (!is_dir($buildDir)) {
mkdir($buildDir);
}
$umbrella = $release[self::DEFAULT_COMPONENT];
$location = sprintf($locationTemplate, $umbrella['version']);
unset($release[self::DEFAULT_COMPONENT]);
ksort($release);
$notes = [];
foreach ($release as $key => $component) {
$messages = [];
foreach ($component['messages'] as $message) {
$messages[] = sprintf('* %s', $message);
}
$notes[] = sprintf('### google/%s v%s', $key, $component['version'])
. PHP_EOL . PHP_EOL . implode(PHP_EOL, $messages);
}
$template = file_get_contents(__DIR__ .'/templates/release-notes.md.txt');
$template = str_replace('{version}', $umbrella['version'], $template);
$template = str_replace('{notes}', implode(PHP_EOL . PHP_EOL, $notes), $template);
file_put_contents($location, $template);
return $location;
} | [
"private",
"function",
"createReleaseNotes",
"(",
"array",
"$",
"release",
")",
"{",
"$",
"buildDir",
"=",
"$",
"this",
"->",
"rootPath",
".",
"'/build'",
";",
"$",
"locationTemplate",
"=",
"$",
"buildDir",
".",
"'/release-%s.md'",
";",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"buildDir",
")",
")",
"{",
"mkdir",
"(",
"$",
"buildDir",
")",
";",
"}",
"$",
"umbrella",
"=",
"$",
"release",
"[",
"self",
"::",
"DEFAULT_COMPONENT",
"]",
";",
"$",
"location",
"=",
"sprintf",
"(",
"$",
"locationTemplate",
",",
"$",
"umbrella",
"[",
"'version'",
"]",
")",
";",
"unset",
"(",
"$",
"release",
"[",
"self",
"::",
"DEFAULT_COMPONENT",
"]",
")",
";",
"ksort",
"(",
"$",
"release",
")",
";",
"$",
"notes",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"release",
"as",
"$",
"key",
"=>",
"$",
"component",
")",
"{",
"$",
"messages",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"component",
"[",
"'messages'",
"]",
"as",
"$",
"message",
")",
"{",
"$",
"messages",
"[",
"]",
"=",
"sprintf",
"(",
"'* %s'",
",",
"$",
"message",
")",
";",
"}",
"$",
"notes",
"[",
"]",
"=",
"sprintf",
"(",
"'### google/%s v%s'",
",",
"$",
"key",
",",
"$",
"component",
"[",
"'version'",
"]",
")",
".",
"PHP_EOL",
".",
"PHP_EOL",
".",
"implode",
"(",
"PHP_EOL",
",",
"$",
"messages",
")",
";",
"}",
"$",
"template",
"=",
"file_get_contents",
"(",
"__DIR__",
".",
"'/templates/release-notes.md.txt'",
")",
";",
"$",
"template",
"=",
"str_replace",
"(",
"'{version}'",
",",
"$",
"umbrella",
"[",
"'version'",
"]",
",",
"$",
"template",
")",
";",
"$",
"template",
"=",
"str_replace",
"(",
"'{notes}'",
",",
"implode",
"(",
"PHP_EOL",
".",
"PHP_EOL",
",",
"$",
"notes",
")",
",",
"$",
"template",
")",
";",
"file_put_contents",
"(",
"$",
"location",
",",
"$",
"template",
")",
";",
"return",
"$",
"location",
";",
"}"
] | Build a release notes markdown file.
@param array $release An associative array, where the key is the
component ID and the value is structured data describing the
release.
@return void | [
"Build",
"a",
"release",
"notes",
"markdown",
"file",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/dev/src/ReleaseBuilder/ReleaseBuilder.php#L264-L298 | train |
googleapis/google-cloud-php | dev/src/ReleaseBuilder/ReleaseBuilder.php | ReleaseBuilder.mergeCommitIntoRelease | private function mergeCommitIntoRelease(array $release, array $commitRelease)
{
foreach ($commitRelease as $key => $commit) {
if (!isset($release[$key])) {
$release[$key] = [
'level' => $commit['level'],
'messages' => [$commit['message']]
];
} else {
$release[$key]['messages'][] = $commit['message'];
$release[$key]['level'] = ($release[$key]['level'] >= $commit['level'])
? $release[$key]['level']
: $commit['level'];
}
}
return $release;
} | php | private function mergeCommitIntoRelease(array $release, array $commitRelease)
{
foreach ($commitRelease as $key => $commit) {
if (!isset($release[$key])) {
$release[$key] = [
'level' => $commit['level'],
'messages' => [$commit['message']]
];
} else {
$release[$key]['messages'][] = $commit['message'];
$release[$key]['level'] = ($release[$key]['level'] >= $commit['level'])
? $release[$key]['level']
: $commit['level'];
}
}
return $release;
} | [
"private",
"function",
"mergeCommitIntoRelease",
"(",
"array",
"$",
"release",
",",
"array",
"$",
"commitRelease",
")",
"{",
"foreach",
"(",
"$",
"commitRelease",
"as",
"$",
"key",
"=>",
"$",
"commit",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"release",
"[",
"$",
"key",
"]",
")",
")",
"{",
"$",
"release",
"[",
"$",
"key",
"]",
"=",
"[",
"'level'",
"=>",
"$",
"commit",
"[",
"'level'",
"]",
",",
"'messages'",
"=>",
"[",
"$",
"commit",
"[",
"'message'",
"]",
"]",
"]",
";",
"}",
"else",
"{",
"$",
"release",
"[",
"$",
"key",
"]",
"[",
"'messages'",
"]",
"[",
"]",
"=",
"$",
"commit",
"[",
"'message'",
"]",
";",
"$",
"release",
"[",
"$",
"key",
"]",
"[",
"'level'",
"]",
"=",
"(",
"$",
"release",
"[",
"$",
"key",
"]",
"[",
"'level'",
"]",
">=",
"$",
"commit",
"[",
"'level'",
"]",
")",
"?",
"$",
"release",
"[",
"$",
"key",
"]",
"[",
"'level'",
"]",
":",
"$",
"commit",
"[",
"'level'",
"]",
";",
"}",
"}",
"return",
"$",
"release",
";",
"}"
] | Interlace new commit release data into an existing release structure.
@param array $release An associative array, where the key is the
component ID and the value is structured data describing the
release.
@param array $commitRelease The release data generated for a single commit.
@return array $release | [
"Interlace",
"new",
"commit",
"release",
"data",
"into",
"an",
"existing",
"release",
"structure",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/dev/src/ReleaseBuilder/ReleaseBuilder.php#L309-L326 | train |
googleapis/google-cloud-php | dev/src/ReleaseBuilder/ReleaseBuilder.php | ReleaseBuilder.interactiveCommitRelease | private function interactiveCommitRelease(OutputInterface $output, array $commit, array $components)
{
$commitRelease = $this->processCommit($output, $commit, $components);
$proceed = false;
do {
$this->displayCommitSummary($output, $commitRelease);
$output->writeln('');
$choices = [
'Proceed without changes',
'Change Release Message',
'Change Release Type to Patch',
'Change Release Type to Minor',
'Change Release Type to Major',
'Start over'
];
$q = $this->choice('Choose an action', $choices, $choices[0]);
$action = $this->askQuestion($q);
$action = $this->removeDefaultFromChoice($action);
switch ($action) {
case $choices[0]:
$proceed = true;
break;
case $choices[1]:
$commitRelease = $this->handleChange($output, $commitRelease);
break;
case $choices[2]: // patch
$commitRelease = $this->handleChange($output, $commitRelease, self::LEVEL_PATCH);
break;
case $choices[3]: // minor
$commitRelease = $this->handleChange($output, $commitRelease, self::LEVEL_MINOR);
break;
case $choices[4]: // major
$commitRelease = $this->handleChange($output, $commitRelease, self::LEVEL_MAJOR);
break;
case $choices[5]:
$commitRelease = $this->processCommit($output, $commit, $components);
break;
}
} while (!$proceed);
$output->writeln('');
return $commitRelease;
} | php | private function interactiveCommitRelease(OutputInterface $output, array $commit, array $components)
{
$commitRelease = $this->processCommit($output, $commit, $components);
$proceed = false;
do {
$this->displayCommitSummary($output, $commitRelease);
$output->writeln('');
$choices = [
'Proceed without changes',
'Change Release Message',
'Change Release Type to Patch',
'Change Release Type to Minor',
'Change Release Type to Major',
'Start over'
];
$q = $this->choice('Choose an action', $choices, $choices[0]);
$action = $this->askQuestion($q);
$action = $this->removeDefaultFromChoice($action);
switch ($action) {
case $choices[0]:
$proceed = true;
break;
case $choices[1]:
$commitRelease = $this->handleChange($output, $commitRelease);
break;
case $choices[2]: // patch
$commitRelease = $this->handleChange($output, $commitRelease, self::LEVEL_PATCH);
break;
case $choices[3]: // minor
$commitRelease = $this->handleChange($output, $commitRelease, self::LEVEL_MINOR);
break;
case $choices[4]: // major
$commitRelease = $this->handleChange($output, $commitRelease, self::LEVEL_MAJOR);
break;
case $choices[5]:
$commitRelease = $this->processCommit($output, $commit, $components);
break;
}
} while (!$proceed);
$output->writeln('');
return $commitRelease;
} | [
"private",
"function",
"interactiveCommitRelease",
"(",
"OutputInterface",
"$",
"output",
",",
"array",
"$",
"commit",
",",
"array",
"$",
"components",
")",
"{",
"$",
"commitRelease",
"=",
"$",
"this",
"->",
"processCommit",
"(",
"$",
"output",
",",
"$",
"commit",
",",
"$",
"components",
")",
";",
"$",
"proceed",
"=",
"false",
";",
"do",
"{",
"$",
"this",
"->",
"displayCommitSummary",
"(",
"$",
"output",
",",
"$",
"commitRelease",
")",
";",
"$",
"output",
"->",
"writeln",
"(",
"''",
")",
";",
"$",
"choices",
"=",
"[",
"'Proceed without changes'",
",",
"'Change Release Message'",
",",
"'Change Release Type to Patch'",
",",
"'Change Release Type to Minor'",
",",
"'Change Release Type to Major'",
",",
"'Start over'",
"]",
";",
"$",
"q",
"=",
"$",
"this",
"->",
"choice",
"(",
"'Choose an action'",
",",
"$",
"choices",
",",
"$",
"choices",
"[",
"0",
"]",
")",
";",
"$",
"action",
"=",
"$",
"this",
"->",
"askQuestion",
"(",
"$",
"q",
")",
";",
"$",
"action",
"=",
"$",
"this",
"->",
"removeDefaultFromChoice",
"(",
"$",
"action",
")",
";",
"switch",
"(",
"$",
"action",
")",
"{",
"case",
"$",
"choices",
"[",
"0",
"]",
":",
"$",
"proceed",
"=",
"true",
";",
"break",
";",
"case",
"$",
"choices",
"[",
"1",
"]",
":",
"$",
"commitRelease",
"=",
"$",
"this",
"->",
"handleChange",
"(",
"$",
"output",
",",
"$",
"commitRelease",
")",
";",
"break",
";",
"case",
"$",
"choices",
"[",
"2",
"]",
":",
"// patch",
"$",
"commitRelease",
"=",
"$",
"this",
"->",
"handleChange",
"(",
"$",
"output",
",",
"$",
"commitRelease",
",",
"self",
"::",
"LEVEL_PATCH",
")",
";",
"break",
";",
"case",
"$",
"choices",
"[",
"3",
"]",
":",
"// minor",
"$",
"commitRelease",
"=",
"$",
"this",
"->",
"handleChange",
"(",
"$",
"output",
",",
"$",
"commitRelease",
",",
"self",
"::",
"LEVEL_MINOR",
")",
";",
"break",
";",
"case",
"$",
"choices",
"[",
"4",
"]",
":",
"// major",
"$",
"commitRelease",
"=",
"$",
"this",
"->",
"handleChange",
"(",
"$",
"output",
",",
"$",
"commitRelease",
",",
"self",
"::",
"LEVEL_MAJOR",
")",
";",
"break",
";",
"case",
"$",
"choices",
"[",
"5",
"]",
":",
"$",
"commitRelease",
"=",
"$",
"this",
"->",
"processCommit",
"(",
"$",
"output",
",",
"$",
"commit",
",",
"$",
"components",
")",
";",
"break",
";",
"}",
"}",
"while",
"(",
"!",
"$",
"proceed",
")",
";",
"$",
"output",
"->",
"writeln",
"(",
"''",
")",
";",
"return",
"$",
"commitRelease",
";",
"}"
] | Determine defaults for components affected by the commit, display an
overview and provide an interface for modifications.
@param OutputInterface $output The Symfony Output for writing to stdout
@param array $commit The commit data.
@param array $components Components modified by the commit.
@return array Structured data about components modified in this commit. | [
"Determine",
"defaults",
"for",
"components",
"affected",
"by",
"the",
"commit",
"display",
"an",
"overview",
"and",
"provide",
"an",
"interface",
"for",
"modifications",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/dev/src/ReleaseBuilder/ReleaseBuilder.php#L337-L390 | train |
googleapis/google-cloud-php | dev/src/ReleaseBuilder/ReleaseBuilder.php | ReleaseBuilder.handleChange | public function handleChange(OutputInterface $output, array $commitRelease, $level = null)
{
$choices = array_keys($commitRelease);
if (count($choices) > 1) {
$options = array_merge([
'All Components'
], $choices, [
'Go Back'
]);
// By default, all components are batch modified in this method.
$q = $this->choice('Choose a component to modify.', $options, $options[0]);
$component = $this->removeDefaultFromChoice($this->askQuestion($q));
if ($component === 'Go Back') {
return $commitRelease;
}
if ($component === 'All Components') {
$component = null;
}
} else {
$component = $choices[0];
}
if ($level === null) {
if ($component) {
$componentOverview = sprintf(
'<info>google/%s</info> [<info>%s</info>]:',
$component,
$this->levels[$commitRelease[$component]['level']]
);
$currentMessage = $commitRelease[$component]['message'];
} else {
$componentOverview = sprintf(
'Modifying <info>%s</info> components.',
count($commitRelease)
);
$currentMessage = current($commitRelease)['message'];
}
$key = 'message';
$value = $this->ask(sprintf(
'%s Enter a release note message. Do not enter the Pull Request reference number.'.
PHP_EOL .' - Message: <info>%s</info>',
$componentOverview,
$currentMessage
), $currentMessage);
$value .= ' (#'. current($commitRelease)['ref'] .')';
} elseif (array_key_exists($level, $this->levels)) {
$key = 'level';
$value = $level;
} else {
throw new \Exception('Something went really wrong.');
}
if ($component) {
$commitRelease[$component][$key] = $value;
} else {
foreach ($commitRelease as &$commitComponent) {
$commitComponent[$key] = $value;
}
}
return $commitRelease;
} | php | public function handleChange(OutputInterface $output, array $commitRelease, $level = null)
{
$choices = array_keys($commitRelease);
if (count($choices) > 1) {
$options = array_merge([
'All Components'
], $choices, [
'Go Back'
]);
// By default, all components are batch modified in this method.
$q = $this->choice('Choose a component to modify.', $options, $options[0]);
$component = $this->removeDefaultFromChoice($this->askQuestion($q));
if ($component === 'Go Back') {
return $commitRelease;
}
if ($component === 'All Components') {
$component = null;
}
} else {
$component = $choices[0];
}
if ($level === null) {
if ($component) {
$componentOverview = sprintf(
'<info>google/%s</info> [<info>%s</info>]:',
$component,
$this->levels[$commitRelease[$component]['level']]
);
$currentMessage = $commitRelease[$component]['message'];
} else {
$componentOverview = sprintf(
'Modifying <info>%s</info> components.',
count($commitRelease)
);
$currentMessage = current($commitRelease)['message'];
}
$key = 'message';
$value = $this->ask(sprintf(
'%s Enter a release note message. Do not enter the Pull Request reference number.'.
PHP_EOL .' - Message: <info>%s</info>',
$componentOverview,
$currentMessage
), $currentMessage);
$value .= ' (#'. current($commitRelease)['ref'] .')';
} elseif (array_key_exists($level, $this->levels)) {
$key = 'level';
$value = $level;
} else {
throw new \Exception('Something went really wrong.');
}
if ($component) {
$commitRelease[$component][$key] = $value;
} else {
foreach ($commitRelease as &$commitComponent) {
$commitComponent[$key] = $value;
}
}
return $commitRelease;
} | [
"public",
"function",
"handleChange",
"(",
"OutputInterface",
"$",
"output",
",",
"array",
"$",
"commitRelease",
",",
"$",
"level",
"=",
"null",
")",
"{",
"$",
"choices",
"=",
"array_keys",
"(",
"$",
"commitRelease",
")",
";",
"if",
"(",
"count",
"(",
"$",
"choices",
")",
">",
"1",
")",
"{",
"$",
"options",
"=",
"array_merge",
"(",
"[",
"'All Components'",
"]",
",",
"$",
"choices",
",",
"[",
"'Go Back'",
"]",
")",
";",
"// By default, all components are batch modified in this method.",
"$",
"q",
"=",
"$",
"this",
"->",
"choice",
"(",
"'Choose a component to modify.'",
",",
"$",
"options",
",",
"$",
"options",
"[",
"0",
"]",
")",
";",
"$",
"component",
"=",
"$",
"this",
"->",
"removeDefaultFromChoice",
"(",
"$",
"this",
"->",
"askQuestion",
"(",
"$",
"q",
")",
")",
";",
"if",
"(",
"$",
"component",
"===",
"'Go Back'",
")",
"{",
"return",
"$",
"commitRelease",
";",
"}",
"if",
"(",
"$",
"component",
"===",
"'All Components'",
")",
"{",
"$",
"component",
"=",
"null",
";",
"}",
"}",
"else",
"{",
"$",
"component",
"=",
"$",
"choices",
"[",
"0",
"]",
";",
"}",
"if",
"(",
"$",
"level",
"===",
"null",
")",
"{",
"if",
"(",
"$",
"component",
")",
"{",
"$",
"componentOverview",
"=",
"sprintf",
"(",
"'<info>google/%s</info> [<info>%s</info>]:'",
",",
"$",
"component",
",",
"$",
"this",
"->",
"levels",
"[",
"$",
"commitRelease",
"[",
"$",
"component",
"]",
"[",
"'level'",
"]",
"]",
")",
";",
"$",
"currentMessage",
"=",
"$",
"commitRelease",
"[",
"$",
"component",
"]",
"[",
"'message'",
"]",
";",
"}",
"else",
"{",
"$",
"componentOverview",
"=",
"sprintf",
"(",
"'Modifying <info>%s</info> components.'",
",",
"count",
"(",
"$",
"commitRelease",
")",
")",
";",
"$",
"currentMessage",
"=",
"current",
"(",
"$",
"commitRelease",
")",
"[",
"'message'",
"]",
";",
"}",
"$",
"key",
"=",
"'message'",
";",
"$",
"value",
"=",
"$",
"this",
"->",
"ask",
"(",
"sprintf",
"(",
"'%s Enter a release note message. Do not enter the Pull Request reference number.'",
".",
"PHP_EOL",
".",
"' - Message: <info>%s</info>'",
",",
"$",
"componentOverview",
",",
"$",
"currentMessage",
")",
",",
"$",
"currentMessage",
")",
";",
"$",
"value",
".=",
"' (#'",
".",
"current",
"(",
"$",
"commitRelease",
")",
"[",
"'ref'",
"]",
".",
"')'",
";",
"}",
"elseif",
"(",
"array_key_exists",
"(",
"$",
"level",
",",
"$",
"this",
"->",
"levels",
")",
")",
"{",
"$",
"key",
"=",
"'level'",
";",
"$",
"value",
"=",
"$",
"level",
";",
"}",
"else",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'Something went really wrong.'",
")",
";",
"}",
"if",
"(",
"$",
"component",
")",
"{",
"$",
"commitRelease",
"[",
"$",
"component",
"]",
"[",
"$",
"key",
"]",
"=",
"$",
"value",
";",
"}",
"else",
"{",
"foreach",
"(",
"$",
"commitRelease",
"as",
"&",
"$",
"commitComponent",
")",
"{",
"$",
"commitComponent",
"[",
"$",
"key",
"]",
"=",
"$",
"value",
";",
"}",
"}",
"return",
"$",
"commitRelease",
";",
"}"
] | An interactive flow for modifying release data.
@param OutputInterface $output
@param array $commitRelease Structured data about components modified by
the current commit.
@param int|null $level The level to change to. If null, assume change release message. | [
"An",
"interactive",
"flow",
"for",
"modifying",
"release",
"data",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/dev/src/ReleaseBuilder/ReleaseBuilder.php#L400-L470 | train |
googleapis/google-cloud-php | dev/src/ReleaseBuilder/ReleaseBuilder.php | ReleaseBuilder.processCommit | private function processCommit(OutputInterface $output, array $commit, array $components)
{
$output->writeln(sprintf(
'Processing Commit: <info>%s</info>',
$commit['message']
));
$output->writeln(sprintf('View on GitHub: %s', $commit['htmlUrl']));
$output->writeln('----------');
$output->writeln('');
$message = trim($this->ask('Enter a release summary for this commit. You can change this later.', $commit['message']));
$commitRelease = [];
foreach ($components as $key => $component) {
$componentRelease = isset($commitRelease[$key])
? $commitRelease[$key]
: ['level' => self::LEVEL_PATCH, 'message' => '', 'reasons' => []];
$lowestAllowedLevel = $componentRelease['level'];
$suggestedLevel = $lowestAllowedLevel;
$allowedLevels = array_filter($this->levels, function ($name, $key) use ($lowestAllowedLevel) {
return $key >= $lowestAllowedLevel;
}, ARRAY_FILTER_USE_BOTH);
$output->writeln(sprintf('Component <comment>%s</comment> modified by commit.', $key));
list ($suggestedLevel, $reasons) =
$this->determineSuggestedLevel($allowedLevels, $suggestedLevel, $component['files']);
$output->writeln(sprintf(
'We suggest a <info>%s</info> release because of the following reasons. Please do not use this as an ' .
'absolute guide, as this tool is unable to determine the correct outcome in every scenario.',
$this->levels[$suggestedLevel]
));
$output->writeln('');
foreach ($reasons as $reason) {
$output->writeln('* '. $reason);
}
$output->writeln('');
$componentRelease['level'] = $suggestedLevel;
$componentRelease['message'] = $message .' (#'. $commit['reference'] .')';
$componentRelease['reasons'] = array_merge($componentRelease['reasons'], $reasons);
$componentRelease['ref'] = $commit['reference'];
$commitRelease[$key] = $componentRelease;
}
return $commitRelease;
} | php | private function processCommit(OutputInterface $output, array $commit, array $components)
{
$output->writeln(sprintf(
'Processing Commit: <info>%s</info>',
$commit['message']
));
$output->writeln(sprintf('View on GitHub: %s', $commit['htmlUrl']));
$output->writeln('----------');
$output->writeln('');
$message = trim($this->ask('Enter a release summary for this commit. You can change this later.', $commit['message']));
$commitRelease = [];
foreach ($components as $key => $component) {
$componentRelease = isset($commitRelease[$key])
? $commitRelease[$key]
: ['level' => self::LEVEL_PATCH, 'message' => '', 'reasons' => []];
$lowestAllowedLevel = $componentRelease['level'];
$suggestedLevel = $lowestAllowedLevel;
$allowedLevels = array_filter($this->levels, function ($name, $key) use ($lowestAllowedLevel) {
return $key >= $lowestAllowedLevel;
}, ARRAY_FILTER_USE_BOTH);
$output->writeln(sprintf('Component <comment>%s</comment> modified by commit.', $key));
list ($suggestedLevel, $reasons) =
$this->determineSuggestedLevel($allowedLevels, $suggestedLevel, $component['files']);
$output->writeln(sprintf(
'We suggest a <info>%s</info> release because of the following reasons. Please do not use this as an ' .
'absolute guide, as this tool is unable to determine the correct outcome in every scenario.',
$this->levels[$suggestedLevel]
));
$output->writeln('');
foreach ($reasons as $reason) {
$output->writeln('* '. $reason);
}
$output->writeln('');
$componentRelease['level'] = $suggestedLevel;
$componentRelease['message'] = $message .' (#'. $commit['reference'] .')';
$componentRelease['reasons'] = array_merge($componentRelease['reasons'], $reasons);
$componentRelease['ref'] = $commit['reference'];
$commitRelease[$key] = $componentRelease;
}
return $commitRelease;
} | [
"private",
"function",
"processCommit",
"(",
"OutputInterface",
"$",
"output",
",",
"array",
"$",
"commit",
",",
"array",
"$",
"components",
")",
"{",
"$",
"output",
"->",
"writeln",
"(",
"sprintf",
"(",
"'Processing Commit: <info>%s</info>'",
",",
"$",
"commit",
"[",
"'message'",
"]",
")",
")",
";",
"$",
"output",
"->",
"writeln",
"(",
"sprintf",
"(",
"'View on GitHub: %s'",
",",
"$",
"commit",
"[",
"'htmlUrl'",
"]",
")",
")",
";",
"$",
"output",
"->",
"writeln",
"(",
"'----------'",
")",
";",
"$",
"output",
"->",
"writeln",
"(",
"''",
")",
";",
"$",
"message",
"=",
"trim",
"(",
"$",
"this",
"->",
"ask",
"(",
"'Enter a release summary for this commit. You can change this later.'",
",",
"$",
"commit",
"[",
"'message'",
"]",
")",
")",
";",
"$",
"commitRelease",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"components",
"as",
"$",
"key",
"=>",
"$",
"component",
")",
"{",
"$",
"componentRelease",
"=",
"isset",
"(",
"$",
"commitRelease",
"[",
"$",
"key",
"]",
")",
"?",
"$",
"commitRelease",
"[",
"$",
"key",
"]",
":",
"[",
"'level'",
"=>",
"self",
"::",
"LEVEL_PATCH",
",",
"'message'",
"=>",
"''",
",",
"'reasons'",
"=>",
"[",
"]",
"]",
";",
"$",
"lowestAllowedLevel",
"=",
"$",
"componentRelease",
"[",
"'level'",
"]",
";",
"$",
"suggestedLevel",
"=",
"$",
"lowestAllowedLevel",
";",
"$",
"allowedLevels",
"=",
"array_filter",
"(",
"$",
"this",
"->",
"levels",
",",
"function",
"(",
"$",
"name",
",",
"$",
"key",
")",
"use",
"(",
"$",
"lowestAllowedLevel",
")",
"{",
"return",
"$",
"key",
">=",
"$",
"lowestAllowedLevel",
";",
"}",
",",
"ARRAY_FILTER_USE_BOTH",
")",
";",
"$",
"output",
"->",
"writeln",
"(",
"sprintf",
"(",
"'Component <comment>%s</comment> modified by commit.'",
",",
"$",
"key",
")",
")",
";",
"list",
"(",
"$",
"suggestedLevel",
",",
"$",
"reasons",
")",
"=",
"$",
"this",
"->",
"determineSuggestedLevel",
"(",
"$",
"allowedLevels",
",",
"$",
"suggestedLevel",
",",
"$",
"component",
"[",
"'files'",
"]",
")",
";",
"$",
"output",
"->",
"writeln",
"(",
"sprintf",
"(",
"'We suggest a <info>%s</info> release because of the following reasons. Please do not use this as an '",
".",
"'absolute guide, as this tool is unable to determine the correct outcome in every scenario.'",
",",
"$",
"this",
"->",
"levels",
"[",
"$",
"suggestedLevel",
"]",
")",
")",
";",
"$",
"output",
"->",
"writeln",
"(",
"''",
")",
";",
"foreach",
"(",
"$",
"reasons",
"as",
"$",
"reason",
")",
"{",
"$",
"output",
"->",
"writeln",
"(",
"'* '",
".",
"$",
"reason",
")",
";",
"}",
"$",
"output",
"->",
"writeln",
"(",
"''",
")",
";",
"$",
"componentRelease",
"[",
"'level'",
"]",
"=",
"$",
"suggestedLevel",
";",
"$",
"componentRelease",
"[",
"'message'",
"]",
"=",
"$",
"message",
".",
"' (#'",
".",
"$",
"commit",
"[",
"'reference'",
"]",
".",
"')'",
";",
"$",
"componentRelease",
"[",
"'reasons'",
"]",
"=",
"array_merge",
"(",
"$",
"componentRelease",
"[",
"'reasons'",
"]",
",",
"$",
"reasons",
")",
";",
"$",
"componentRelease",
"[",
"'ref'",
"]",
"=",
"$",
"commit",
"[",
"'reference'",
"]",
";",
"$",
"commitRelease",
"[",
"$",
"key",
"]",
"=",
"$",
"componentRelease",
";",
"}",
"return",
"$",
"commitRelease",
";",
"}"
] | Top-level CLI to process a single commit and display information to the user.
@param OutputInterface $output
@param array $commit Data about the commit.
@param array $components Data about all components modified in the commit.
@return array | [
"Top",
"-",
"level",
"CLI",
"to",
"process",
"a",
"single",
"commit",
"and",
"display",
"information",
"to",
"the",
"user",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/dev/src/ReleaseBuilder/ReleaseBuilder.php#L480-L531 | train |
googleapis/google-cloud-php | dev/src/ReleaseBuilder/ReleaseBuilder.php | ReleaseBuilder.displayCommitSummary | private function displayCommitSummary(OutputInterface $output, array $commitRelease)
{
$output->writeln('Commit Summary');
$output->writeln('-----');
foreach ($commitRelease as $key => $releaseInfo) {
$output->writeln(sprintf('<info>google/%s</info> [<info>%s</info>]', $key, $this->levels[$releaseInfo['level']]));
$output->writeln(sprintf(' - Message: <info>%s</info>', $releaseInfo['message']));
}
} | php | private function displayCommitSummary(OutputInterface $output, array $commitRelease)
{
$output->writeln('Commit Summary');
$output->writeln('-----');
foreach ($commitRelease as $key => $releaseInfo) {
$output->writeln(sprintf('<info>google/%s</info> [<info>%s</info>]', $key, $this->levels[$releaseInfo['level']]));
$output->writeln(sprintf(' - Message: <info>%s</info>', $releaseInfo['message']));
}
} | [
"private",
"function",
"displayCommitSummary",
"(",
"OutputInterface",
"$",
"output",
",",
"array",
"$",
"commitRelease",
")",
"{",
"$",
"output",
"->",
"writeln",
"(",
"'Commit Summary'",
")",
";",
"$",
"output",
"->",
"writeln",
"(",
"'-----'",
")",
";",
"foreach",
"(",
"$",
"commitRelease",
"as",
"$",
"key",
"=>",
"$",
"releaseInfo",
")",
"{",
"$",
"output",
"->",
"writeln",
"(",
"sprintf",
"(",
"'<info>google/%s</info> [<info>%s</info>]'",
",",
"$",
"key",
",",
"$",
"this",
"->",
"levels",
"[",
"$",
"releaseInfo",
"[",
"'level'",
"]",
"]",
")",
")",
";",
"$",
"output",
"->",
"writeln",
"(",
"sprintf",
"(",
"' - Message: <info>%s</info>'",
",",
"$",
"releaseInfo",
"[",
"'message'",
"]",
")",
")",
";",
"}",
"}"
] | Formatted summary of the release state of components in the commit.
@param OutputInterface $output
@param array $commitRelease Release data scoped to a single commit.
@return void | [
"Formatted",
"summary",
"of",
"the",
"release",
"state",
"of",
"components",
"in",
"the",
"commit",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/dev/src/ReleaseBuilder/ReleaseBuilder.php#L540-L549 | train |
googleapis/google-cloud-php | dev/src/ReleaseBuilder/ReleaseBuilder.php | ReleaseBuilder.determineSuggestedLevel | private function determineSuggestedLevel(array $levelChoices, $suggestedLevel, array $files)
{
$reasons = [];
if ($levelChoices !== $this->levels) {
$suggestedLevel = array_keys($levelChoices)[0];
$reasons[] = 'Another change specified a higher minimum release level.';
}
if (isset($levelChoices[self::LEVEL_MINOR]) && (bool) array_filter($files, function ($file) {
$parts = explode('/', $file);
return isset($parts[1]) && $parts[1] === 'src' && count($parts) > 2;
})) {
$suggestedLevel = self::LEVEL_MINOR;
$reasons[] = 'There are changes in the component `src` folder.';
}
if (isset($levelChoices[self::LEVEL_MINOR]) && in_array('composer.json', $files)) {
$suggestedLevel = self::LEVEL_MINOR;
$reasons[] = 'The component `composer.json` file was modified.';
}
if ($suggestedLevel === self::LEVEL_PATCH) {
$reasons[] = 'None of the indicators show the commit includes a client-facing code change.';
}
return [$suggestedLevel, $reasons];
} | php | private function determineSuggestedLevel(array $levelChoices, $suggestedLevel, array $files)
{
$reasons = [];
if ($levelChoices !== $this->levels) {
$suggestedLevel = array_keys($levelChoices)[0];
$reasons[] = 'Another change specified a higher minimum release level.';
}
if (isset($levelChoices[self::LEVEL_MINOR]) && (bool) array_filter($files, function ($file) {
$parts = explode('/', $file);
return isset($parts[1]) && $parts[1] === 'src' && count($parts) > 2;
})) {
$suggestedLevel = self::LEVEL_MINOR;
$reasons[] = 'There are changes in the component `src` folder.';
}
if (isset($levelChoices[self::LEVEL_MINOR]) && in_array('composer.json', $files)) {
$suggestedLevel = self::LEVEL_MINOR;
$reasons[] = 'The component `composer.json` file was modified.';
}
if ($suggestedLevel === self::LEVEL_PATCH) {
$reasons[] = 'None of the indicators show the commit includes a client-facing code change.';
}
return [$suggestedLevel, $reasons];
} | [
"private",
"function",
"determineSuggestedLevel",
"(",
"array",
"$",
"levelChoices",
",",
"$",
"suggestedLevel",
",",
"array",
"$",
"files",
")",
"{",
"$",
"reasons",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"levelChoices",
"!==",
"$",
"this",
"->",
"levels",
")",
"{",
"$",
"suggestedLevel",
"=",
"array_keys",
"(",
"$",
"levelChoices",
")",
"[",
"0",
"]",
";",
"$",
"reasons",
"[",
"]",
"=",
"'Another change specified a higher minimum release level.'",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"levelChoices",
"[",
"self",
"::",
"LEVEL_MINOR",
"]",
")",
"&&",
"(",
"bool",
")",
"array_filter",
"(",
"$",
"files",
",",
"function",
"(",
"$",
"file",
")",
"{",
"$",
"parts",
"=",
"explode",
"(",
"'/'",
",",
"$",
"file",
")",
";",
"return",
"isset",
"(",
"$",
"parts",
"[",
"1",
"]",
")",
"&&",
"$",
"parts",
"[",
"1",
"]",
"===",
"'src'",
"&&",
"count",
"(",
"$",
"parts",
")",
">",
"2",
";",
"}",
")",
")",
"{",
"$",
"suggestedLevel",
"=",
"self",
"::",
"LEVEL_MINOR",
";",
"$",
"reasons",
"[",
"]",
"=",
"'There are changes in the component `src` folder.'",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"levelChoices",
"[",
"self",
"::",
"LEVEL_MINOR",
"]",
")",
"&&",
"in_array",
"(",
"'composer.json'",
",",
"$",
"files",
")",
")",
"{",
"$",
"suggestedLevel",
"=",
"self",
"::",
"LEVEL_MINOR",
";",
"$",
"reasons",
"[",
"]",
"=",
"'The component `composer.json` file was modified.'",
";",
"}",
"if",
"(",
"$",
"suggestedLevel",
"===",
"self",
"::",
"LEVEL_PATCH",
")",
"{",
"$",
"reasons",
"[",
"]",
"=",
"'None of the indicators show the commit includes a client-facing code change.'",
";",
"}",
"return",
"[",
"$",
"suggestedLevel",
",",
"$",
"reasons",
"]",
";",
"}"
] | Logic to determine the best release level for a component.
@param array $levelChoices Allowed levels for the component.
@param string $suggestedLevel The current suggested level for the release.
@param array $files A list of files in the component folder modified in
the commit.
@return array [$suggestedLevel, $reasons] | [
"Logic",
"to",
"determine",
"the",
"best",
"release",
"level",
"for",
"a",
"component",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/dev/src/ReleaseBuilder/ReleaseBuilder.php#L560-L587 | train |
googleapis/google-cloud-php | dev/src/ReleaseBuilder/ReleaseBuilder.php | ReleaseBuilder.getOrgAndRepo | private function getOrgAndRepo(array $composer)
{
$target = $composer['target'];
$matches = [];
preg_match(self::TARGET_REGEX, $target, $matches);
$org = $matches[1];
$repo = $matches[2];
return [$org, $repo];
} | php | private function getOrgAndRepo(array $composer)
{
$target = $composer['target'];
$matches = [];
preg_match(self::TARGET_REGEX, $target, $matches);
$org = $matches[1];
$repo = $matches[2];
return [$org, $repo];
} | [
"private",
"function",
"getOrgAndRepo",
"(",
"array",
"$",
"composer",
")",
"{",
"$",
"target",
"=",
"$",
"composer",
"[",
"'target'",
"]",
";",
"$",
"matches",
"=",
"[",
"]",
";",
"preg_match",
"(",
"self",
"::",
"TARGET_REGEX",
",",
"$",
"target",
",",
"$",
"matches",
")",
";",
"$",
"org",
"=",
"$",
"matches",
"[",
"1",
"]",
";",
"$",
"repo",
"=",
"$",
"matches",
"[",
"2",
"]",
";",
"return",
"[",
"$",
"org",
",",
"$",
"repo",
"]",
";",
"}"
] | Parse the organization and repo from a composer file.
@param array $composer
@return array [$org, $repo] | [
"Parse",
"the",
"organization",
"and",
"repo",
"from",
"a",
"composer",
"file",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/dev/src/ReleaseBuilder/ReleaseBuilder.php#L595-L606 | train |
googleapis/google-cloud-php | dev/src/ReleaseBuilder/ReleaseBuilder.php | ReleaseBuilder.hasExpectedBase | private function hasExpectedBase($org, $repo, $version)
{
$url = sprintf(
self::GITHUB_RELEASES_ENDPOINT,
$org,
$repo,
$version
);
try {
$res = $this->http->get($url, [
'auth' => [null, $this->token]
]);
return true;
} catch (RequestException $e) {
return false;
}
} | php | private function hasExpectedBase($org, $repo, $version)
{
$url = sprintf(
self::GITHUB_RELEASES_ENDPOINT,
$org,
$repo,
$version
);
try {
$res = $this->http->get($url, [
'auth' => [null, $this->token]
]);
return true;
} catch (RequestException $e) {
return false;
}
} | [
"private",
"function",
"hasExpectedBase",
"(",
"$",
"org",
",",
"$",
"repo",
",",
"$",
"version",
")",
"{",
"$",
"url",
"=",
"sprintf",
"(",
"self",
"::",
"GITHUB_RELEASES_ENDPOINT",
",",
"$",
"org",
",",
"$",
"repo",
",",
"$",
"version",
")",
";",
"try",
"{",
"$",
"res",
"=",
"$",
"this",
"->",
"http",
"->",
"get",
"(",
"$",
"url",
",",
"[",
"'auth'",
"=>",
"[",
"null",
",",
"$",
"this",
"->",
"token",
"]",
"]",
")",
";",
"return",
"true",
";",
"}",
"catch",
"(",
"RequestException",
"$",
"e",
")",
"{",
"return",
"false",
";",
"}",
"}"
] | Check that a Github Repository has the expected release.
Used to verify existence of the previous release to compare against.
@param string $org The github organization
@param string $repo The github repository name.
@param string $version The version to search for.
@return bool | [
"Check",
"that",
"a",
"Github",
"Repository",
"has",
"the",
"expected",
"release",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/dev/src/ReleaseBuilder/ReleaseBuilder.php#L618-L635 | train |
googleapis/google-cloud-php | dev/src/ReleaseBuilder/ReleaseBuilder.php | ReleaseBuilder.getCommits | private function getCommits($org, $repo, $version)
{
$url = sprintf(
self::GITHUB_COMPARE_ENDPOINT,
$org,
$repo,
$version
);
$res = json_decode($this->http->get($url, [
'auth' => [null, $this->token]
])->getBody(), true);
$commits = [];
foreach ($res['commits'] as $commit) {
$message = $commit['commit']['message'];
$description = explode("\n", $message)[0];
$matches = [];
if (preg_match('/(.{0,})\(\#(\d{1,})\)/', $description, $matches) === 1) {
$message = trim($matches[1]);
$prNumber = isset($matches[2]) ? $matches[2] : null;
} else {
$prNumber = $this->askForPrNumber($message);
}
if (strpos($message, '[CHANGE ME]') === 0 && $prNumber) {
$message = $this->getMessageFromPullRequest($org, $repo, $prNumber);
}
$commits[] = [
'url' => $commit['url'],
'htmlUrl' => $commit['html_url'],
'message' => $message,
'reference' => $prNumber,
'hash' => $commit['sha']
];
}
return $commits;
} | php | private function getCommits($org, $repo, $version)
{
$url = sprintf(
self::GITHUB_COMPARE_ENDPOINT,
$org,
$repo,
$version
);
$res = json_decode($this->http->get($url, [
'auth' => [null, $this->token]
])->getBody(), true);
$commits = [];
foreach ($res['commits'] as $commit) {
$message = $commit['commit']['message'];
$description = explode("\n", $message)[0];
$matches = [];
if (preg_match('/(.{0,})\(\#(\d{1,})\)/', $description, $matches) === 1) {
$message = trim($matches[1]);
$prNumber = isset($matches[2]) ? $matches[2] : null;
} else {
$prNumber = $this->askForPrNumber($message);
}
if (strpos($message, '[CHANGE ME]') === 0 && $prNumber) {
$message = $this->getMessageFromPullRequest($org, $repo, $prNumber);
}
$commits[] = [
'url' => $commit['url'],
'htmlUrl' => $commit['html_url'],
'message' => $message,
'reference' => $prNumber,
'hash' => $commit['sha']
];
}
return $commits;
} | [
"private",
"function",
"getCommits",
"(",
"$",
"org",
",",
"$",
"repo",
",",
"$",
"version",
")",
"{",
"$",
"url",
"=",
"sprintf",
"(",
"self",
"::",
"GITHUB_COMPARE_ENDPOINT",
",",
"$",
"org",
",",
"$",
"repo",
",",
"$",
"version",
")",
";",
"$",
"res",
"=",
"json_decode",
"(",
"$",
"this",
"->",
"http",
"->",
"get",
"(",
"$",
"url",
",",
"[",
"'auth'",
"=>",
"[",
"null",
",",
"$",
"this",
"->",
"token",
"]",
"]",
")",
"->",
"getBody",
"(",
")",
",",
"true",
")",
";",
"$",
"commits",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"res",
"[",
"'commits'",
"]",
"as",
"$",
"commit",
")",
"{",
"$",
"message",
"=",
"$",
"commit",
"[",
"'commit'",
"]",
"[",
"'message'",
"]",
";",
"$",
"description",
"=",
"explode",
"(",
"\"\\n\"",
",",
"$",
"message",
")",
"[",
"0",
"]",
";",
"$",
"matches",
"=",
"[",
"]",
";",
"if",
"(",
"preg_match",
"(",
"'/(.{0,})\\(\\#(\\d{1,})\\)/'",
",",
"$",
"description",
",",
"$",
"matches",
")",
"===",
"1",
")",
"{",
"$",
"message",
"=",
"trim",
"(",
"$",
"matches",
"[",
"1",
"]",
")",
";",
"$",
"prNumber",
"=",
"isset",
"(",
"$",
"matches",
"[",
"2",
"]",
")",
"?",
"$",
"matches",
"[",
"2",
"]",
":",
"null",
";",
"}",
"else",
"{",
"$",
"prNumber",
"=",
"$",
"this",
"->",
"askForPrNumber",
"(",
"$",
"message",
")",
";",
"}",
"if",
"(",
"strpos",
"(",
"$",
"message",
",",
"'[CHANGE ME]'",
")",
"===",
"0",
"&&",
"$",
"prNumber",
")",
"{",
"$",
"message",
"=",
"$",
"this",
"->",
"getMessageFromPullRequest",
"(",
"$",
"org",
",",
"$",
"repo",
",",
"$",
"prNumber",
")",
";",
"}",
"$",
"commits",
"[",
"]",
"=",
"[",
"'url'",
"=>",
"$",
"commit",
"[",
"'url'",
"]",
",",
"'htmlUrl'",
"=>",
"$",
"commit",
"[",
"'html_url'",
"]",
",",
"'message'",
"=>",
"$",
"message",
",",
"'reference'",
"=>",
"$",
"prNumber",
",",
"'hash'",
"=>",
"$",
"commit",
"[",
"'sha'",
"]",
"]",
";",
"}",
"return",
"$",
"commits",
";",
"}"
] | Get a list of commits between a version and the current repository state.
@param string $org The github organization
@param string $repo The github repository name.
@param string $version The version to search for.
@return array | [
"Get",
"a",
"list",
"of",
"commits",
"between",
"a",
"version",
"and",
"the",
"current",
"repository",
"state",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/dev/src/ReleaseBuilder/ReleaseBuilder.php#L645-L684 | train |
googleapis/google-cloud-php | dev/src/ReleaseBuilder/ReleaseBuilder.php | ReleaseBuilder.getCommitComponentModifiedList | private function getCommitComponentModifiedList($url)
{
$commit = json_decode($this->http->get($url, [
'auth' => [null, $this->token]
])->getBody(), true);
$changedComponents = [];
$fileDirectoryComponent = [];
foreach ($commit['files'] as $file) {
$filename = $file['filename'];
if (strpos($filename, '/') === false) {
continue;
}
$fileParts = explode('/', $filename);
$componentDirectory = $fileParts[0];
$composerPath = $this->rootPath .'/'. $componentDirectory .'/composer.json';
if (!array_key_exists($composerPath, $fileDirectoryComponent)) {
if (!file_exists($composerPath)) {
continue;
}
$composer = json_decode(file_get_contents($composerPath), true)['extra']['component'];
$fileDirectoryComponent[$composerPath] = $composer;
} else {
$composer = $fileDirectoryComponent[$composerPath];
}
if (!isset($changedComponents[$composer['id']])) {
$changedComponents[$composer['id']] = [
'files' => [],
'level' => 'minor'
];
}
$changedComponents[$composer['id']]['files'][] = $file['filename'];
}
return $changedComponents;
} | php | private function getCommitComponentModifiedList($url)
{
$commit = json_decode($this->http->get($url, [
'auth' => [null, $this->token]
])->getBody(), true);
$changedComponents = [];
$fileDirectoryComponent = [];
foreach ($commit['files'] as $file) {
$filename = $file['filename'];
if (strpos($filename, '/') === false) {
continue;
}
$fileParts = explode('/', $filename);
$componentDirectory = $fileParts[0];
$composerPath = $this->rootPath .'/'. $componentDirectory .'/composer.json';
if (!array_key_exists($composerPath, $fileDirectoryComponent)) {
if (!file_exists($composerPath)) {
continue;
}
$composer = json_decode(file_get_contents($composerPath), true)['extra']['component'];
$fileDirectoryComponent[$composerPath] = $composer;
} else {
$composer = $fileDirectoryComponent[$composerPath];
}
if (!isset($changedComponents[$composer['id']])) {
$changedComponents[$composer['id']] = [
'files' => [],
'level' => 'minor'
];
}
$changedComponents[$composer['id']]['files'][] = $file['filename'];
}
return $changedComponents;
} | [
"private",
"function",
"getCommitComponentModifiedList",
"(",
"$",
"url",
")",
"{",
"$",
"commit",
"=",
"json_decode",
"(",
"$",
"this",
"->",
"http",
"->",
"get",
"(",
"$",
"url",
",",
"[",
"'auth'",
"=>",
"[",
"null",
",",
"$",
"this",
"->",
"token",
"]",
"]",
")",
"->",
"getBody",
"(",
")",
",",
"true",
")",
";",
"$",
"changedComponents",
"=",
"[",
"]",
";",
"$",
"fileDirectoryComponent",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"commit",
"[",
"'files'",
"]",
"as",
"$",
"file",
")",
"{",
"$",
"filename",
"=",
"$",
"file",
"[",
"'filename'",
"]",
";",
"if",
"(",
"strpos",
"(",
"$",
"filename",
",",
"'/'",
")",
"===",
"false",
")",
"{",
"continue",
";",
"}",
"$",
"fileParts",
"=",
"explode",
"(",
"'/'",
",",
"$",
"filename",
")",
";",
"$",
"componentDirectory",
"=",
"$",
"fileParts",
"[",
"0",
"]",
";",
"$",
"composerPath",
"=",
"$",
"this",
"->",
"rootPath",
".",
"'/'",
".",
"$",
"componentDirectory",
".",
"'/composer.json'",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"composerPath",
",",
"$",
"fileDirectoryComponent",
")",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"composerPath",
")",
")",
"{",
"continue",
";",
"}",
"$",
"composer",
"=",
"json_decode",
"(",
"file_get_contents",
"(",
"$",
"composerPath",
")",
",",
"true",
")",
"[",
"'extra'",
"]",
"[",
"'component'",
"]",
";",
"$",
"fileDirectoryComponent",
"[",
"$",
"composerPath",
"]",
"=",
"$",
"composer",
";",
"}",
"else",
"{",
"$",
"composer",
"=",
"$",
"fileDirectoryComponent",
"[",
"$",
"composerPath",
"]",
";",
"}",
"if",
"(",
"!",
"isset",
"(",
"$",
"changedComponents",
"[",
"$",
"composer",
"[",
"'id'",
"]",
"]",
")",
")",
"{",
"$",
"changedComponents",
"[",
"$",
"composer",
"[",
"'id'",
"]",
"]",
"=",
"[",
"'files'",
"=>",
"[",
"]",
",",
"'level'",
"=>",
"'minor'",
"]",
";",
"}",
"$",
"changedComponents",
"[",
"$",
"composer",
"[",
"'id'",
"]",
"]",
"[",
"'files'",
"]",
"[",
"]",
"=",
"$",
"file",
"[",
"'filename'",
"]",
";",
"}",
"return",
"$",
"changedComponents",
";",
"}"
] | Query the github API for a list of files modified by a commit.
@param string $url The URL to the commit.
@return array A list of files. | [
"Query",
"the",
"github",
"API",
"for",
"a",
"list",
"of",
"files",
"modified",
"by",
"a",
"commit",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/dev/src/ReleaseBuilder/ReleaseBuilder.php#L719-L759 | train |
googleapis/google-cloud-php | Spanner/src/SpannerClient.php | SpannerClient.batch | public function batch($instanceId, $databaseId)
{
$operation = new Operation(
$this->connection,
$this->returnInt64AsObject
);
return new BatchClient(
$operation,
GapicSpannerClient::databaseName(
$this->projectId,
$instanceId,
$databaseId
)
);
} | php | public function batch($instanceId, $databaseId)
{
$operation = new Operation(
$this->connection,
$this->returnInt64AsObject
);
return new BatchClient(
$operation,
GapicSpannerClient::databaseName(
$this->projectId,
$instanceId,
$databaseId
)
);
} | [
"public",
"function",
"batch",
"(",
"$",
"instanceId",
",",
"$",
"databaseId",
")",
"{",
"$",
"operation",
"=",
"new",
"Operation",
"(",
"$",
"this",
"->",
"connection",
",",
"$",
"this",
"->",
"returnInt64AsObject",
")",
";",
"return",
"new",
"BatchClient",
"(",
"$",
"operation",
",",
"GapicSpannerClient",
"::",
"databaseName",
"(",
"$",
"this",
"->",
"projectId",
",",
"$",
"instanceId",
",",
"$",
"databaseId",
")",
")",
";",
"}"
] | Get a Batch Client.
Batch Clients allow you to execute reads of very large data sets, spread
across multiple partitions.
Example:
```
$batch = $spanner->batch('instance-id', 'database-id');
```
@param string $instanceId The instance to connect to.
@param string $databaseId The database to connect to.
@return BatchClient | [
"Get",
"a",
"Batch",
"Client",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/SpannerClient.php#L188-L203 | train |
googleapis/google-cloud-php | Spanner/src/SpannerClient.php | SpannerClient.instanceConfigurations | public function instanceConfigurations(array $options = [])
{
$resultLimit = $this->pluck('resultLimit', $options, false) ?: 0;
return new ItemIterator(
new PageIterator(
function (array $config) {
return $this->instanceConfiguration($config['name'], $config);
},
[$this->connection, 'listInstanceConfigs'],
['projectId' => InstanceAdminClient::projectName($this->projectId)] + $options,
[
'itemsKey' => 'instanceConfigs',
'resultLimit' => $resultLimit
]
)
);
} | php | public function instanceConfigurations(array $options = [])
{
$resultLimit = $this->pluck('resultLimit', $options, false) ?: 0;
return new ItemIterator(
new PageIterator(
function (array $config) {
return $this->instanceConfiguration($config['name'], $config);
},
[$this->connection, 'listInstanceConfigs'],
['projectId' => InstanceAdminClient::projectName($this->projectId)] + $options,
[
'itemsKey' => 'instanceConfigs',
'resultLimit' => $resultLimit
]
)
);
} | [
"public",
"function",
"instanceConfigurations",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"resultLimit",
"=",
"$",
"this",
"->",
"pluck",
"(",
"'resultLimit'",
",",
"$",
"options",
",",
"false",
")",
"?",
":",
"0",
";",
"return",
"new",
"ItemIterator",
"(",
"new",
"PageIterator",
"(",
"function",
"(",
"array",
"$",
"config",
")",
"{",
"return",
"$",
"this",
"->",
"instanceConfiguration",
"(",
"$",
"config",
"[",
"'name'",
"]",
",",
"$",
"config",
")",
";",
"}",
",",
"[",
"$",
"this",
"->",
"connection",
",",
"'listInstanceConfigs'",
"]",
",",
"[",
"'projectId'",
"=>",
"InstanceAdminClient",
"::",
"projectName",
"(",
"$",
"this",
"->",
"projectId",
")",
"]",
"+",
"$",
"options",
",",
"[",
"'itemsKey'",
"=>",
"'instanceConfigs'",
",",
"'resultLimit'",
"=>",
"$",
"resultLimit",
"]",
")",
")",
";",
"}"
] | List all available instance configurations.
Example:
```
$configurations = $spanner->instanceConfigurations();
```
@codingStandardsIgnoreStart
@see https://cloud.google.com/spanner/docs/reference/rpc/google.spanner.admin.instance.v1#google.spanner.admin.instance.v1.ListInstanceConfigsRequest ListInstanceConfigsRequest
@codingStandardsIgnoreEnd
@param array $options [optional] {
Configuration Options.
@type int $pageSize Maximum number of results to return per
request.
@type int $resultLimit Limit the number of results returned in total.
**Defaults to** `0` (return all results).
@type string $pageToken A previously-returned page token used to
resume the loading of results from a specific point.
}
@return ItemIterator<InstanceConfiguration> | [
"List",
"all",
"available",
"instance",
"configurations",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/SpannerClient.php#L229-L246 | train |
googleapis/google-cloud-php | Spanner/src/SpannerClient.php | SpannerClient.instanceConfiguration | public function instanceConfiguration($name, array $config = [])
{
return new InstanceConfiguration($this->connection, $this->projectId, $name, $config);
} | php | public function instanceConfiguration($name, array $config = [])
{
return new InstanceConfiguration($this->connection, $this->projectId, $name, $config);
} | [
"public",
"function",
"instanceConfiguration",
"(",
"$",
"name",
",",
"array",
"$",
"config",
"=",
"[",
"]",
")",
"{",
"return",
"new",
"InstanceConfiguration",
"(",
"$",
"this",
"->",
"connection",
",",
"$",
"this",
"->",
"projectId",
",",
"$",
"name",
",",
"$",
"config",
")",
";",
"}"
] | Get an instance configuration by its name.
NOTE: This method does not execute a service request and does not verify
the existence of the given configuration. Unless you know with certainty
that the configuration exists, it is advised that you use
{@see Google\Cloud\Spanner\InstanceConfiguration::exists()} to verify
existence before attempting to use the configuration.
Example:
```
$configuration = $spanner->instanceConfiguration($configurationName);
```
@codingStandardsIgnoreStart
@see https://cloud.google.com/spanner/docs/reference/rpc/google.spanner.admin.instance.v1#getinstanceconfigrequest GetInstanceConfigRequest
@codingStandardsIgnoreEnd
@param string $name The Configuration name.
@param array $config [optional] The configuration details.
@return InstanceConfiguration | [
"Get",
"an",
"instance",
"configuration",
"by",
"its",
"name",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/SpannerClient.php#L270-L273 | train |
googleapis/google-cloud-php | Spanner/src/SpannerClient.php | SpannerClient.instance | public function instance($name, array $instance = [])
{
return new Instance(
$this->connection,
$this->lroConnection,
$this->lroCallables,
$this->projectId,
$name,
$this->returnInt64AsObject,
$instance
);
} | php | public function instance($name, array $instance = [])
{
return new Instance(
$this->connection,
$this->lroConnection,
$this->lroCallables,
$this->projectId,
$name,
$this->returnInt64AsObject,
$instance
);
} | [
"public",
"function",
"instance",
"(",
"$",
"name",
",",
"array",
"$",
"instance",
"=",
"[",
"]",
")",
"{",
"return",
"new",
"Instance",
"(",
"$",
"this",
"->",
"connection",
",",
"$",
"this",
"->",
"lroConnection",
",",
"$",
"this",
"->",
"lroCallables",
",",
"$",
"this",
"->",
"projectId",
",",
"$",
"name",
",",
"$",
"this",
"->",
"returnInt64AsObject",
",",
"$",
"instance",
")",
";",
"}"
] | Lazily instantiate an instance.
Example:
```
$instance = $spanner->instance('my-instance');
```
@param string $name The instance name
@return Instance | [
"Lazily",
"instantiate",
"an",
"instance",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/SpannerClient.php#L316-L327 | train |
googleapis/google-cloud-php | Spanner/src/SpannerClient.php | SpannerClient.instances | public function instances(array $options = [])
{
$options += [
'filter' => null
];
$resultLimit = $this->pluck('resultLimit', $options, false);
return new ItemIterator(
new PageIterator(
function (array $instance) {
$name = InstanceAdminClient::parseName($instance['name'])['instance'];
return $this->instance($name, $instance);
},
[$this->connection, 'listInstances'],
['projectId' => InstanceAdminClient::projectName($this->projectId)] + $options,
[
'itemsKey' => 'instances',
'resultLimit' => $resultLimit
]
)
);
} | php | public function instances(array $options = [])
{
$options += [
'filter' => null
];
$resultLimit = $this->pluck('resultLimit', $options, false);
return new ItemIterator(
new PageIterator(
function (array $instance) {
$name = InstanceAdminClient::parseName($instance['name'])['instance'];
return $this->instance($name, $instance);
},
[$this->connection, 'listInstances'],
['projectId' => InstanceAdminClient::projectName($this->projectId)] + $options,
[
'itemsKey' => 'instances',
'resultLimit' => $resultLimit
]
)
);
} | [
"public",
"function",
"instances",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"+=",
"[",
"'filter'",
"=>",
"null",
"]",
";",
"$",
"resultLimit",
"=",
"$",
"this",
"->",
"pluck",
"(",
"'resultLimit'",
",",
"$",
"options",
",",
"false",
")",
";",
"return",
"new",
"ItemIterator",
"(",
"new",
"PageIterator",
"(",
"function",
"(",
"array",
"$",
"instance",
")",
"{",
"$",
"name",
"=",
"InstanceAdminClient",
"::",
"parseName",
"(",
"$",
"instance",
"[",
"'name'",
"]",
")",
"[",
"'instance'",
"]",
";",
"return",
"$",
"this",
"->",
"instance",
"(",
"$",
"name",
",",
"$",
"instance",
")",
";",
"}",
",",
"[",
"$",
"this",
"->",
"connection",
",",
"'listInstances'",
"]",
",",
"[",
"'projectId'",
"=>",
"InstanceAdminClient",
"::",
"projectName",
"(",
"$",
"this",
"->",
"projectId",
")",
"]",
"+",
"$",
"options",
",",
"[",
"'itemsKey'",
"=>",
"'instances'",
",",
"'resultLimit'",
"=>",
"$",
"resultLimit",
"]",
")",
")",
";",
"}"
] | List instances in the project
Example:
```
$instances = $spanner->instances();
```
@codingStandardsIgnoreStart
@see https://cloud.google.com/spanner/docs/reference/rpc/google.spanner.admin.instance.v1#listinstancesrequest ListInstancesRequest
@codingStandardsIgnoreEnd
@param array $options [optional] {
Configuration options
@type string $filter An expression for filtering the results of the
request.
@type int $pageSize Maximum number of results to return per
request.
@type int $resultLimit Limit the number of results returned in total.
**Defaults to** `0` (return all results).
@type string $pageToken A previously-returned page token used to
resume the loading of results from a specific point.
}
@return ItemIterator<Instance> | [
"List",
"instances",
"in",
"the",
"project"
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/SpannerClient.php#L355-L376 | train |
googleapis/google-cloud-php | Spanner/src/SpannerClient.php | SpannerClient.connect | public function connect($instance, $name, array $options = [])
{
if (is_string($instance)) {
$instance = $this->instance($instance);
}
$database = $instance->database($name, $options);
return $database;
} | php | public function connect($instance, $name, array $options = [])
{
if (is_string($instance)) {
$instance = $this->instance($instance);
}
$database = $instance->database($name, $options);
return $database;
} | [
"public",
"function",
"connect",
"(",
"$",
"instance",
",",
"$",
"name",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"instance",
")",
")",
"{",
"$",
"instance",
"=",
"$",
"this",
"->",
"instance",
"(",
"$",
"instance",
")",
";",
"}",
"$",
"database",
"=",
"$",
"instance",
"->",
"database",
"(",
"$",
"name",
",",
"$",
"options",
")",
";",
"return",
"$",
"database",
";",
"}"
] | Connect to a database to run queries or mutations.
Example:
```
$database = $spanner->connect('instance-id', 'database-id');
```
@param Instance|string $instance The instance object or instance name.
@param string $name The database name.
@param array $options [optional] {
Configuration options.
@type SessionPoolInterface $sessionPool A pool used to manage
sessions.
}
@return Database | [
"Connect",
"to",
"a",
"database",
"to",
"run",
"queries",
"or",
"mutations",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/SpannerClient.php#L396-L405 | train |
googleapis/google-cloud-php | Monitoring/src/V3/Aggregation.php | Aggregation.setPerSeriesAligner | public function setPerSeriesAligner($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Monitoring\V3\Aggregation_Aligner::class);
$this->per_series_aligner = $var;
return $this;
} | php | public function setPerSeriesAligner($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Monitoring\V3\Aggregation_Aligner::class);
$this->per_series_aligner = $var;
return $this;
} | [
"public",
"function",
"setPerSeriesAligner",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Monitoring",
"\\",
"V3",
"\\",
"Aggregation_Aligner",
"::",
"class",
")",
";",
"$",
"this",
"->",
"per_series_aligner",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | The approach to be used to align individual time series. Not all
alignment functions may be applied to all time series, depending
on the metric type and value type of the original time
series. Alignment may change the metric type or the value type of
the time series.
Time series data must be aligned in order to perform cross-time
series reduction. If `crossSeriesReducer` is specified, then
`perSeriesAligner` must be specified and not equal `ALIGN_NONE`
and `alignmentPeriod` must be specified; otherwise, an error is
returned.
Generated from protobuf field <code>.google.monitoring.v3.Aggregation.Aligner per_series_aligner = 2;</code>
@param int $var
@return $this | [
"The",
"approach",
"to",
"be",
"used",
"to",
"align",
"individual",
"time",
"series",
".",
"Not",
"all",
"alignment",
"functions",
"may",
"be",
"applied",
"to",
"all",
"time",
"series",
"depending",
"on",
"the",
"metric",
"type",
"and",
"value",
"type",
"of",
"the",
"original",
"time",
"series",
".",
"Alignment",
"may",
"change",
"the",
"metric",
"type",
"or",
"the",
"value",
"type",
"of",
"the",
"time",
"series",
".",
"Time",
"series",
"data",
"must",
"be",
"aligned",
"in",
"order",
"to",
"perform",
"cross",
"-",
"time",
"series",
"reduction",
".",
"If",
"crossSeriesReducer",
"is",
"specified",
"then",
"perSeriesAligner",
"must",
"be",
"specified",
"and",
"not",
"equal",
"ALIGN_NONE",
"and",
"alignmentPeriod",
"must",
"be",
"specified",
";",
"otherwise",
"an",
"error",
"is",
"returned",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Monitoring/src/V3/Aggregation.php#L221-L227 | train |
googleapis/google-cloud-php | Monitoring/src/V3/Aggregation.php | Aggregation.setCrossSeriesReducer | public function setCrossSeriesReducer($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Monitoring\V3\Aggregation_Reducer::class);
$this->cross_series_reducer = $var;
return $this;
} | php | public function setCrossSeriesReducer($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Monitoring\V3\Aggregation_Reducer::class);
$this->cross_series_reducer = $var;
return $this;
} | [
"public",
"function",
"setCrossSeriesReducer",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Monitoring",
"\\",
"V3",
"\\",
"Aggregation_Reducer",
"::",
"class",
")",
";",
"$",
"this",
"->",
"cross_series_reducer",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | The approach to be used to combine time series. Not all reducer
functions may be applied to all time series, depending on the
metric type and the value type of the original time
series. Reduction may change the metric type of value type of the
time series.
Time series data must be aligned in order to perform cross-time
series reduction. If `crossSeriesReducer` is specified, then
`perSeriesAligner` must be specified and not equal `ALIGN_NONE`
and `alignmentPeriod` must be specified; otherwise, an error is
returned.
Generated from protobuf field <code>.google.monitoring.v3.Aggregation.Reducer cross_series_reducer = 4;</code>
@param int $var
@return $this | [
"The",
"approach",
"to",
"be",
"used",
"to",
"combine",
"time",
"series",
".",
"Not",
"all",
"reducer",
"functions",
"may",
"be",
"applied",
"to",
"all",
"time",
"series",
"depending",
"on",
"the",
"metric",
"type",
"and",
"the",
"value",
"type",
"of",
"the",
"original",
"time",
"series",
".",
"Reduction",
"may",
"change",
"the",
"metric",
"type",
"of",
"value",
"type",
"of",
"the",
"time",
"series",
".",
"Time",
"series",
"data",
"must",
"be",
"aligned",
"in",
"order",
"to",
"perform",
"cross",
"-",
"time",
"series",
"reduction",
".",
"If",
"crossSeriesReducer",
"is",
"specified",
"then",
"perSeriesAligner",
"must",
"be",
"specified",
"and",
"not",
"equal",
"ALIGN_NONE",
"and",
"alignmentPeriod",
"must",
"be",
"specified",
";",
"otherwise",
"an",
"error",
"is",
"returned",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Monitoring/src/V3/Aggregation.php#L265-L271 | train |
googleapis/google-cloud-php | Monitoring/src/V3/Aggregation.php | Aggregation.setGroupByFields | public function setGroupByFields($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->group_by_fields = $arr;
return $this;
} | php | public function setGroupByFields($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->group_by_fields = $arr;
return $this;
} | [
"public",
"function",
"setGroupByFields",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"STRING",
")",
";",
"$",
"this",
"->",
"group_by_fields",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | The set of fields to preserve when `crossSeriesReducer` is
specified. The `groupByFields` determine how the time series are
partitioned into subsets prior to applying the aggregation
function. Each subset contains time series that have the same
value for each of the grouping fields. Each individual time
series is a member of exactly one subset. The
`crossSeriesReducer` is applied to each subset of time series.
It is not possible to reduce across different resource types, so
this field implicitly contains `resource.type`. Fields not
specified in `groupByFields` are aggregated away. If
`groupByFields` is not specified and all the time series have
the same resource type, then the time series are aggregated into
a single output time series. If `crossSeriesReducer` is not
defined, this field is ignored.
Generated from protobuf field <code>repeated string group_by_fields = 5;</code>
@param string[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"The",
"set",
"of",
"fields",
"to",
"preserve",
"when",
"crossSeriesReducer",
"is",
"specified",
".",
"The",
"groupByFields",
"determine",
"how",
"the",
"time",
"series",
"are",
"partitioned",
"into",
"subsets",
"prior",
"to",
"applying",
"the",
"aggregation",
"function",
".",
"Each",
"subset",
"contains",
"time",
"series",
"that",
"have",
"the",
"same",
"value",
"for",
"each",
"of",
"the",
"grouping",
"fields",
".",
"Each",
"individual",
"time",
"series",
"is",
"a",
"member",
"of",
"exactly",
"one",
"subset",
".",
"The",
"crossSeriesReducer",
"is",
"applied",
"to",
"each",
"subset",
"of",
"time",
"series",
".",
"It",
"is",
"not",
"possible",
"to",
"reduce",
"across",
"different",
"resource",
"types",
"so",
"this",
"field",
"implicitly",
"contains",
"resource",
".",
"type",
".",
"Fields",
"not",
"specified",
"in",
"groupByFields",
"are",
"aggregated",
"away",
".",
"If",
"groupByFields",
"is",
"not",
"specified",
"and",
"all",
"the",
"time",
"series",
"have",
"the",
"same",
"resource",
"type",
"then",
"the",
"time",
"series",
"are",
"aggregated",
"into",
"a",
"single",
"output",
"time",
"series",
".",
"If",
"crossSeriesReducer",
"is",
"not",
"defined",
"this",
"field",
"is",
"ignored",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Monitoring/src/V3/Aggregation.php#L317-L323 | train |
googleapis/google-cloud-php | Core/src/Upload/ResumableUploader.php | ResumableUploader.resume | public function resume($resumeUri)
{
if (!$this->data->isSeekable()) {
throw new GoogleException('Cannot resume upload on a stream which cannot be seeked.');
}
$this->resumeUri = $resumeUri;
$response = $this->getStatusResponse();
if ($response->getBody()->getSize() > 0) {
return $this->decodeResponse($response);
}
$this->rangeStart = $this->getRangeStart($response->getHeaderLine('Range'));
return $this->upload();
} | php | public function resume($resumeUri)
{
if (!$this->data->isSeekable()) {
throw new GoogleException('Cannot resume upload on a stream which cannot be seeked.');
}
$this->resumeUri = $resumeUri;
$response = $this->getStatusResponse();
if ($response->getBody()->getSize() > 0) {
return $this->decodeResponse($response);
}
$this->rangeStart = $this->getRangeStart($response->getHeaderLine('Range'));
return $this->upload();
} | [
"public",
"function",
"resume",
"(",
"$",
"resumeUri",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"data",
"->",
"isSeekable",
"(",
")",
")",
"{",
"throw",
"new",
"GoogleException",
"(",
"'Cannot resume upload on a stream which cannot be seeked.'",
")",
";",
"}",
"$",
"this",
"->",
"resumeUri",
"=",
"$",
"resumeUri",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"getStatusResponse",
"(",
")",
";",
"if",
"(",
"$",
"response",
"->",
"getBody",
"(",
")",
"->",
"getSize",
"(",
")",
">",
"0",
")",
"{",
"return",
"$",
"this",
"->",
"decodeResponse",
"(",
"$",
"response",
")",
";",
"}",
"$",
"this",
"->",
"rangeStart",
"=",
"$",
"this",
"->",
"getRangeStart",
"(",
"$",
"response",
"->",
"getHeaderLine",
"(",
"'Range'",
")",
")",
";",
"return",
"$",
"this",
"->",
"upload",
"(",
")",
";",
"}"
] | Resumes a download using the provided URI.
@param string $resumeUri
@return array
@throws GoogleException | [
"Resumes",
"a",
"download",
"using",
"the",
"provided",
"URI",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Core/src/Upload/ResumableUploader.php#L121-L137 | train |
googleapis/google-cloud-php | Core/src/Upload/ResumableUploader.php | ResumableUploader.getStatusResponse | protected function getStatusResponse()
{
$request = new Request(
'PUT',
$this->resumeUri,
['Content-Range' => 'bytes */*']
);
return $this->requestWrapper->send($request, $this->requestOptions);
} | php | protected function getStatusResponse()
{
$request = new Request(
'PUT',
$this->resumeUri,
['Content-Range' => 'bytes */*']
);
return $this->requestWrapper->send($request, $this->requestOptions);
} | [
"protected",
"function",
"getStatusResponse",
"(",
")",
"{",
"$",
"request",
"=",
"new",
"Request",
"(",
"'PUT'",
",",
"$",
"this",
"->",
"resumeUri",
",",
"[",
"'Content-Range'",
"=>",
"'bytes */*'",
"]",
")",
";",
"return",
"$",
"this",
"->",
"requestWrapper",
"->",
"send",
"(",
"$",
"request",
",",
"$",
"this",
"->",
"requestOptions",
")",
";",
"}"
] | Gets the status of the upload.
@return ResponseInterface | [
"Gets",
"the",
"status",
"of",
"the",
"upload",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Core/src/Upload/ResumableUploader.php#L238-L247 | train |
googleapis/google-cloud-php | Container/src/V1/MaintenancePolicy.php | MaintenancePolicy.setWindow | public function setWindow($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Container\V1\MaintenanceWindow::class);
$this->window = $var;
return $this;
} | php | public function setWindow($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Container\V1\MaintenanceWindow::class);
$this->window = $var;
return $this;
} | [
"public",
"function",
"setWindow",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Container",
"\\",
"V1",
"\\",
"MaintenanceWindow",
"::",
"class",
")",
";",
"$",
"this",
"->",
"window",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Specifies the maintenance window in which maintenance may be performed.
Generated from protobuf field <code>.google.container.v1.MaintenanceWindow window = 1;</code>
@param \Google\Cloud\Container\V1\MaintenanceWindow $var
@return $this | [
"Specifies",
"the",
"maintenance",
"window",
"in",
"which",
"maintenance",
"may",
"be",
"performed",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Container/src/V1/MaintenancePolicy.php#L58-L64 | train |
googleapis/google-cloud-php | AutoMl/src/V1beta1/PredictRequest.php | PredictRequest.setPayload | public function setPayload($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\AutoMl\V1beta1\ExamplePayload::class);
$this->payload = $var;
return $this;
} | php | public function setPayload($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\AutoMl\V1beta1\ExamplePayload::class);
$this->payload = $var;
return $this;
} | [
"public",
"function",
"setPayload",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"AutoMl",
"\\",
"V1beta1",
"\\",
"ExamplePayload",
"::",
"class",
")",
";",
"$",
"this",
"->",
"payload",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Required.
Payload to perform a prediction on. The payload must match the
problem type that the model was trained to solve.
Generated from protobuf field <code>.google.cloud.automl.v1beta1.ExamplePayload payload = 2;</code>
@param \Google\Cloud\AutoMl\V1beta1\ExamplePayload $var
@return $this | [
"Required",
".",
"Payload",
"to",
"perform",
"a",
"prediction",
"on",
".",
"The",
"payload",
"must",
"match",
"the",
"problem",
"type",
"that",
"the",
"model",
"was",
"trained",
"to",
"solve",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/AutoMl/src/V1beta1/PredictRequest.php#L120-L126 | train |
googleapis/google-cloud-php | Firestore/src/V1/ListDocumentsResponse.php | ListDocumentsResponse.setDocuments | public function setDocuments($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Firestore\V1\Document::class);
$this->documents = $arr;
return $this;
} | php | public function setDocuments($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Firestore\V1\Document::class);
$this->documents = $arr;
return $this;
} | [
"public",
"function",
"setDocuments",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Firestore",
"\\",
"V1",
"\\",
"Document",
"::",
"class",
")",
";",
"$",
"this",
"->",
"documents",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | The Documents found.
Generated from protobuf field <code>repeated .google.firestore.v1.Document documents = 1;</code>
@param \Google\Cloud\Firestore\V1\Document[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"The",
"Documents",
"found",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/V1/ListDocumentsResponse.php#L66-L72 | train |
googleapis/google-cloud-php | Spanner/src/Connection/Grpc.php | Grpc.getInstanceAdminClient | private function getInstanceAdminClient()
{
//@codeCoverageIgnoreStart
if ($this->instanceAdminClient) {
return $this->instanceAdminClient;
}
//@codeCoverageIgnoreEnd
$this->instanceAdminClient = new InstanceAdminClient($this->grpcConfig);
return $this->instanceAdminClient;
} | php | private function getInstanceAdminClient()
{
//@codeCoverageIgnoreStart
if ($this->instanceAdminClient) {
return $this->instanceAdminClient;
}
//@codeCoverageIgnoreEnd
$this->instanceAdminClient = new InstanceAdminClient($this->grpcConfig);
return $this->instanceAdminClient;
} | [
"private",
"function",
"getInstanceAdminClient",
"(",
")",
"{",
"//@codeCoverageIgnoreStart",
"if",
"(",
"$",
"this",
"->",
"instanceAdminClient",
")",
"{",
"return",
"$",
"this",
"->",
"instanceAdminClient",
";",
"}",
"//@codeCoverageIgnoreEnd",
"$",
"this",
"->",
"instanceAdminClient",
"=",
"new",
"InstanceAdminClient",
"(",
"$",
"this",
"->",
"grpcConfig",
")",
";",
"return",
"$",
"this",
"->",
"instanceAdminClient",
";",
"}"
] | Allow lazy instantiation of the instance admin client.
@return InstanceAdminClient | [
"Allow",
"lazy",
"instantiation",
"of",
"the",
"instance",
"admin",
"client",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Connection/Grpc.php#L1040-L1051 | train |
googleapis/google-cloud-php | Spanner/src/Connection/Grpc.php | Grpc.getDatabaseAdminClient | private function getDatabaseAdminClient()
{
//@codeCoverageIgnoreStart
if ($this->databaseAdminClient) {
return $this->databaseAdminClient;
}
//@codeCoverageIgnoreEnd
$this->databaseAdminClient = new DatabaseAdminClient($this->grpcConfig);
return $this->databaseAdminClient;
} | php | private function getDatabaseAdminClient()
{
//@codeCoverageIgnoreStart
if ($this->databaseAdminClient) {
return $this->databaseAdminClient;
}
//@codeCoverageIgnoreEnd
$this->databaseAdminClient = new DatabaseAdminClient($this->grpcConfig);
return $this->databaseAdminClient;
} | [
"private",
"function",
"getDatabaseAdminClient",
"(",
")",
"{",
"//@codeCoverageIgnoreStart",
"if",
"(",
"$",
"this",
"->",
"databaseAdminClient",
")",
"{",
"return",
"$",
"this",
"->",
"databaseAdminClient",
";",
"}",
"//@codeCoverageIgnoreEnd",
"$",
"this",
"->",
"databaseAdminClient",
"=",
"new",
"DatabaseAdminClient",
"(",
"$",
"this",
"->",
"grpcConfig",
")",
";",
"return",
"$",
"this",
"->",
"databaseAdminClient",
";",
"}"
] | Allow lazy instantiation of the database admin client.
@return DatabaseAdminClient | [
"Allow",
"lazy",
"instantiation",
"of",
"the",
"database",
"admin",
"client",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Connection/Grpc.php#L1058-L1069 | train |
googleapis/google-cloud-php | Core/src/Logger/AppEngineFlexFormatter.php | AppEngineFlexFormatter.format | public function format(array $record)
{
$message = parent::format($record);
list($usec, $sec) = explode(" ", microtime());
$usec = (int)(((float)$usec)*1000000000);
$sec = (int)$sec;
$payload = [
'message' => $message,
'timestamp'=> ['seconds' => $sec,
'nanos' => $usec],
'thread' => '',
'severity' => $record['level_name'],
];
if (isset($_SERVER['HTTP_X_CLOUD_TRACE_CONTEXT'])) {
$payload['traceId'] = explode(
"/",
$_SERVER['HTTP_X_CLOUD_TRACE_CONTEXT']
)[0];
}
return "\n" . json_encode($payload);
} | php | public function format(array $record)
{
$message = parent::format($record);
list($usec, $sec) = explode(" ", microtime());
$usec = (int)(((float)$usec)*1000000000);
$sec = (int)$sec;
$payload = [
'message' => $message,
'timestamp'=> ['seconds' => $sec,
'nanos' => $usec],
'thread' => '',
'severity' => $record['level_name'],
];
if (isset($_SERVER['HTTP_X_CLOUD_TRACE_CONTEXT'])) {
$payload['traceId'] = explode(
"/",
$_SERVER['HTTP_X_CLOUD_TRACE_CONTEXT']
)[0];
}
return "\n" . json_encode($payload);
} | [
"public",
"function",
"format",
"(",
"array",
"$",
"record",
")",
"{",
"$",
"message",
"=",
"parent",
"::",
"format",
"(",
"$",
"record",
")",
";",
"list",
"(",
"$",
"usec",
",",
"$",
"sec",
")",
"=",
"explode",
"(",
"\" \"",
",",
"microtime",
"(",
")",
")",
";",
"$",
"usec",
"=",
"(",
"int",
")",
"(",
"(",
"(",
"float",
")",
"$",
"usec",
")",
"*",
"1000000000",
")",
";",
"$",
"sec",
"=",
"(",
"int",
")",
"$",
"sec",
";",
"$",
"payload",
"=",
"[",
"'message'",
"=>",
"$",
"message",
",",
"'timestamp'",
"=>",
"[",
"'seconds'",
"=>",
"$",
"sec",
",",
"'nanos'",
"=>",
"$",
"usec",
"]",
",",
"'thread'",
"=>",
"''",
",",
"'severity'",
"=>",
"$",
"record",
"[",
"'level_name'",
"]",
",",
"]",
";",
"if",
"(",
"isset",
"(",
"$",
"_SERVER",
"[",
"'HTTP_X_CLOUD_TRACE_CONTEXT'",
"]",
")",
")",
"{",
"$",
"payload",
"[",
"'traceId'",
"]",
"=",
"explode",
"(",
"\"/\"",
",",
"$",
"_SERVER",
"[",
"'HTTP_X_CLOUD_TRACE_CONTEXT'",
"]",
")",
"[",
"0",
"]",
";",
"}",
"return",
"\"\\n\"",
".",
"json_encode",
"(",
"$",
"payload",
")",
";",
"}"
] | Get the plain text message with LineFormatter's format method and add
metadata including the trace id then return the json string.
@param array $record A record to format
@return mixed The formatted record | [
"Get",
"the",
"plain",
"text",
"message",
"with",
"LineFormatter",
"s",
"format",
"method",
"and",
"add",
"metadata",
"including",
"the",
"trace",
"id",
"then",
"return",
"the",
"json",
"string",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Core/src/Logger/AppEngineFlexFormatter.php#L44-L64 | train |
googleapis/google-cloud-php | Dataproc/src/V1beta2/HadoopJob.php | HadoopJob.setArgs | public function setArgs($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->args = $arr;
return $this;
} | php | public function setArgs($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->args = $arr;
return $this;
} | [
"public",
"function",
"setArgs",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"STRING",
")",
";",
"$",
"this",
"->",
"args",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | Optional. The arguments to pass to the driver. Do not
include arguments, such as `-libjars` or `-Dfoo=bar`, that can be set as
job properties, since a collision may occur that causes an incorrect job
submission.
Generated from protobuf field <code>repeated string args = 3;</code>
@param string[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"Optional",
".",
"The",
"arguments",
"to",
"pass",
"to",
"the",
"driver",
".",
"Do",
"not",
"include",
"arguments",
"such",
"as",
"-",
"libjars",
"or",
"-",
"Dfoo",
"=",
"bar",
"that",
"can",
"be",
"set",
"as",
"job",
"properties",
"since",
"a",
"collision",
"may",
"occur",
"that",
"causes",
"an",
"incorrect",
"job",
"submission",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dataproc/src/V1beta2/HadoopJob.php#L202-L208 | train |
googleapis/google-cloud-php | Monitoring/src/V3/AlertPolicy/Condition.php | Condition.setConditionThreshold | public function setConditionThreshold($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\AlertPolicy_Condition_MetricThreshold::class);
$this->writeOneof(1, $var);
return $this;
} | php | public function setConditionThreshold($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\AlertPolicy_Condition_MetricThreshold::class);
$this->writeOneof(1, $var);
return $this;
} | [
"public",
"function",
"setConditionThreshold",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Monitoring",
"\\",
"V3",
"\\",
"AlertPolicy_Condition_MetricThreshold",
"::",
"class",
")",
";",
"$",
"this",
"->",
"writeOneof",
"(",
"1",
",",
"$",
"var",
")",
";",
"return",
"$",
"this",
";",
"}"
] | A condition that compares a time series against a threshold.
Generated from protobuf field <code>.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold condition_threshold = 1;</code>
@param \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\MetricThreshold $var
@return $this | [
"A",
"condition",
"that",
"compares",
"a",
"time",
"series",
"against",
"a",
"threshold",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Monitoring/src/V3/AlertPolicy/Condition.php#L210-L216 | train |
googleapis/google-cloud-php | Monitoring/src/V3/AlertPolicy/Condition.php | Condition.setConditionAbsent | public function setConditionAbsent($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\AlertPolicy_Condition_MetricAbsence::class);
$this->writeOneof(2, $var);
return $this;
} | php | public function setConditionAbsent($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\AlertPolicy_Condition_MetricAbsence::class);
$this->writeOneof(2, $var);
return $this;
} | [
"public",
"function",
"setConditionAbsent",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Monitoring",
"\\",
"V3",
"\\",
"AlertPolicy_Condition_MetricAbsence",
"::",
"class",
")",
";",
"$",
"this",
"->",
"writeOneof",
"(",
"2",
",",
"$",
"var",
")",
";",
"return",
"$",
"this",
";",
"}"
] | A condition that checks that a time series continues to
receive new data points.
Generated from protobuf field <code>.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence condition_absent = 2;</code>
@param \Google\Cloud\Monitoring\V3\AlertPolicy\Condition\MetricAbsence $var
@return $this | [
"A",
"condition",
"that",
"checks",
"that",
"a",
"time",
"series",
"continues",
"to",
"receive",
"new",
"data",
"points",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Monitoring/src/V3/AlertPolicy/Condition.php#L238-L244 | train |
googleapis/google-cloud-php | Core/src/Iam/Iam.php | Iam.setPolicy | public function setPolicy($policy, array $options = [])
{
if ($policy instanceof PolicyBuilder) {
$policy = $policy->result();
}
if (!is_array($policy)) {
throw new \InvalidArgumentException('Given policy data must be an array or an instance of PolicyBuilder.');
}
$request = [];
if ($this->options['parent']) {
$parent = $this->options['parent'];
$request[$parent] = $policy;
} else {
$request = $policy;
}
return $this->policy = $this->connection->setPolicy([
'resource' => $this->resource
] + $request + $options + $this->options['args']);
} | php | public function setPolicy($policy, array $options = [])
{
if ($policy instanceof PolicyBuilder) {
$policy = $policy->result();
}
if (!is_array($policy)) {
throw new \InvalidArgumentException('Given policy data must be an array or an instance of PolicyBuilder.');
}
$request = [];
if ($this->options['parent']) {
$parent = $this->options['parent'];
$request[$parent] = $policy;
} else {
$request = $policy;
}
return $this->policy = $this->connection->setPolicy([
'resource' => $this->resource
] + $request + $options + $this->options['args']);
} | [
"public",
"function",
"setPolicy",
"(",
"$",
"policy",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"policy",
"instanceof",
"PolicyBuilder",
")",
"{",
"$",
"policy",
"=",
"$",
"policy",
"->",
"result",
"(",
")",
";",
"}",
"if",
"(",
"!",
"is_array",
"(",
"$",
"policy",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Given policy data must be an array or an instance of PolicyBuilder.'",
")",
";",
"}",
"$",
"request",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"options",
"[",
"'parent'",
"]",
")",
"{",
"$",
"parent",
"=",
"$",
"this",
"->",
"options",
"[",
"'parent'",
"]",
";",
"$",
"request",
"[",
"$",
"parent",
"]",
"=",
"$",
"policy",
";",
"}",
"else",
"{",
"$",
"request",
"=",
"$",
"policy",
";",
"}",
"return",
"$",
"this",
"->",
"policy",
"=",
"$",
"this",
"->",
"connection",
"->",
"setPolicy",
"(",
"[",
"'resource'",
"=>",
"$",
"this",
"->",
"resource",
"]",
"+",
"$",
"request",
"+",
"$",
"options",
"+",
"$",
"this",
"->",
"options",
"[",
"'args'",
"]",
")",
";",
"}"
] | Set the IAM policy for this resource.
Bindings with invalid roles, or non-existent members will raise a server
error.
Example:
```
$oldPolicy = $iam->policy();
$oldPolicy['bindings'][0]['members'] = 'user:test@example.com';
$policy = $iam->setPolicy($oldPolicy);
```
@param array|PolicyBuilder $policy The new policy, as an array or an
instance of {@see Google\Cloud\Core\Iam\PolicyBuilder}.
@param array $options Configuration Options
@return array An array of policy data
@throws \InvalidArgumentException If the given policy is not an array or PolicyBuilder. | [
"Set",
"the",
"IAM",
"policy",
"for",
"this",
"resource",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Core/src/Iam/Iam.php#L140-L161 | train |
googleapis/google-cloud-php | Core/src/Iam/Iam.php | Iam.reload | public function reload(array $options = [])
{
return $this->policy = $this->connection->getPolicy([
'resource' => $this->resource
] + $options + $this->options['args']);
} | php | public function reload(array $options = [])
{
return $this->policy = $this->connection->getPolicy([
'resource' => $this->resource
] + $options + $this->options['args']);
} | [
"public",
"function",
"reload",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"policy",
"=",
"$",
"this",
"->",
"connection",
"->",
"getPolicy",
"(",
"[",
"'resource'",
"=>",
"$",
"this",
"->",
"resource",
"]",
"+",
"$",
"options",
"+",
"$",
"this",
"->",
"options",
"[",
"'args'",
"]",
")",
";",
"}"
] | Refresh the IAM policy for this resource.
Example:
```
$policy = $iam->reload();
```
@param array $options Configuration Options
@return array An array of policy data | [
"Refresh",
"the",
"IAM",
"policy",
"for",
"this",
"resource",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Core/src/Iam/Iam.php#L201-L206 | train |
googleapis/google-cloud-php | Dataproc/src/V1/WorkflowTemplate.php | WorkflowTemplate.setJobs | public function setJobs($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dataproc\V1\OrderedJob::class);
$this->jobs = $arr;
return $this;
} | php | public function setJobs($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dataproc\V1\OrderedJob::class);
$this->jobs = $arr;
return $this;
} | [
"public",
"function",
"setJobs",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dataproc",
"\\",
"V1",
"\\",
"OrderedJob",
"::",
"class",
")",
";",
"$",
"this",
"->",
"jobs",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | Required. The Directed Acyclic Graph of Jobs to submit.
Generated from protobuf field <code>repeated .google.cloud.dataproc.v1.OrderedJob jobs = 8;</code>
@param \Google\Cloud\Dataproc\V1\OrderedJob[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"Required",
".",
"The",
"Directed",
"Acyclic",
"Graph",
"of",
"Jobs",
"to",
"submit",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dataproc/src/V1/WorkflowTemplate.php#L388-L394 | train |
googleapis/google-cloud-php | Dataproc/src/V1/WorkflowTemplate.php | WorkflowTemplate.setParameters | public function setParameters($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dataproc\V1\TemplateParameter::class);
$this->parameters = $arr;
return $this;
} | php | public function setParameters($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dataproc\V1\TemplateParameter::class);
$this->parameters = $arr;
return $this;
} | [
"public",
"function",
"setParameters",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dataproc",
"\\",
"V1",
"\\",
"TemplateParameter",
"::",
"class",
")",
";",
"$",
"this",
"->",
"parameters",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | Optional. Template parameters whose values are substituted into the
template. Values for parameters must be provided when the template is
instantiated.
Generated from protobuf field <code>repeated .google.cloud.dataproc.v1.TemplateParameter parameters = 9;</code>
@param \Google\Cloud\Dataproc\V1\TemplateParameter[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"Optional",
".",
"Template",
"parameters",
"whose",
"values",
"are",
"substituted",
"into",
"the",
"template",
".",
"Values",
"for",
"parameters",
"must",
"be",
"provided",
"when",
"the",
"template",
"is",
"instantiated",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dataproc/src/V1/WorkflowTemplate.php#L418-L424 | train |
googleapis/google-cloud-php | Datastore/src/V1/RunQueryRequest.php | RunQueryRequest.setPartitionId | public function setPartitionId($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Datastore\V1\PartitionId::class);
$this->partition_id = $var;
return $this;
} | php | public function setPartitionId($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Datastore\V1\PartitionId::class);
$this->partition_id = $var;
return $this;
} | [
"public",
"function",
"setPartitionId",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Datastore",
"\\",
"V1",
"\\",
"PartitionId",
"::",
"class",
")",
";",
"$",
"this",
"->",
"partition_id",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Entities are partitioned into subsets, identified by a partition ID.
Queries are scoped to a single partition.
This partition ID is normalized with the standard default context
partition ID.
Generated from protobuf field <code>.google.datastore.v1.PartitionId partition_id = 2;</code>
@param \Google\Cloud\Datastore\V1\PartitionId $var
@return $this | [
"Entities",
"are",
"partitioned",
"into",
"subsets",
"identified",
"by",
"a",
"partition",
"ID",
".",
"Queries",
"are",
"scoped",
"to",
"a",
"single",
"partition",
".",
"This",
"partition",
"ID",
"is",
"normalized",
"with",
"the",
"standard",
"default",
"context",
"partition",
"ID",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Datastore/src/V1/RunQueryRequest.php#L117-L123 | train |
googleapis/google-cloud-php | Datastore/src/V1/RunQueryRequest.php | RunQueryRequest.setReadOptions | public function setReadOptions($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Datastore\V1\ReadOptions::class);
$this->read_options = $var;
return $this;
} | php | public function setReadOptions($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Datastore\V1\ReadOptions::class);
$this->read_options = $var;
return $this;
} | [
"public",
"function",
"setReadOptions",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Datastore",
"\\",
"V1",
"\\",
"ReadOptions",
"::",
"class",
")",
";",
"$",
"this",
"->",
"read_options",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | The options for this query.
Generated from protobuf field <code>.google.datastore.v1.ReadOptions read_options = 1;</code>
@param \Google\Cloud\Datastore\V1\ReadOptions $var
@return $this | [
"The",
"options",
"for",
"this",
"query",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Datastore/src/V1/RunQueryRequest.php#L143-L149 | train |
googleapis/google-cloud-php | Datastore/src/V1/RunQueryRequest.php | RunQueryRequest.setQuery | public function setQuery($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Datastore\V1\Query::class);
$this->writeOneof(3, $var);
return $this;
} | php | public function setQuery($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Datastore\V1\Query::class);
$this->writeOneof(3, $var);
return $this;
} | [
"public",
"function",
"setQuery",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Datastore",
"\\",
"V1",
"\\",
"Query",
"::",
"class",
")",
";",
"$",
"this",
"->",
"writeOneof",
"(",
"3",
",",
"$",
"var",
")",
";",
"return",
"$",
"this",
";",
"}"
] | The query to run.
Generated from protobuf field <code>.google.datastore.v1.Query query = 3;</code>
@param \Google\Cloud\Datastore\V1\Query $var
@return $this | [
"The",
"query",
"to",
"run",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Datastore/src/V1/RunQueryRequest.php#L169-L175 | train |
googleapis/google-cloud-php | Datastore/src/V1/RunQueryRequest.php | RunQueryRequest.setGqlQuery | public function setGqlQuery($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Datastore\V1\GqlQuery::class);
$this->writeOneof(7, $var);
return $this;
} | php | public function setGqlQuery($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Datastore\V1\GqlQuery::class);
$this->writeOneof(7, $var);
return $this;
} | [
"public",
"function",
"setGqlQuery",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Datastore",
"\\",
"V1",
"\\",
"GqlQuery",
"::",
"class",
")",
";",
"$",
"this",
"->",
"writeOneof",
"(",
"7",
",",
"$",
"var",
")",
";",
"return",
"$",
"this",
";",
"}"
] | The GQL query to run.
Generated from protobuf field <code>.google.datastore.v1.GqlQuery gql_query = 7;</code>
@param \Google\Cloud\Datastore\V1\GqlQuery $var
@return $this | [
"The",
"GQL",
"query",
"to",
"run",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Datastore/src/V1/RunQueryRequest.php#L195-L201 | train |
googleapis/google-cloud-php | PubSub/src/V1/PublishRequest.php | PublishRequest.setMessages | public function setMessages($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\PubSub\V1\PubsubMessage::class);
$this->messages = $arr;
return $this;
} | php | public function setMessages($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\PubSub\V1\PubsubMessage::class);
$this->messages = $arr;
return $this;
} | [
"public",
"function",
"setMessages",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"PubSub",
"\\",
"V1",
"\\",
"PubsubMessage",
"::",
"class",
")",
";",
"$",
"this",
"->",
"messages",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | The messages to publish.
Generated from protobuf field <code>repeated .google.pubsub.v1.PubsubMessage messages = 2;</code>
@param \Google\Cloud\PubSub\V1\PubsubMessage[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"The",
"messages",
"to",
"publish",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/PubSub/src/V1/PublishRequest.php#L96-L102 | train |
googleapis/google-cloud-php | dev/src/GetComponentsTrait.php | GetComponentsTrait.getComponentManifest | private function getComponentManifest($manifestPath, $componentId)
{
$manifest = $this->getManifest($manifestPath);
$index = $this->getManifestComponentModuleIndex($manifest, $componentId);
return $manifest['modules'][$index];
} | php | private function getComponentManifest($manifestPath, $componentId)
{
$manifest = $this->getManifest($manifestPath);
$index = $this->getManifestComponentModuleIndex($manifest, $componentId);
return $manifest['modules'][$index];
} | [
"private",
"function",
"getComponentManifest",
"(",
"$",
"manifestPath",
",",
"$",
"componentId",
")",
"{",
"$",
"manifest",
"=",
"$",
"this",
"->",
"getManifest",
"(",
"$",
"manifestPath",
")",
";",
"$",
"index",
"=",
"$",
"this",
"->",
"getManifestComponentModuleIndex",
"(",
"$",
"manifest",
",",
"$",
"componentId",
")",
";",
"return",
"$",
"manifest",
"[",
"'modules'",
"]",
"[",
"$",
"index",
"]",
";",
"}"
] | Return manifest data for the given component.
@param string $manifestPath The path to the manifest.
@param string $componentId The component ID to fetch.
@return array | [
"Return",
"manifest",
"data",
"for",
"the",
"given",
"component",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/dev/src/GetComponentsTrait.php#L88-L94 | train |
googleapis/google-cloud-php | dev/src/GetComponentsTrait.php | GetComponentsTrait.getManifestComponentModuleIndex | private function getManifestComponentModuleIndex($manifest, $componentId)
{
$manifest = is_array($manifest)
? $manifest
: $this->getManifest($manifest);
$modules = array_filter($manifest['modules'], function ($module) use ($componentId) {
return ($module['id'] === $componentId);
});
return array_keys($modules)[0];
} | php | private function getManifestComponentModuleIndex($manifest, $componentId)
{
$manifest = is_array($manifest)
? $manifest
: $this->getManifest($manifest);
$modules = array_filter($manifest['modules'], function ($module) use ($componentId) {
return ($module['id'] === $componentId);
});
return array_keys($modules)[0];
} | [
"private",
"function",
"getManifestComponentModuleIndex",
"(",
"$",
"manifest",
",",
"$",
"componentId",
")",
"{",
"$",
"manifest",
"=",
"is_array",
"(",
"$",
"manifest",
")",
"?",
"$",
"manifest",
":",
"$",
"this",
"->",
"getManifest",
"(",
"$",
"manifest",
")",
";",
"$",
"modules",
"=",
"array_filter",
"(",
"$",
"manifest",
"[",
"'modules'",
"]",
",",
"function",
"(",
"$",
"module",
")",
"use",
"(",
"$",
"componentId",
")",
"{",
"return",
"(",
"$",
"module",
"[",
"'id'",
"]",
"===",
"$",
"componentId",
")",
";",
"}",
")",
";",
"return",
"array_keys",
"(",
"$",
"modules",
")",
"[",
"0",
"]",
";",
"}"
] | Get the manifest component index.
@param string|array $manifest If a string, the path to the manifest. If
an array, the manifest contents.
@param string $componentId The component ID to fetch
@return int | [
"Get",
"the",
"manifest",
"component",
"index",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/dev/src/GetComponentsTrait.php#L104-L115 | train |
googleapis/google-cloud-php | dev/src/GetComponentsTrait.php | GetComponentsTrait.getManifest | private function getManifest($manifestPath)
{
if (self::$__manifest) {
$manifest = self::$__manifest;
} else {
$manifest = json_decode(file_get_contents($manifestPath), true);
if (json_last_error() !== JSON_ERROR_NONE) {
throw new \RuntimeException('Could not decode manifest json');
}
self::$__manifest = $manifest;
}
return $manifest;
} | php | private function getManifest($manifestPath)
{
if (self::$__manifest) {
$manifest = self::$__manifest;
} else {
$manifest = json_decode(file_get_contents($manifestPath), true);
if (json_last_error() !== JSON_ERROR_NONE) {
throw new \RuntimeException('Could not decode manifest json');
}
self::$__manifest = $manifest;
}
return $manifest;
} | [
"private",
"function",
"getManifest",
"(",
"$",
"manifestPath",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"__manifest",
")",
"{",
"$",
"manifest",
"=",
"self",
"::",
"$",
"__manifest",
";",
"}",
"else",
"{",
"$",
"manifest",
"=",
"json_decode",
"(",
"file_get_contents",
"(",
"$",
"manifestPath",
")",
",",
"true",
")",
";",
"if",
"(",
"json_last_error",
"(",
")",
"!==",
"JSON_ERROR_NONE",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'Could not decode manifest json'",
")",
";",
"}",
"self",
"::",
"$",
"__manifest",
"=",
"$",
"manifest",
";",
"}",
"return",
"$",
"manifest",
";",
"}"
] | Read the given file as a package manifest.
@param string $manifestPath
@return array | [
"Read",
"the",
"given",
"file",
"as",
"a",
"package",
"manifest",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/dev/src/GetComponentsTrait.php#L123-L138 | train |
googleapis/google-cloud-php | dev/src/GetComponentsTrait.php | GetComponentsTrait.getComponentComposer | private function getComponentComposer($libraryRootPath, $componentId, $defaultComposerPath = null)
{
if (!$defaultComposerPath) {
$defaultComposerPath = isset($this->defaultComponentComposer)
? $this->defaultComponentComposer
: null;
}
$componentsDir = isset($this->components)
? $this->components
: $libraryRootPath;
$components = $this->getComponents($libraryRootPath, $componentsDir, $defaultComposerPath);
$components = array_values(array_filter($components, function ($component) use ($componentId) {
return ($component['id'] === $componentId);
}));
if (count($components) === 0) {
throw new \InvalidArgumentException(sprintf(
'Given component id %s is not a valid component.',
$componentId
));
}
return $components[0];
} | php | private function getComponentComposer($libraryRootPath, $componentId, $defaultComposerPath = null)
{
if (!$defaultComposerPath) {
$defaultComposerPath = isset($this->defaultComponentComposer)
? $this->defaultComponentComposer
: null;
}
$componentsDir = isset($this->components)
? $this->components
: $libraryRootPath;
$components = $this->getComponents($libraryRootPath, $componentsDir, $defaultComposerPath);
$components = array_values(array_filter($components, function ($component) use ($componentId) {
return ($component['id'] === $componentId);
}));
if (count($components) === 0) {
throw new \InvalidArgumentException(sprintf(
'Given component id %s is not a valid component.',
$componentId
));
}
return $components[0];
} | [
"private",
"function",
"getComponentComposer",
"(",
"$",
"libraryRootPath",
",",
"$",
"componentId",
",",
"$",
"defaultComposerPath",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"defaultComposerPath",
")",
"{",
"$",
"defaultComposerPath",
"=",
"isset",
"(",
"$",
"this",
"->",
"defaultComponentComposer",
")",
"?",
"$",
"this",
"->",
"defaultComponentComposer",
":",
"null",
";",
"}",
"$",
"componentsDir",
"=",
"isset",
"(",
"$",
"this",
"->",
"components",
")",
"?",
"$",
"this",
"->",
"components",
":",
"$",
"libraryRootPath",
";",
"$",
"components",
"=",
"$",
"this",
"->",
"getComponents",
"(",
"$",
"libraryRootPath",
",",
"$",
"componentsDir",
",",
"$",
"defaultComposerPath",
")",
";",
"$",
"components",
"=",
"array_values",
"(",
"array_filter",
"(",
"$",
"components",
",",
"function",
"(",
"$",
"component",
")",
"use",
"(",
"$",
"componentId",
")",
"{",
"return",
"(",
"$",
"component",
"[",
"'id'",
"]",
"===",
"$",
"componentId",
")",
";",
"}",
")",
")",
";",
"if",
"(",
"count",
"(",
"$",
"components",
")",
"===",
"0",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'Given component id %s is not a valid component.'",
",",
"$",
"componentId",
")",
")",
";",
"}",
"return",
"$",
"components",
"[",
"0",
"]",
";",
"}"
] | Get the composer.json data for a given component.
@param string $componentId
@return array | [
"Get",
"the",
"composer",
".",
"json",
"data",
"for",
"a",
"given",
"component",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/dev/src/GetComponentsTrait.php#L151-L177 | train |
googleapis/google-cloud-php | Vision/src/V1/ImageProperties.php | ImageProperties.setDominantColors | public function setDominantColors($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\DominantColorsAnnotation::class);
$this->dominant_colors = $var;
return $this;
} | php | public function setDominantColors($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\DominantColorsAnnotation::class);
$this->dominant_colors = $var;
return $this;
} | [
"public",
"function",
"setDominantColors",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Vision",
"\\",
"V1",
"\\",
"DominantColorsAnnotation",
"::",
"class",
")",
";",
"$",
"this",
"->",
"dominant_colors",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | If present, dominant colors completed successfully.
Generated from protobuf field <code>.google.cloud.vision.v1.DominantColorsAnnotation dominant_colors = 1;</code>
@param \Google\Cloud\Vision\V1\DominantColorsAnnotation $var
@return $this | [
"If",
"present",
"dominant",
"colors",
"completed",
"successfully",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Vision/src/V1/ImageProperties.php#L58-L64 | train |
googleapis/google-cloud-php | dev/src/ComponentManager.php | ComponentManager.componentsExtra | public function componentsExtra($componentId = null)
{
$components = $this->components ?: $this->loadComponents();
array_walk($components, function (&$component) {
$name = $component['composer']['name'];
$component = $component['composer']['extra']['component'];
$component['displayName'] = $name;
});
return $componentId
? [$componentId => $components[$componentId]]
: $components;
} | php | public function componentsExtra($componentId = null)
{
$components = $this->components ?: $this->loadComponents();
array_walk($components, function (&$component) {
$name = $component['composer']['name'];
$component = $component['composer']['extra']['component'];
$component['displayName'] = $name;
});
return $componentId
? [$componentId => $components[$componentId]]
: $components;
} | [
"public",
"function",
"componentsExtra",
"(",
"$",
"componentId",
"=",
"null",
")",
"{",
"$",
"components",
"=",
"$",
"this",
"->",
"components",
"?",
":",
"$",
"this",
"->",
"loadComponents",
"(",
")",
";",
"array_walk",
"(",
"$",
"components",
",",
"function",
"(",
"&",
"$",
"component",
")",
"{",
"$",
"name",
"=",
"$",
"component",
"[",
"'composer'",
"]",
"[",
"'name'",
"]",
";",
"$",
"component",
"=",
"$",
"component",
"[",
"'composer'",
"]",
"[",
"'extra'",
"]",
"[",
"'component'",
"]",
";",
"$",
"component",
"[",
"'displayName'",
"]",
"=",
"$",
"name",
";",
"}",
")",
";",
"return",
"$",
"componentId",
"?",
"[",
"$",
"componentId",
"=>",
"$",
"components",
"[",
"$",
"componentId",
"]",
"]",
":",
"$",
"components",
";",
"}"
] | Get all component's composer.json extra data.
@param string $componentId [optional] If set, only this component's data
will be returned.
@return array[] | [
"Get",
"all",
"component",
"s",
"composer",
".",
"json",
"extra",
"data",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/dev/src/ComponentManager.php#L80-L93 | train |
googleapis/google-cloud-php | dev/src/ComponentManager.php | ComponentManager.componentsManifest | public function componentsManifest($componentId = null)
{
$manifest = $this->manifest ?: $this->loadManifest;
$modules = $manifest['modules'];
if ($componentId) {
$modules = array_filter($modules, function ($module) use ($componentId) {
return $module['id'] === $componentId;
});
}
return $modules;
} | php | public function componentsManifest($componentId = null)
{
$manifest = $this->manifest ?: $this->loadManifest;
$modules = $manifest['modules'];
if ($componentId) {
$modules = array_filter($modules, function ($module) use ($componentId) {
return $module['id'] === $componentId;
});
}
return $modules;
} | [
"public",
"function",
"componentsManifest",
"(",
"$",
"componentId",
"=",
"null",
")",
"{",
"$",
"manifest",
"=",
"$",
"this",
"->",
"manifest",
"?",
":",
"$",
"this",
"->",
"loadManifest",
";",
"$",
"modules",
"=",
"$",
"manifest",
"[",
"'modules'",
"]",
";",
"if",
"(",
"$",
"componentId",
")",
"{",
"$",
"modules",
"=",
"array_filter",
"(",
"$",
"modules",
",",
"function",
"(",
"$",
"module",
")",
"use",
"(",
"$",
"componentId",
")",
"{",
"return",
"$",
"module",
"[",
"'id'",
"]",
"===",
"$",
"componentId",
";",
"}",
")",
";",
"}",
"return",
"$",
"modules",
";",
"}"
] | Get all component's manifest.json data.
@param string $componentId [optional] If set, only this component's data
will be returned.
@return array[] | [
"Get",
"all",
"component",
"s",
"manifest",
".",
"json",
"data",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/dev/src/ComponentManager.php#L102-L114 | train |
googleapis/google-cloud-php | dev/src/ComponentManager.php | ComponentManager.componentsVersion | public function componentsVersion($componentId = null)
{
$components = $this->components ?: $this->loadComponents();
array_walk($components, function (&$component) {
$component = $component['version'];
});
return $componentId
? [$componentId => $components[$componentId]]
: $components;
} | php | public function componentsVersion($componentId = null)
{
$components = $this->components ?: $this->loadComponents();
array_walk($components, function (&$component) {
$component = $component['version'];
});
return $componentId
? [$componentId => $components[$componentId]]
: $components;
} | [
"public",
"function",
"componentsVersion",
"(",
"$",
"componentId",
"=",
"null",
")",
"{",
"$",
"components",
"=",
"$",
"this",
"->",
"components",
"?",
":",
"$",
"this",
"->",
"loadComponents",
"(",
")",
";",
"array_walk",
"(",
"$",
"components",
",",
"function",
"(",
"&",
"$",
"component",
")",
"{",
"$",
"component",
"=",
"$",
"component",
"[",
"'version'",
"]",
";",
"}",
")",
";",
"return",
"$",
"componentId",
"?",
"[",
"$",
"componentId",
"=>",
"$",
"components",
"[",
"$",
"componentId",
"]",
"]",
":",
"$",
"components",
";",
"}"
] | Get the latest version of each component.
@param string $componentId [optional] If set, only this component's data
will be returned.
@return string[] | [
"Get",
"the",
"latest",
"version",
"of",
"each",
"component",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/dev/src/ComponentManager.php#L123-L134 | train |
googleapis/google-cloud-php | Bigtable/src/Mutations.php | Mutations.deleteFromFamily | public function deleteFromFamily($family)
{
$this->mutations[] = (new Mutation)
->setDeleteFromFamily(
(new DeleteFromFamily)->setFamilyName($family)
);
return $this;
} | php | public function deleteFromFamily($family)
{
$this->mutations[] = (new Mutation)
->setDeleteFromFamily(
(new DeleteFromFamily)->setFamilyName($family)
);
return $this;
} | [
"public",
"function",
"deleteFromFamily",
"(",
"$",
"family",
")",
"{",
"$",
"this",
"->",
"mutations",
"[",
"]",
"=",
"(",
"new",
"Mutation",
")",
"->",
"setDeleteFromFamily",
"(",
"(",
"new",
"DeleteFromFamily",
")",
"->",
"setFamilyName",
"(",
"$",
"family",
")",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Creates delete from family mutation for a row.
@param string $family Family name of the row.
@return Mutations returns current Mutations object. | [
"Creates",
"delete",
"from",
"family",
"mutation",
"for",
"a",
"row",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Bigtable/src/Mutations.php#L77-L84 | train |
googleapis/google-cloud-php | Bigtable/src/Mutations.php | Mutations.deleteFromColumn | public function deleteFromColumn($family, $qualifier, array $timeRange = [])
{
$deleteFromColumn = (new DeleteFromColumn)
->setFamilyName($family)
->setColumnQualifier($qualifier);
if (!empty($timeRange)) {
$timestampRange = new TimestampRange;
if (isset($timeRange['start'])) {
$timestampRange->setStartTimestampMicros($timeRange['start']);
}
if (isset($timeRange['end'])) {
$timestampRange->setEndTimestampMicros($timeRange['end']);
}
$deleteFromColumn->setTimeRange($timestampRange);
}
$this->mutations[] = (new Mutation)->setDeleteFromColumn($deleteFromColumn);
return $this;
} | php | public function deleteFromColumn($family, $qualifier, array $timeRange = [])
{
$deleteFromColumn = (new DeleteFromColumn)
->setFamilyName($family)
->setColumnQualifier($qualifier);
if (!empty($timeRange)) {
$timestampRange = new TimestampRange;
if (isset($timeRange['start'])) {
$timestampRange->setStartTimestampMicros($timeRange['start']);
}
if (isset($timeRange['end'])) {
$timestampRange->setEndTimestampMicros($timeRange['end']);
}
$deleteFromColumn->setTimeRange($timestampRange);
}
$this->mutations[] = (new Mutation)->setDeleteFromColumn($deleteFromColumn);
return $this;
} | [
"public",
"function",
"deleteFromColumn",
"(",
"$",
"family",
",",
"$",
"qualifier",
",",
"array",
"$",
"timeRange",
"=",
"[",
"]",
")",
"{",
"$",
"deleteFromColumn",
"=",
"(",
"new",
"DeleteFromColumn",
")",
"->",
"setFamilyName",
"(",
"$",
"family",
")",
"->",
"setColumnQualifier",
"(",
"$",
"qualifier",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"timeRange",
")",
")",
"{",
"$",
"timestampRange",
"=",
"new",
"TimestampRange",
";",
"if",
"(",
"isset",
"(",
"$",
"timeRange",
"[",
"'start'",
"]",
")",
")",
"{",
"$",
"timestampRange",
"->",
"setStartTimestampMicros",
"(",
"$",
"timeRange",
"[",
"'start'",
"]",
")",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"timeRange",
"[",
"'end'",
"]",
")",
")",
"{",
"$",
"timestampRange",
"->",
"setEndTimestampMicros",
"(",
"$",
"timeRange",
"[",
"'end'",
"]",
")",
";",
"}",
"$",
"deleteFromColumn",
"->",
"setTimeRange",
"(",
"$",
"timestampRange",
")",
";",
"}",
"$",
"this",
"->",
"mutations",
"[",
"]",
"=",
"(",
"new",
"Mutation",
")",
"->",
"setDeleteFromColumn",
"(",
"$",
"deleteFromColumn",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Creates delete from column mutation for a row.
@param string $family Family name of the row.
@param string $qualifier Column qualifier of the row.
@param array $timeRange [optional] Array of values value, in microseconds to
delete from column, keyed by `start` and `end` representing time range
window.
`start` **Defaults to** 0
`end` **Defaults to** infinity
@return Mutations returns current Mutations object. | [
"Creates",
"delete",
"from",
"column",
"mutation",
"for",
"a",
"row",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Bigtable/src/Mutations.php#L98-L115 | train |
googleapis/google-cloud-php | Dlp/src/V2/DatastoreOptions.php | DatastoreOptions.setPartitionId | public function setPartitionId($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\PartitionId::class);
$this->partition_id = $var;
return $this;
} | php | public function setPartitionId($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\PartitionId::class);
$this->partition_id = $var;
return $this;
} | [
"public",
"function",
"setPartitionId",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dlp",
"\\",
"V2",
"\\",
"PartitionId",
"::",
"class",
")",
";",
"$",
"this",
"->",
"partition_id",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | A partition ID identifies a grouping of entities. The grouping is always
by project and namespace, however the namespace ID may be empty.
Generated from protobuf field <code>.google.privacy.dlp.v2.PartitionId partition_id = 1;</code>
@param \Google\Cloud\Dlp\V2\PartitionId $var
@return $this | [
"A",
"partition",
"ID",
"identifies",
"a",
"grouping",
"of",
"entities",
".",
"The",
"grouping",
"is",
"always",
"by",
"project",
"and",
"namespace",
"however",
"the",
"namespace",
"ID",
"may",
"be",
"empty",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/DatastoreOptions.php#L70-L76 | train |
googleapis/google-cloud-php | Dlp/src/V2/DatastoreOptions.php | DatastoreOptions.setKind | public function setKind($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\KindExpression::class);
$this->kind = $var;
return $this;
} | php | public function setKind($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\KindExpression::class);
$this->kind = $var;
return $this;
} | [
"public",
"function",
"setKind",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dlp",
"\\",
"V2",
"\\",
"KindExpression",
"::",
"class",
")",
";",
"$",
"this",
"->",
"kind",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | The kind to process.
Generated from protobuf field <code>.google.privacy.dlp.v2.KindExpression kind = 2;</code>
@param \Google\Cloud\Dlp\V2\KindExpression $var
@return $this | [
"The",
"kind",
"to",
"process",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/DatastoreOptions.php#L96-L102 | train |
googleapis/google-cloud-php | Storage/src/StorageObject.php | StorageObject.exists | public function exists(array $options = [])
{
try {
$this->connection->getObject($this->identity + $options + ['fields' => 'name']);
} catch (NotFoundException $ex) {
return false;
}
return true;
} | php | public function exists(array $options = [])
{
try {
$this->connection->getObject($this->identity + $options + ['fields' => 'name']);
} catch (NotFoundException $ex) {
return false;
}
return true;
} | [
"public",
"function",
"exists",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"connection",
"->",
"getObject",
"(",
"$",
"this",
"->",
"identity",
"+",
"$",
"options",
"+",
"[",
"'fields'",
"=>",
"'name'",
"]",
")",
";",
"}",
"catch",
"(",
"NotFoundException",
"$",
"ex",
")",
"{",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] | Check whether or not the object exists.
Example:
```
if ($object->exists()) {
echo 'Object exists!';
}
```
@param array $options [optional] Configuration options.
@return bool | [
"Check",
"whether",
"or",
"not",
"the",
"object",
"exists",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Storage/src/StorageObject.php#L144-L153 | train |
googleapis/google-cloud-php | Storage/src/StorageObject.php | StorageObject.update | public function update(array $metadata, array $options = [])
{
$options += $metadata;
// can only set predefinedAcl or acl
if (isset($options['predefinedAcl'])) {
$options['acl'] = null;
}
return $this->info = $this->connection->patchObject($options + array_filter($this->identity));
} | php | public function update(array $metadata, array $options = [])
{
$options += $metadata;
// can only set predefinedAcl or acl
if (isset($options['predefinedAcl'])) {
$options['acl'] = null;
}
return $this->info = $this->connection->patchObject($options + array_filter($this->identity));
} | [
"public",
"function",
"update",
"(",
"array",
"$",
"metadata",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"+=",
"$",
"metadata",
";",
"// can only set predefinedAcl or acl",
"if",
"(",
"isset",
"(",
"$",
"options",
"[",
"'predefinedAcl'",
"]",
")",
")",
"{",
"$",
"options",
"[",
"'acl'",
"]",
"=",
"null",
";",
"}",
"return",
"$",
"this",
"->",
"info",
"=",
"$",
"this",
"->",
"connection",
"->",
"patchObject",
"(",
"$",
"options",
"+",
"array_filter",
"(",
"$",
"this",
"->",
"identity",
")",
")",
";",
"}"
] | Update the object. Upon receiving a result the local object's data will
be updated.
Example:
```
// Add custom metadata to an existing object.
$object->update([
'metadata' => [
'albumType' => 'family'
]
]);
```
@see https://cloud.google.com/storage/docs/json_api/v1/objects/patch Objects patch API documentation.
@param array $metadata The available options for metadata are outlined
at the [JSON API docs](https://cloud.google.com/storage/docs/json_api/v1/objects#resource)
@param array $options [optional] {
Configuration options.
@type string $ifGenerationMatch Makes the operation conditional on
whether the object's current generation matches the given
value.
@type string $ifGenerationNotMatch Makes the operation conditional on
whether the object's current generation does not match the
given value.
@type string $ifMetagenerationMatch Makes the operation conditional
on whether the object's current metageneration matches the
given value.
@type string $ifMetagenerationNotMatch Makes the operation
conditional on whether the object's current metageneration does
not match the given value.
@type string $predefinedAcl Predefined ACL to apply to the object.
Acceptable values include, `"authenticatedRead"`,
`"bucketOwnerFullControl"`, `"bucketOwnerRead"`, `"private"`,
`"projectPrivate"`, and `"publicRead"`.
@type string $projection Determines which properties to return. May
be either 'full' or 'noAcl'.
@type string $fields Selector which will cause the response to only
return the specified fields.
}
@return array | [
"Update",
"the",
"object",
".",
"Upon",
"receiving",
"a",
"result",
"the",
"local",
"object",
"s",
"data",
"will",
"be",
"updated",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Storage/src/StorageObject.php#L232-L242 | train |
googleapis/google-cloud-php | Storage/src/StorageObject.php | StorageObject.copy | public function copy($destination, array $options = [])
{
$key = isset($options['encryptionKey']) ? $options['encryptionKey'] : null;
$keySHA256 = isset($options['encryptionKeySHA256']) ? $options['encryptionKeySHA256'] : null;
$response = $this->connection->copyObject(
$this->formatDestinationRequest($destination, $options)
);
return new StorageObject(
$this->connection,
$response['name'],
$response['bucket'],
$response['generation'],
$response + ['requesterProjectId' => $this->identity['userProject']],
$key,
$keySHA256
);
} | php | public function copy($destination, array $options = [])
{
$key = isset($options['encryptionKey']) ? $options['encryptionKey'] : null;
$keySHA256 = isset($options['encryptionKeySHA256']) ? $options['encryptionKeySHA256'] : null;
$response = $this->connection->copyObject(
$this->formatDestinationRequest($destination, $options)
);
return new StorageObject(
$this->connection,
$response['name'],
$response['bucket'],
$response['generation'],
$response + ['requesterProjectId' => $this->identity['userProject']],
$key,
$keySHA256
);
} | [
"public",
"function",
"copy",
"(",
"$",
"destination",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"key",
"=",
"isset",
"(",
"$",
"options",
"[",
"'encryptionKey'",
"]",
")",
"?",
"$",
"options",
"[",
"'encryptionKey'",
"]",
":",
"null",
";",
"$",
"keySHA256",
"=",
"isset",
"(",
"$",
"options",
"[",
"'encryptionKeySHA256'",
"]",
")",
"?",
"$",
"options",
"[",
"'encryptionKeySHA256'",
"]",
":",
"null",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"connection",
"->",
"copyObject",
"(",
"$",
"this",
"->",
"formatDestinationRequest",
"(",
"$",
"destination",
",",
"$",
"options",
")",
")",
";",
"return",
"new",
"StorageObject",
"(",
"$",
"this",
"->",
"connection",
",",
"$",
"response",
"[",
"'name'",
"]",
",",
"$",
"response",
"[",
"'bucket'",
"]",
",",
"$",
"response",
"[",
"'generation'",
"]",
",",
"$",
"response",
"+",
"[",
"'requesterProjectId'",
"=>",
"$",
"this",
"->",
"identity",
"[",
"'userProject'",
"]",
"]",
",",
"$",
"key",
",",
"$",
"keySHA256",
")",
";",
"}"
] | Copy the object to a destination bucket.
Please note that if the destination bucket is the same as the source
bucket and a new name is not provided the source object will be replaced
with the copy of itself.
Example:
```
// Provide your destination bucket as a string and retain the source
// object's name.
$copiedObject = $object->copy('otherBucket');
```
```
// Provide your destination bucket as a bucket object and choose a new
// name for the copied object.
$otherBucket = $storage->bucket('otherBucket');
$copiedObject = $object->copy($otherBucket, [
'name' => 'newFile.txt'
]);
```
@see https://cloud.google.com/storage/docs/json_api/v1/objects/copy Objects copy API documentation.
@param Bucket|string $destination The destination bucket.
@param array $options [optional] {
Configuration options.
@type string $name The name of the destination object. **Defaults
to** the name of the source object.
@type string $predefinedAcl Predefined ACL to apply to the object.
Acceptable values include, `"authenticatedRead"`,
`"bucketOwnerFullControl"`, `"bucketOwnerRead"`, `"private"`,
`"projectPrivate"`, and `"publicRead"`.
@type string $encryptionKey A base64 encoded AES-256 customer-supplied
encryption key. It will be neccesary to provide this when a key
was used during the object's creation.
@type string $encryptionKeySHA256 Base64 encoded SHA256 hash of the
customer-supplied encryption key. This value will be calculated
from the `encryptionKey` on your behalf if not provided, but
for best performance it is recommended to pass in a cached
version of the already calculated SHA.
@type string $ifGenerationMatch Makes the operation conditional on
whether the destination object's current generation matches the
given value.
@type string $ifGenerationNotMatch Makes the operation conditional on
whether the destination object's current generation does not
match the given value.
@type string $ifMetagenerationMatch Makes the operation conditional
on whether the destination object's current metageneration
matches the given value.
@type string $ifMetagenerationNotMatch Makes the operation
conditional on whether the destination object's current
metageneration does not match the given value.
@type string $ifSourceGenerationMatch Makes the operation conditional
on whether the source object's current generation matches the
given value.
@type string $ifSourceGenerationNotMatch Makes the operation
conditional on whether the source object's current generation
does not match the given value.
@type string $ifSourceMetagenerationMatch Makes the operation
conditional on whether the source object's current
metageneration matches the given value.
@type string $ifSourceMetagenerationNotMatch Makes the operation
conditional on whether the source object's current
metageneration does not match the given value.
}
@return StorageObject | [
"Copy",
"the",
"object",
"to",
"a",
"destination",
"bucket",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Storage/src/StorageObject.php#L314-L332 | train |
googleapis/google-cloud-php | Storage/src/StorageObject.php | StorageObject.rewrite | public function rewrite($destination, array $options = [])
{
$options['useCopySourceHeaders'] = true;
$destinationKey = isset($options['destinationEncryptionKey']) ? $options['destinationEncryptionKey'] : null;
$destinationKeySHA256 = isset($options['destinationEncryptionKeySHA256'])
? $options['destinationEncryptionKeySHA256']
: null;
$options = $this->formatDestinationRequest($destination, $options);
do {
$response = $this->connection->rewriteObject($options);
$options['rewriteToken'] = isset($response['rewriteToken']) ? $response['rewriteToken'] : null;
} while ($options['rewriteToken']);
return new StorageObject(
$this->connection,
$response['resource']['name'],
$response['resource']['bucket'],
$response['resource']['generation'],
$response['resource'] + ['requesterProjectId' => $this->identity['userProject']],
$destinationKey,
$destinationKeySHA256
);
} | php | public function rewrite($destination, array $options = [])
{
$options['useCopySourceHeaders'] = true;
$destinationKey = isset($options['destinationEncryptionKey']) ? $options['destinationEncryptionKey'] : null;
$destinationKeySHA256 = isset($options['destinationEncryptionKeySHA256'])
? $options['destinationEncryptionKeySHA256']
: null;
$options = $this->formatDestinationRequest($destination, $options);
do {
$response = $this->connection->rewriteObject($options);
$options['rewriteToken'] = isset($response['rewriteToken']) ? $response['rewriteToken'] : null;
} while ($options['rewriteToken']);
return new StorageObject(
$this->connection,
$response['resource']['name'],
$response['resource']['bucket'],
$response['resource']['generation'],
$response['resource'] + ['requesterProjectId' => $this->identity['userProject']],
$destinationKey,
$destinationKeySHA256
);
} | [
"public",
"function",
"rewrite",
"(",
"$",
"destination",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"[",
"'useCopySourceHeaders'",
"]",
"=",
"true",
";",
"$",
"destinationKey",
"=",
"isset",
"(",
"$",
"options",
"[",
"'destinationEncryptionKey'",
"]",
")",
"?",
"$",
"options",
"[",
"'destinationEncryptionKey'",
"]",
":",
"null",
";",
"$",
"destinationKeySHA256",
"=",
"isset",
"(",
"$",
"options",
"[",
"'destinationEncryptionKeySHA256'",
"]",
")",
"?",
"$",
"options",
"[",
"'destinationEncryptionKeySHA256'",
"]",
":",
"null",
";",
"$",
"options",
"=",
"$",
"this",
"->",
"formatDestinationRequest",
"(",
"$",
"destination",
",",
"$",
"options",
")",
";",
"do",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"connection",
"->",
"rewriteObject",
"(",
"$",
"options",
")",
";",
"$",
"options",
"[",
"'rewriteToken'",
"]",
"=",
"isset",
"(",
"$",
"response",
"[",
"'rewriteToken'",
"]",
")",
"?",
"$",
"response",
"[",
"'rewriteToken'",
"]",
":",
"null",
";",
"}",
"while",
"(",
"$",
"options",
"[",
"'rewriteToken'",
"]",
")",
";",
"return",
"new",
"StorageObject",
"(",
"$",
"this",
"->",
"connection",
",",
"$",
"response",
"[",
"'resource'",
"]",
"[",
"'name'",
"]",
",",
"$",
"response",
"[",
"'resource'",
"]",
"[",
"'bucket'",
"]",
",",
"$",
"response",
"[",
"'resource'",
"]",
"[",
"'generation'",
"]",
",",
"$",
"response",
"[",
"'resource'",
"]",
"+",
"[",
"'requesterProjectId'",
"=>",
"$",
"this",
"->",
"identity",
"[",
"'userProject'",
"]",
"]",
",",
"$",
"destinationKey",
",",
"$",
"destinationKeySHA256",
")",
";",
"}"
] | Rewrite the object to a destination bucket.
This method copies data using multiple requests so large objects can be
copied with a normal length timeout per request rather than one very long
timeout for a single request.
Please note that if the destination bucket is the same as the source
bucket and a new name is not provided the source object will be replaced
with the copy of itself.
Example:
```
// Provide your destination bucket as a string and retain the source
// object's name.
$rewrittenObject = $object->rewrite('otherBucket');
```
```
// Provide your destination bucket as a bucket object and choose a new
// name for the copied object.
$otherBucket = $storage->bucket('otherBucket');
$rewrittenObject = $object->rewrite($otherBucket, [
'name' => 'newFile.txt'
]);
```
```
// Rotate customer-supplied encryption keys.
$key = file_get_contents(__DIR__ . '/key.txt');
$destinationKey = base64_encode(openssl_random_pseudo_bytes(32)); // Make sure to remember your key.
$rewrittenObject = $object->rewrite('otherBucket', [
'encryptionKey' => $key,
'destinationEncryptionKey' => $destinationKey
]);
```
@see https://cloud.google.com/storage/docs/json_api/v1/objects/rewrite Objects rewrite API documentation.
@see https://cloud.google.com/storage/docs/encryption#customer-supplied Customer-supplied encryption keys.
@param Bucket|string $destination The destination bucket.
@param array $options [optional] {
Configuration options.
@type string $name The name of the destination object. **Defaults
to** the name of the source object.
@type string $predefinedAcl Predefined ACL to apply to the object.
Acceptable values include, `"authenticatedRead"`,
`"bucketOwnerFullControl"`, `"bucketOwnerRead"`, `"private"`,
`"projectPrivate"`, and `"publicRead"`.
@type string $maxBytesRewrittenPerCall The maximum number of bytes
that will be rewritten per rewrite request. Most callers
shouldn't need to specify this parameter - it is primarily in
place to support testing. If specified the value must be an
integral multiple of 1 MiB (1048576). Also, this only applies
to requests where the source and destination span locations
and/or storage classes.
@type string $encryptionKey A base64 encoded AES-256 customer-supplied
encryption key. It will be neccesary to provide this when a key
was used during the object's creation.
@type string $encryptionKeySHA256 Base64 encoded SHA256 hash of the
customer-supplied encryption key. This value will be calculated
from the `encryptionKey` on your behalf if not provided, but
for best performance it is recommended to pass in a cached
version of the already calculated SHA.
@type string $destinationEncryptionKey A base64 encoded AES-256
customer-supplied encryption key that will be used to encrypt
the rewritten object.
@type string $destinationEncryptionKeySHA256 Base64 encoded SHA256
hash of the customer-supplied destination encryption key. This
value will be calculated from the `destinationEncryptionKey` on
your behalf if not provided, but for best performance it is
recommended to pass in a cached version of the already
calculated SHA.
@type string $destinationKmsKeyName Name of the Cloud KMS key that
will be used to encrypt the object. Should be in the format
`projects/my-project/locations/kr-location/keyRings/my-kr/cryptoKeys/my-key`.
Please note the KMS key ring must use the same location as the
destination bucket.
@type string $ifGenerationMatch Makes the operation conditional on
whether the destination object's current generation matches the
given value.
@type string $ifGenerationNotMatch Makes the operation conditional on
whether the destination object's current generation does not
match the given value.
@type string $ifMetagenerationMatch Makes the operation conditional
on whether the destination object's current metageneration
matches the given value.
@type string $ifMetagenerationNotMatch Makes the operation
conditional on whether the destination object's current
metageneration does not match the given value.
@type string $ifSourceGenerationMatch Makes the operation conditional
on whether the source object's current generation matches the
given value.
@type string $ifSourceGenerationNotMatch Makes the operation
conditional on whether the source object's current generation
does not match the given value.
@type string $ifSourceMetagenerationMatch Makes the operation
conditional on whether the source object's current
metageneration matches the given value.
@type string $ifSourceMetagenerationNotMatch Makes the operation
conditional on whether the source object's current
metageneration does not match the given value.
}
@return StorageObject
@throws \InvalidArgumentException | [
"Rewrite",
"the",
"object",
"to",
"a",
"destination",
"bucket",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Storage/src/StorageObject.php#L442-L466 | train |
googleapis/google-cloud-php | Storage/src/StorageObject.php | StorageObject.rename | public function rename($name, array $options = [])
{
$destinationBucket = isset($options['destinationBucket'])
? $options['destinationBucket']
: $this->identity['bucket'];
unset($options['destinationBucket']);
$copiedObject = $this->copy($destinationBucket, [
'name' => $name
] + $options);
$this->delete(
array_intersect_key($options, [
'restOptions' => null,
'retries' => null
])
);
$this->info = [];
return $copiedObject;
} | php | public function rename($name, array $options = [])
{
$destinationBucket = isset($options['destinationBucket'])
? $options['destinationBucket']
: $this->identity['bucket'];
unset($options['destinationBucket']);
$copiedObject = $this->copy($destinationBucket, [
'name' => $name
] + $options);
$this->delete(
array_intersect_key($options, [
'restOptions' => null,
'retries' => null
])
);
$this->info = [];
return $copiedObject;
} | [
"public",
"function",
"rename",
"(",
"$",
"name",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"destinationBucket",
"=",
"isset",
"(",
"$",
"options",
"[",
"'destinationBucket'",
"]",
")",
"?",
"$",
"options",
"[",
"'destinationBucket'",
"]",
":",
"$",
"this",
"->",
"identity",
"[",
"'bucket'",
"]",
";",
"unset",
"(",
"$",
"options",
"[",
"'destinationBucket'",
"]",
")",
";",
"$",
"copiedObject",
"=",
"$",
"this",
"->",
"copy",
"(",
"$",
"destinationBucket",
",",
"[",
"'name'",
"=>",
"$",
"name",
"]",
"+",
"$",
"options",
")",
";",
"$",
"this",
"->",
"delete",
"(",
"array_intersect_key",
"(",
"$",
"options",
",",
"[",
"'restOptions'",
"=>",
"null",
",",
"'retries'",
"=>",
"null",
"]",
")",
")",
";",
"$",
"this",
"->",
"info",
"=",
"[",
"]",
";",
"return",
"$",
"copiedObject",
";",
"}"
] | Renames the object.
Please note that there is no atomic rename provided by the Storage API.
This method is for convenience and is a set of sequential calls to copy
and delete. Upon success the source object's metadata will be cleared,
please use the returned object instead.
Example:
```
$object2 = $object->rename('object2.txt');
echo $object2->name();
```
@param string $name The new name.
@param array $options [optional] {
Configuration options.
@type string $predefinedAcl Predefined ACL to apply to the object.
Acceptable values include, `"authenticatedRead"`,
`"bucketOwnerFullControl"`, `"bucketOwnerRead"`, `"private"`,
`"projectPrivate"`, and `"publicRead"`.
@type string $encryptionKey A base64 encoded AES-256 customer-supplied
encryption key. It will be neccesary to provide this when a key
was used during the object's creation.
@type string $encryptionKeySHA256 Base64 encoded SHA256 hash of the
customer-supplied encryption key. This value will be calculated
from the `encryptionKey` on your behalf if not provided, but
for best performance it is recommended to pass in a cached
version of the already calculated SHA.
@type string $ifGenerationMatch Makes the operation conditional on
whether the destination object's current generation matches the
given value.
@type string $ifGenerationNotMatch Makes the operation conditional on
whether the destination object's current generation does not
match the given value.
@type string $ifMetagenerationMatch Makes the operation conditional
on whether the destination object's current metageneration
matches the given value.
@type string $ifMetagenerationNotMatch Makes the operation
conditional on whether the destination object's current
metageneration does not match the given value.
@type string $ifSourceGenerationMatch Makes the operation conditional
on whether the source object's current generation matches the
given value.
@type string $ifSourceGenerationNotMatch Makes the operation
conditional on whether the source object's current generation
does not match the given value.
@type string $ifSourceMetagenerationMatch Makes the operation
conditional on whether the source object's current
metageneration matches the given value.
@type string $ifSourceMetagenerationNotMatch Makes the operation
conditional on whether the source object's current
metageneration does not match the given value.
@type string $destinationBucket Will move to this bucket if set. If
not set, will default to the same bucket.
}
@return StorageObject The renamed object. | [
"Renames",
"the",
"object",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Storage/src/StorageObject.php#L527-L547 | train |
googleapis/google-cloud-php | Storage/src/StorageObject.php | StorageObject.downloadToFile | public function downloadToFile($path, array $options = [])
{
$destination = Psr7\stream_for(fopen($path, 'w'));
Psr7\copy_to_stream(
$this->downloadAsStream($options),
$destination
);
$destination->seek(0);
return $destination;
} | php | public function downloadToFile($path, array $options = [])
{
$destination = Psr7\stream_for(fopen($path, 'w'));
Psr7\copy_to_stream(
$this->downloadAsStream($options),
$destination
);
$destination->seek(0);
return $destination;
} | [
"public",
"function",
"downloadToFile",
"(",
"$",
"path",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"destination",
"=",
"Psr7",
"\\",
"stream_for",
"(",
"fopen",
"(",
"$",
"path",
",",
"'w'",
")",
")",
";",
"Psr7",
"\\",
"copy_to_stream",
"(",
"$",
"this",
"->",
"downloadAsStream",
"(",
"$",
"options",
")",
",",
"$",
"destination",
")",
";",
"$",
"destination",
"->",
"seek",
"(",
"0",
")",
";",
"return",
"$",
"destination",
";",
"}"
] | Download an object to a specified location.
Example:
```
$stream = $object->downloadToFile(__DIR__ . '/my-file.txt');
```
@param string $path Path to download the file to.
@param array $options [optional] {
Configuration Options.
@type string $encryptionKey An AES-256 customer-supplied encryption
key. It will be neccesary to provide this when a key was used
during the object's creation. If provided one must also include
an `encryptionKeySHA256`.
@type string $encryptionKeySHA256 The SHA256 hash of the
customer-supplied encryption key. It will be neccesary to
provide this when a key was used during the object's creation.
If provided one must also include an `encryptionKey`.
}
@return StreamInterface | [
"Download",
"an",
"object",
"to",
"a",
"specified",
"location",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Storage/src/StorageObject.php#L600-L612 | train |
googleapis/google-cloud-php | Storage/src/StorageObject.php | StorageObject.downloadAsStream | public function downloadAsStream(array $options = [])
{
return $this->connection->downloadObject(
$this->formatEncryptionHeaders(
$options
+ $this->encryptionData
+ array_filter($this->identity)
)
);
} | php | public function downloadAsStream(array $options = [])
{
return $this->connection->downloadObject(
$this->formatEncryptionHeaders(
$options
+ $this->encryptionData
+ array_filter($this->identity)
)
);
} | [
"public",
"function",
"downloadAsStream",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"connection",
"->",
"downloadObject",
"(",
"$",
"this",
"->",
"formatEncryptionHeaders",
"(",
"$",
"options",
"+",
"$",
"this",
"->",
"encryptionData",
"+",
"array_filter",
"(",
"$",
"this",
"->",
"identity",
")",
")",
")",
";",
"}"
] | Download an object as a stream.
Example:
```
$stream = $object->downloadAsStream();
echo $stream->getContents();
```
@param array $options [optional] {
Configuration Options.
@type string $encryptionKey An AES-256 customer-supplied encryption
key. It will be neccesary to provide this when a key was used
during the object's creation. If provided one must also include
an `encryptionKeySHA256`.
@type string $encryptionKeySHA256 The SHA256 hash of the
customer-supplied encryption key. It will be neccesary to
provide this when a key was used during the object's creation.
If provided one must also include an `encryptionKey`.
}
@return StreamInterface | [
"Download",
"an",
"object",
"as",
"a",
"stream",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Storage/src/StorageObject.php#L637-L646 | train |
googleapis/google-cloud-php | Storage/src/StorageObject.php | StorageObject.downloadAsStreamAsync | public function downloadAsStreamAsync(array $options = [])
{
return $this->connection->downloadObjectAsync(
$this->formatEncryptionHeaders(
$options
+ $this->encryptionData
+ array_filter($this->identity)
)
);
} | php | public function downloadAsStreamAsync(array $options = [])
{
return $this->connection->downloadObjectAsync(
$this->formatEncryptionHeaders(
$options
+ $this->encryptionData
+ array_filter($this->identity)
)
);
} | [
"public",
"function",
"downloadAsStreamAsync",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"connection",
"->",
"downloadObjectAsync",
"(",
"$",
"this",
"->",
"formatEncryptionHeaders",
"(",
"$",
"options",
"+",
"$",
"this",
"->",
"encryptionData",
"+",
"array_filter",
"(",
"$",
"this",
"->",
"identity",
")",
")",
")",
";",
"}"
] | Asynchronously download an object as a stream.
Example:
```
use Psr\Http\Message\StreamInterface;
$promise = $object->downloadAsStreamAsync()
->then(function (StreamInterface $data) {
echo $data->getContents();
});
$promise->wait();
```
```
// Download all objects in a bucket asynchronously.
use GuzzleHttp\Promise;
use Psr\Http\Message\StreamInterface;
$promises = [];
foreach ($bucket->objects() as $object) {
$promises[] = $object->downloadAsStreamAsync()
->then(function (StreamInterface $data) {
echo $data->getContents();
});
}
Promise\unwrap($promises);
```
@see https://github.com/guzzle/promises Learn more about Guzzle Promises
@param array $options [optional] {
Configuration Options.
@type string $encryptionKey An AES-256 customer-supplied encryption
key. It will be neccesary to provide this when a key was used
during the object's creation. If provided one must also include
an `encryptionKeySHA256`.
@type string $encryptionKeySHA256 The SHA256 hash of the
customer-supplied encryption key. It will be neccesary to
provide this when a key was used during the object's creation.
If provided one must also include an `encryptionKey`.
}
@return PromiseInterface<StreamInterface>
@experimental The experimental flag means that while we believe this method
or class is ready for use, it may change before release in backwards-
incompatible ways. Please use with caution, and test thoroughly when
upgrading. | [
"Asynchronously",
"download",
"an",
"object",
"as",
"a",
"stream",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Storage/src/StorageObject.php#L700-L709 | train |
googleapis/google-cloud-php | Storage/src/StorageObject.php | StorageObject.signedUploadUrl | public function signedUploadUrl($expires, array $options = [])
{
$options += [
'headers' => []
];
$options['headers']['x-goog-resumable'] = 'start';
unset(
$options['cname'],
$options['saveAsName'],
$options['responseDisposition'],
$options['responseType']
);
return $this->signedUrl($expires, [
'method' => 'POST',
'allowPost' => true
] + $options);
} | php | public function signedUploadUrl($expires, array $options = [])
{
$options += [
'headers' => []
];
$options['headers']['x-goog-resumable'] = 'start';
unset(
$options['cname'],
$options['saveAsName'],
$options['responseDisposition'],
$options['responseType']
);
return $this->signedUrl($expires, [
'method' => 'POST',
'allowPost' => true
] + $options);
} | [
"public",
"function",
"signedUploadUrl",
"(",
"$",
"expires",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"+=",
"[",
"'headers'",
"=>",
"[",
"]",
"]",
";",
"$",
"options",
"[",
"'headers'",
"]",
"[",
"'x-goog-resumable'",
"]",
"=",
"'start'",
";",
"unset",
"(",
"$",
"options",
"[",
"'cname'",
"]",
",",
"$",
"options",
"[",
"'saveAsName'",
"]",
",",
"$",
"options",
"[",
"'responseDisposition'",
"]",
",",
"$",
"options",
"[",
"'responseType'",
"]",
")",
";",
"return",
"$",
"this",
"->",
"signedUrl",
"(",
"$",
"expires",
",",
"[",
"'method'",
"=>",
"'POST'",
",",
"'allowPost'",
"=>",
"true",
"]",
"+",
"$",
"options",
")",
";",
"}"
] | Create a Signed Upload URL for this object.
This method differs from {@see Google\Cloud\Storage\StorageObject::signedUrl()}
in that it allows you to initiate a new resumable upload session. This
can be used to allow non-authenticated users to insert an object into a
bucket.
In order to upload data, a session URI must be
obtained by sending an HTTP POST request to the URL returned from this
method. See the [Cloud Storage Documentation](https://goo.gl/b1ZiZm) for
more information.
If you prefer to skip this initial step, you may find
{@see Google\Cloud\Storage\StorageObject::beginSignedUploadSession()} to
fit your needs. Note that `beginSignedUploadSession()` cannot be used
with Google Cloud PHP's Signed URL Uploader, and does not support a
configurable expiration date.
Example:
```
$url = $object->signedUploadUrl(new \DateTime('tomorrow'));
```
```
// Use Signed URLs v4
$url = $object->signedUploadUrl(new \DateTime('tomorrow'), [
'version' => 'v4'
]);
```
@param Timestamp|\DateTimeInterface|int $expires Specifies when the URL
will expire. May provide an instance of {@see Google\Cloud\Core\Timestamp},
[http://php.net/datetimeimmutable](`\DateTimeImmutable`), or a
UNIX timestamp as an integer.
@param array $options {
Configuration Options.
@type string $cname The CNAME for the bucket, for instance
`https://cdn.example.com`. **Defaults to**
`https://storage.googleapis.com`.
@type string $contentMd5 The MD5 digest value in base64. If you
provide this, the client must provide this HTTP header with
this same value in its request. If provided, take care to
always provide this value as a base64 encoded string.
@type string $contentType If you provide this value, the client must
provide this HTTP header set to the same value.
@type bool $forceOpenssl If true, OpenSSL will be used regardless of
whether phpseclib is available. **Defaults to** `false`.
@type array $headers If additional headers are provided, the server
will check to make sure that the client provides matching
values. Provide headers as a key/value array, where the key is
the header name, and the value is an array of header values.
Headers with multiple values may provide values as a simple
array, or a comma-separated string. For a reference of allowed
headers, see [Reference Headers](https://cloud.google.com/storage/docs/xml-api/reference-headers).
Header values will be trimmed of leading and trailing spaces,
multiple spaces within values will be collapsed to a single
space, and line breaks will be replaced by an empty string.
V2 Signed URLs may not provide `x-goog-encryption-key` or
`x-goog-encryption-key-sha256` headers.
@type array $keyFile Keyfile data to use in place of the keyfile with
which the client was constructed. If `$options.keyFilePath` is
set, this option is ignored.
@type string $keyFilePath A path to a valid Keyfile to use in place
of the keyfile with which the client was constructed.
@type string $responseDisposition The
[`response-content-disposition`](http://www.iana.org/assignments/cont-disp/cont-disp.xhtml)
parameter of the signed url.
@type string $responseType The `response-content-type` parameter of the
signed url. When the server contentType is `null`, this option
may be used to control the content type of the response.
@type string $saveAsName The filename to prompt the user to save the
file as when the signed url is accessed. This is ignored if
`$options.responseDisposition` is set.
@type string|array $scopes One or more authentication scopes to be
used with a key file. This option is ignored unless
`$options.keyFile` or `$options.keyFilePath` is set.
@type array $queryParams Additional query parameters to be included
as part of the signed URL query string. For allowed values,
see [Reference Headers](https://cloud.google.com/storage/docs/xml-api/reference-headers#query).
@type string $version One of "v2" or "v4". **Defaults to** `"v2"`.
}
@return string | [
"Create",
"a",
"Signed",
"Upload",
"URL",
"for",
"this",
"object",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Storage/src/StorageObject.php#L922-L941 | train |
googleapis/google-cloud-php | Storage/src/StorageObject.php | StorageObject.beginSignedUploadSession | public function beginSignedUploadSession(array $options = [])
{
$expires = new \DateTimeImmutable('+1 minute');
$startUri = $this->signedUploadUrl($expires, $options);
$uploaderOptions = $this->pluckArray([
'contentType',
'origin'
], $options);
if (!isset($uploaderOptions['origin'])) {
$uploaderOptions['origin'] = '*';
}
$uploader = new SignedUrlUploader($this->connection->requestWrapper(), '', $startUri, $uploaderOptions);
return $uploader->getResumeUri();
} | php | public function beginSignedUploadSession(array $options = [])
{
$expires = new \DateTimeImmutable('+1 minute');
$startUri = $this->signedUploadUrl($expires, $options);
$uploaderOptions = $this->pluckArray([
'contentType',
'origin'
], $options);
if (!isset($uploaderOptions['origin'])) {
$uploaderOptions['origin'] = '*';
}
$uploader = new SignedUrlUploader($this->connection->requestWrapper(), '', $startUri, $uploaderOptions);
return $uploader->getResumeUri();
} | [
"public",
"function",
"beginSignedUploadSession",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"expires",
"=",
"new",
"\\",
"DateTimeImmutable",
"(",
"'+1 minute'",
")",
";",
"$",
"startUri",
"=",
"$",
"this",
"->",
"signedUploadUrl",
"(",
"$",
"expires",
",",
"$",
"options",
")",
";",
"$",
"uploaderOptions",
"=",
"$",
"this",
"->",
"pluckArray",
"(",
"[",
"'contentType'",
",",
"'origin'",
"]",
",",
"$",
"options",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"uploaderOptions",
"[",
"'origin'",
"]",
")",
")",
"{",
"$",
"uploaderOptions",
"[",
"'origin'",
"]",
"=",
"'*'",
";",
"}",
"$",
"uploader",
"=",
"new",
"SignedUrlUploader",
"(",
"$",
"this",
"->",
"connection",
"->",
"requestWrapper",
"(",
")",
",",
"''",
",",
"$",
"startUri",
",",
"$",
"uploaderOptions",
")",
";",
"return",
"$",
"uploader",
"->",
"getResumeUri",
"(",
")",
";",
"}"
] | Create a signed URL upload session.
The returned URL differs from the return value of
{@see Google\Cloud\Storage\StorageObject::signedUploadUrl()} in that it
is ready to accept upload data immediately via an HTTP PUT request.
Because an upload session is created by the client, the expiration date
is not configurable. The URL generated by this method is valid for one
week.
Example:
```
$url = $object->beginSignedUploadSession();
```
```
// Use Signed URLs v4
$url = $object->beginSignedUploadSession([
'version' => 'v4'
]);
```
@see https://cloud.google.com/storage/docs/xml-api/resumable-upload#practices Resumable Upload Best Practices
@param array $options {
Configuration Options.
@type string $contentMd5 The MD5 digest value in base64. If you
provide this, the client must provide this HTTP header with
this same value in its request. If provided, take care to
always provide this value as a base64 encoded string.
@type string $contentType If you provide this value, the client must
provide this HTTP header set to the same value.
@type bool $forceOpenssl If true, OpenSSL will be used regardless of
whether phpseclib is available. **Defaults to** `false`.
@type array $headers If additional headers are provided, the server
will check to make sure that the client provides matching
values. Provide headers as a key/value array, where the key is
the header name, and the value is an array of header values.
Headers with multiple values may provide values as a simple
array, or a comma-separated string. For a reference of allowed
headers, see [Reference Headers](https://cloud.google.com/storage/docs/xml-api/reference-headers).
Header values will be trimmed of leading and trailing spaces,
multiple spaces within values will be collapsed to a single
space, and line breaks will be replaced by an empty string.
V2 Signed URLs may not provide `x-goog-encryption-key` or
`x-goog-encryption-key-sha256` headers.
@type array $keyFile Keyfile data to use in place of the keyfile with
which the client was constructed. If `$options.keyFilePath` is
set, this option is ignored.
@type string $keyFilePath A path to a valid Keyfile to use in place
of the keyfile with which the client was constructed.
@type string $origin Value of CORS header
"Access-Control-Allow-Origin". **Defaults to** `"*"`.
@type string|array $scopes One or more authentication scopes to be
used with a key file. This option is ignored unless
`$options.keyFile` or `$options.keyFilePath` is set.
@type array $queryParams Additional query parameters to be included
as part of the signed URL query string. For allowed values,
see [Reference Headers](https://cloud.google.com/storage/docs/xml-api/reference-headers#query).
@type string $version One of "v2" or "v4". **Defaults to** `"v2"`.
}
@return string | [
"Create",
"a",
"signed",
"URL",
"upload",
"session",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Storage/src/StorageObject.php#L1008-L1025 | train |
googleapis/google-cloud-php | Storage/src/StorageObject.php | StorageObject.reload | public function reload(array $options = [])
{
return $this->info = $this->connection->getObject(
$this->formatEncryptionHeaders(
$options
+ $this->encryptionData
+ array_filter($this->identity)
)
);
} | php | public function reload(array $options = [])
{
return $this->info = $this->connection->getObject(
$this->formatEncryptionHeaders(
$options
+ $this->encryptionData
+ array_filter($this->identity)
)
);
} | [
"public",
"function",
"reload",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"info",
"=",
"$",
"this",
"->",
"connection",
"->",
"getObject",
"(",
"$",
"this",
"->",
"formatEncryptionHeaders",
"(",
"$",
"options",
"+",
"$",
"this",
"->",
"encryptionData",
"+",
"array_filter",
"(",
"$",
"this",
"->",
"identity",
")",
")",
")",
";",
"}"
] | Triggers a network request to reload the object's details.
Example:
```
$object->reload();
$info = $object->info();
echo $info['location'];
```
@see https://cloud.google.com/storage/docs/json_api/v1/objects/get Objects get API documentation.
@param array $options [optional] {
Configuration options.
@type string $encryptionKey A base64 encoded AES-256 customer-supplied
encryption key. It will be neccesary to provide this when a key
was used during the object's creation.
@type string $encryptionKeySHA256 Base64 encoded SHA256 hash of the
customer-supplied encryption key. This value will be calculated
from the `encryptionKey` on your behalf if not provided, but
for best performance it is recommended to pass in a cached
version of the already calculated SHA.
@type string $ifGenerationMatch Makes the operation conditional on
whether the object's current generation matches the given
value.
@type string $ifGenerationNotMatch Makes the operation conditional on
whether the object's current generation does not match the
given value.
@type string $ifMetagenerationMatch Makes the operation conditional
on whether the object's current metageneration matches the
given value.
@type string $ifMetagenerationNotMatch Makes the operation
conditional on whether the object's current metageneration does
not match the given value.
@type string $projection Determines which properties to return. May
be either 'full' or 'noAcl'.
}
@return array | [
"Triggers",
"a",
"network",
"request",
"to",
"reload",
"the",
"object",
"s",
"details",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Storage/src/StorageObject.php#L1114-L1123 | train |
googleapis/google-cloud-php | Storage/src/StorageObject.php | StorageObject.formatDestinationRequest | private function formatDestinationRequest($destination, array $options)
{
if (!is_string($destination) && !($destination instanceof Bucket)) {
throw new \InvalidArgumentException(
'$destination must be either a string or an instance of Bucket.'
);
}
$destAcl = isset($options['predefinedAcl']) ? $options['predefinedAcl'] : null;
$destObject = isset($options['name']) ? $options['name'] : $this->identity['object'];
unset($options['name']);
unset($options['predefinedAcl']);
return array_filter([
'destinationBucket' => $destination instanceof Bucket ? $destination->name() : $destination,
'destinationObject' => $destObject,
'destinationPredefinedAcl' => $destAcl,
'sourceBucket' => $this->identity['bucket'],
'sourceObject' => $this->identity['object'],
'sourceGeneration' => $this->identity['generation'],
'userProject' => $this->identity['userProject'],
]) + $this->formatEncryptionHeaders($options + $this->encryptionData);
} | php | private function formatDestinationRequest($destination, array $options)
{
if (!is_string($destination) && !($destination instanceof Bucket)) {
throw new \InvalidArgumentException(
'$destination must be either a string or an instance of Bucket.'
);
}
$destAcl = isset($options['predefinedAcl']) ? $options['predefinedAcl'] : null;
$destObject = isset($options['name']) ? $options['name'] : $this->identity['object'];
unset($options['name']);
unset($options['predefinedAcl']);
return array_filter([
'destinationBucket' => $destination instanceof Bucket ? $destination->name() : $destination,
'destinationObject' => $destObject,
'destinationPredefinedAcl' => $destAcl,
'sourceBucket' => $this->identity['bucket'],
'sourceObject' => $this->identity['object'],
'sourceGeneration' => $this->identity['generation'],
'userProject' => $this->identity['userProject'],
]) + $this->formatEncryptionHeaders($options + $this->encryptionData);
} | [
"private",
"function",
"formatDestinationRequest",
"(",
"$",
"destination",
",",
"array",
"$",
"options",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"destination",
")",
"&&",
"!",
"(",
"$",
"destination",
"instanceof",
"Bucket",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'$destination must be either a string or an instance of Bucket.'",
")",
";",
"}",
"$",
"destAcl",
"=",
"isset",
"(",
"$",
"options",
"[",
"'predefinedAcl'",
"]",
")",
"?",
"$",
"options",
"[",
"'predefinedAcl'",
"]",
":",
"null",
";",
"$",
"destObject",
"=",
"isset",
"(",
"$",
"options",
"[",
"'name'",
"]",
")",
"?",
"$",
"options",
"[",
"'name'",
"]",
":",
"$",
"this",
"->",
"identity",
"[",
"'object'",
"]",
";",
"unset",
"(",
"$",
"options",
"[",
"'name'",
"]",
")",
";",
"unset",
"(",
"$",
"options",
"[",
"'predefinedAcl'",
"]",
")",
";",
"return",
"array_filter",
"(",
"[",
"'destinationBucket'",
"=>",
"$",
"destination",
"instanceof",
"Bucket",
"?",
"$",
"destination",
"->",
"name",
"(",
")",
":",
"$",
"destination",
",",
"'destinationObject'",
"=>",
"$",
"destObject",
",",
"'destinationPredefinedAcl'",
"=>",
"$",
"destAcl",
",",
"'sourceBucket'",
"=>",
"$",
"this",
"->",
"identity",
"[",
"'bucket'",
"]",
",",
"'sourceObject'",
"=>",
"$",
"this",
"->",
"identity",
"[",
"'object'",
"]",
",",
"'sourceGeneration'",
"=>",
"$",
"this",
"->",
"identity",
"[",
"'generation'",
"]",
",",
"'userProject'",
"=>",
"$",
"this",
"->",
"identity",
"[",
"'userProject'",
"]",
",",
"]",
")",
"+",
"$",
"this",
"->",
"formatEncryptionHeaders",
"(",
"$",
"options",
"+",
"$",
"this",
"->",
"encryptionData",
")",
";",
"}"
] | Formats a destination based request, such as copy or rewrite.
@param string|Bucket $destination The destination bucket.
@param array $options Options to configure.
@return array | [
"Formats",
"a",
"destination",
"based",
"request",
"such",
"as",
"copy",
"or",
"rewrite",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Storage/src/StorageObject.php#L1182-L1205 | train |
googleapis/google-cloud-php | Dlp/src/V2/JobTrigger.php | JobTrigger.setTriggers | public function setTriggers($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dlp\V2\JobTrigger\Trigger::class);
$this->triggers = $arr;
return $this;
} | php | public function setTriggers($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dlp\V2\JobTrigger\Trigger::class);
$this->triggers = $arr;
return $this;
} | [
"public",
"function",
"setTriggers",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dlp",
"\\",
"V2",
"\\",
"JobTrigger",
"\\",
"Trigger",
"::",
"class",
")",
";",
"$",
"this",
"->",
"triggers",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | A list of triggers which will be OR'ed together. Only one in the list
needs to trigger for a job to be started. The list may contain only
a single Schedule trigger and must have at least one object.
Generated from protobuf field <code>repeated .google.privacy.dlp.v2.JobTrigger.Trigger triggers = 5;</code>
@param \Google\Cloud\Dlp\V2\JobTrigger\Trigger[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"A",
"list",
"of",
"triggers",
"which",
"will",
"be",
"OR",
"ed",
"together",
".",
"Only",
"one",
"in",
"the",
"list",
"needs",
"to",
"trigger",
"for",
"a",
"job",
"to",
"be",
"started",
".",
"The",
"list",
"may",
"contain",
"only",
"a",
"single",
"Schedule",
"trigger",
"and",
"must",
"have",
"at",
"least",
"one",
"object",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/JobTrigger.php#L247-L253 | train |
googleapis/google-cloud-php | Dlp/src/V2/JobTrigger.php | JobTrigger.setErrors | public function setErrors($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dlp\V2\Error::class);
$this->errors = $arr;
return $this;
} | php | public function setErrors($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dlp\V2\Error::class);
$this->errors = $arr;
return $this;
} | [
"public",
"function",
"setErrors",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dlp",
"\\",
"V2",
"\\",
"Error",
"::",
"class",
")",
";",
"$",
"this",
"->",
"errors",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | A stream of errors encountered when the trigger was activated. Repeated
errors may result in the JobTrigger automatically being paused.
Will return the last 100 errors. Whenever the JobTrigger is modified
this list will be cleared. Output only field.
Generated from protobuf field <code>repeated .google.privacy.dlp.v2.Error errors = 6;</code>
@param \Google\Cloud\Dlp\V2\Error[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"A",
"stream",
"of",
"errors",
"encountered",
"when",
"the",
"trigger",
"was",
"activated",
".",
"Repeated",
"errors",
"may",
"result",
"in",
"the",
"JobTrigger",
"automatically",
"being",
"paused",
".",
"Will",
"return",
"the",
"last",
"100",
"errors",
".",
"Whenever",
"the",
"JobTrigger",
"is",
"modified",
"this",
"list",
"will",
"be",
"cleared",
".",
"Output",
"only",
"field",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/JobTrigger.php#L279-L285 | train |
googleapis/google-cloud-php | Asset/src/V1/AssetServiceGrpcClient.php | AssetServiceGrpcClient.BatchGetAssetsHistory | public function BatchGetAssetsHistory(\Google\Cloud\Asset\V1\BatchGetAssetsHistoryRequest $argument,
$metadata = [], $options = []) {
return $this->_simpleRequest('/google.cloud.asset.v1.AssetService/BatchGetAssetsHistory',
$argument,
['\Google\Cloud\Asset\V1\BatchGetAssetsHistoryResponse', 'decode'],
$metadata, $options);
} | php | public function BatchGetAssetsHistory(\Google\Cloud\Asset\V1\BatchGetAssetsHistoryRequest $argument,
$metadata = [], $options = []) {
return $this->_simpleRequest('/google.cloud.asset.v1.AssetService/BatchGetAssetsHistory',
$argument,
['\Google\Cloud\Asset\V1\BatchGetAssetsHistoryResponse', 'decode'],
$metadata, $options);
} | [
"public",
"function",
"BatchGetAssetsHistory",
"(",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Asset",
"\\",
"V1",
"\\",
"BatchGetAssetsHistoryRequest",
"$",
"argument",
",",
"$",
"metadata",
"=",
"[",
"]",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"_simpleRequest",
"(",
"'/google.cloud.asset.v1.AssetService/BatchGetAssetsHistory'",
",",
"$",
"argument",
",",
"[",
"'\\Google\\Cloud\\Asset\\V1\\BatchGetAssetsHistoryResponse'",
",",
"'decode'",
"]",
",",
"$",
"metadata",
",",
"$",
"options",
")",
";",
"}"
] | Batch gets the update history of assets that overlap a time window.
For RESOURCE content, this API outputs history with asset in both
non-delete or deleted status.
For IAM_POLICY content, this API outputs history when the asset and its
attached IAM POLICY both exist. This can create gaps in the output history.
If a specified asset does not exist, this API returns an INVALID_ARGUMENT
error.
@param \Google\Cloud\Asset\V1\BatchGetAssetsHistoryRequest $argument input argument
@param array $metadata metadata
@param array $options call options | [
"Batch",
"gets",
"the",
"update",
"history",
"of",
"assets",
"that",
"overlap",
"a",
"time",
"window",
".",
"For",
"RESOURCE",
"content",
"this",
"API",
"outputs",
"history",
"with",
"asset",
"in",
"both",
"non",
"-",
"delete",
"or",
"deleted",
"status",
".",
"For",
"IAM_POLICY",
"content",
"this",
"API",
"outputs",
"history",
"when",
"the",
"asset",
"and",
"its",
"attached",
"IAM",
"POLICY",
"both",
"exist",
".",
"This",
"can",
"create",
"gaps",
"in",
"the",
"output",
"history",
".",
"If",
"a",
"specified",
"asset",
"does",
"not",
"exist",
"this",
"API",
"returns",
"an",
"INVALID_ARGUMENT",
"error",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Asset/src/V1/AssetServiceGrpcClient.php#L65-L71 | train |
googleapis/google-cloud-php | Dlp/src/V2/StoredInfoTypeConfig.php | StoredInfoTypeConfig.setLargeCustomDictionary | public function setLargeCustomDictionary($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\LargeCustomDictionaryConfig::class);
$this->writeOneof(3, $var);
return $this;
} | php | public function setLargeCustomDictionary($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\LargeCustomDictionaryConfig::class);
$this->writeOneof(3, $var);
return $this;
} | [
"public",
"function",
"setLargeCustomDictionary",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dlp",
"\\",
"V2",
"\\",
"LargeCustomDictionaryConfig",
"::",
"class",
")",
";",
"$",
"this",
"->",
"writeOneof",
"(",
"3",
",",
"$",
"var",
")",
";",
"return",
"$",
"this",
";",
"}"
] | StoredInfoType where findings are defined by a dictionary of phrases.
Generated from protobuf field <code>.google.privacy.dlp.v2.LargeCustomDictionaryConfig large_custom_dictionary = 3;</code>
@param \Google\Cloud\Dlp\V2\LargeCustomDictionaryConfig $var
@return $this | [
"StoredInfoType",
"where",
"findings",
"are",
"defined",
"by",
"a",
"dictionary",
"of",
"phrases",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/StoredInfoTypeConfig.php#L121-L127 | train |
googleapis/google-cloud-php | AutoMl/src/V1beta1/InputConfig.php | InputConfig.setGcsSource | public function setGcsSource($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\AutoMl\V1beta1\GcsSource::class);
$this->writeOneof(1, $var);
return $this;
} | php | public function setGcsSource($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\AutoMl\V1beta1\GcsSource::class);
$this->writeOneof(1, $var);
return $this;
} | [
"public",
"function",
"setGcsSource",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"AutoMl",
"\\",
"V1beta1",
"\\",
"GcsSource",
"::",
"class",
")",
";",
"$",
"this",
"->",
"writeOneof",
"(",
"1",
",",
"$",
"var",
")",
";",
"return",
"$",
"this",
";",
"}"
] | The GCS location for the input content.
Generated from protobuf field <code>.google.cloud.automl.v1beta1.GcsSource gcs_source = 1;</code>
@param \Google\Cloud\AutoMl\V1beta1\GcsSource $var
@return $this | [
"The",
"GCS",
"location",
"for",
"the",
"input",
"content",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/AutoMl/src/V1beta1/InputConfig.php#L53-L59 | train |
googleapis/google-cloud-php | Dataproc/src/V1/JobStatus.php | JobStatus.setSubstate | public function setSubstate($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Dataproc\V1\JobStatus_Substate::class);
$this->substate = $var;
return $this;
} | php | public function setSubstate($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Dataproc\V1\JobStatus_Substate::class);
$this->substate = $var;
return $this;
} | [
"public",
"function",
"setSubstate",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dataproc",
"\\",
"V1",
"\\",
"JobStatus_Substate",
"::",
"class",
")",
";",
"$",
"this",
"->",
"substate",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Output only. Additional state information, which includes
status reported by the agent.
Generated from protobuf field <code>.google.cloud.dataproc.v1.JobStatus.Substate substate = 7;</code>
@param int $var
@return $this | [
"Output",
"only",
".",
"Additional",
"state",
"information",
"which",
"includes",
"status",
"reported",
"by",
"the",
"agent",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dataproc/src/V1/JobStatus.php#L168-L174 | train |
googleapis/google-cloud-php | Dialogflow/src/V2/CreateEntityTypeRequest.php | CreateEntityTypeRequest.setEntityType | public function setEntityType($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\EntityType::class);
$this->entity_type = $var;
return $this;
} | php | public function setEntityType($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\EntityType::class);
$this->entity_type = $var;
return $this;
} | [
"public",
"function",
"setEntityType",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dialogflow",
"\\",
"V2",
"\\",
"EntityType",
"::",
"class",
")",
";",
"$",
"this",
"->",
"entity_type",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Required. The entity type to create.
Generated from protobuf field <code>.google.cloud.dialogflow.v2.EntityType entity_type = 2;</code>
@param \Google\Cloud\Dialogflow\V2\EntityType $var
@return $this | [
"Required",
".",
"The",
"entity",
"type",
"to",
"create",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dialogflow/src/V2/CreateEntityTypeRequest.php#L114-L120 | train |
googleapis/google-cloud-php | Dlp/src/V2/ValueFrequency.php | ValueFrequency.setValue | public function setValue($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\Value::class);
$this->value = $var;
return $this;
} | php | public function setValue($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\Value::class);
$this->value = $var;
return $this;
} | [
"public",
"function",
"setValue",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dlp",
"\\",
"V2",
"\\",
"Value",
"::",
"class",
")",
";",
"$",
"this",
"->",
"value",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | A value contained in the field in question.
Generated from protobuf field <code>.google.privacy.dlp.v2.Value value = 1;</code>
@param \Google\Cloud\Dlp\V2\Value $var
@return $this | [
"A",
"value",
"contained",
"in",
"the",
"field",
"in",
"question",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/ValueFrequency.php#L66-L72 | train |
googleapis/google-cloud-php | Dlp/src/V2/Location.php | Location.setByteRange | public function setByteRange($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\Range::class);
$this->byte_range = $var;
return $this;
} | php | public function setByteRange($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\Range::class);
$this->byte_range = $var;
return $this;
} | [
"public",
"function",
"setByteRange",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dlp",
"\\",
"V2",
"\\",
"Range",
"::",
"class",
")",
";",
"$",
"this",
"->",
"byte_range",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Zero-based byte offsets delimiting the finding.
These are relative to the finding's containing element.
Note that when the content is not textual, this references
the UTF-8 encoded textual representation of the content.
Omitted if content is an image.
Generated from protobuf field <code>.google.privacy.dlp.v2.Range byte_range = 1;</code>
@param \Google\Cloud\Dlp\V2\Range $var
@return $this | [
"Zero",
"-",
"based",
"byte",
"offsets",
"delimiting",
"the",
"finding",
".",
"These",
"are",
"relative",
"to",
"the",
"finding",
"s",
"containing",
"element",
".",
"Note",
"that",
"when",
"the",
"content",
"is",
"not",
"textual",
"this",
"references",
"the",
"UTF",
"-",
"8",
"encoded",
"textual",
"representation",
"of",
"the",
"content",
".",
"Omitted",
"if",
"content",
"is",
"an",
"image",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/Location.php#L96-L102 | train |
googleapis/google-cloud-php | Dlp/src/V2/Location.php | Location.setCodepointRange | public function setCodepointRange($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\Range::class);
$this->codepoint_range = $var;
return $this;
} | php | public function setCodepointRange($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\Range::class);
$this->codepoint_range = $var;
return $this;
} | [
"public",
"function",
"setCodepointRange",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dlp",
"\\",
"V2",
"\\",
"Range",
"::",
"class",
")",
";",
"$",
"this",
"->",
"codepoint_range",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Unicode character offsets delimiting the finding.
These are relative to the finding's containing element.
Provided when the content is text.
Generated from protobuf field <code>.google.privacy.dlp.v2.Range codepoint_range = 2;</code>
@param \Google\Cloud\Dlp\V2\Range $var
@return $this | [
"Unicode",
"character",
"offsets",
"delimiting",
"the",
"finding",
".",
"These",
"are",
"relative",
"to",
"the",
"finding",
"s",
"containing",
"element",
".",
"Provided",
"when",
"the",
"content",
"is",
"text",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/Location.php#L126-L132 | train |
googleapis/google-cloud-php | Dlp/src/V2/Location.php | Location.setContentLocations | public function setContentLocations($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dlp\V2\ContentLocation::class);
$this->content_locations = $arr;
return $this;
} | php | public function setContentLocations($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dlp\V2\ContentLocation::class);
$this->content_locations = $arr;
return $this;
} | [
"public",
"function",
"setContentLocations",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dlp",
"\\",
"V2",
"\\",
"ContentLocation",
"::",
"class",
")",
";",
"$",
"this",
"->",
"content_locations",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | List of nested objects pointing to the precise location of the finding
within the file or record.
Generated from protobuf field <code>repeated .google.privacy.dlp.v2.ContentLocation content_locations = 7;</code>
@param \Google\Cloud\Dlp\V2\ContentLocation[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"List",
"of",
"nested",
"objects",
"pointing",
"to",
"the",
"precise",
"location",
"of",
"the",
"finding",
"within",
"the",
"file",
"or",
"record",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/Location.php#L154-L160 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.