repo
stringlengths 6
63
| path
stringlengths 5
140
| func_name
stringlengths 3
151
| original_string
stringlengths 84
13k
| language
stringclasses 1
value | code
stringlengths 84
13k
| code_tokens
list | docstring
stringlengths 3
47.2k
| docstring_tokens
list | sha
stringlengths 40
40
| url
stringlengths 91
247
| partition
stringclasses 1
value |
---|---|---|---|---|---|---|---|---|---|---|---|
googleapis/google-cloud-php | Spanner/src/Transaction.php | Transaction.insertBatch | public function insertBatch($table, array $dataSet)
{
$this->enqueue(Operation::OP_INSERT, $table, $dataSet);
return $this;
} | php | public function insertBatch($table, array $dataSet)
{
$this->enqueue(Operation::OP_INSERT, $table, $dataSet);
return $this;
} | [
"public",
"function",
"insertBatch",
"(",
"$",
"table",
",",
"array",
"$",
"dataSet",
")",
"{",
"$",
"this",
"->",
"enqueue",
"(",
"Operation",
"::",
"OP_INSERT",
",",
"$",
"table",
",",
"$",
"dataSet",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Enqueue one or more insert mutations.
Example:
```
$transaction->insertBatch('Posts', [
[
'ID' => 10,
'title' => 'My New Post',
'content' => 'Hello World'
]
]);
```
@param string $table The table to insert into.
@param array $dataSet The data to insert.
@return Transaction The transaction, to enable method chaining. | [
"Enqueue",
"one",
"or",
"more",
"insert",
"mutations",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Transaction.php#L144-L149 | train |
googleapis/google-cloud-php | Spanner/src/Transaction.php | Transaction.updateBatch | public function updateBatch($table, array $dataSet)
{
$this->enqueue(Operation::OP_UPDATE, $table, $dataSet);
return $this;
} | php | public function updateBatch($table, array $dataSet)
{
$this->enqueue(Operation::OP_UPDATE, $table, $dataSet);
return $this;
} | [
"public",
"function",
"updateBatch",
"(",
"$",
"table",
",",
"array",
"$",
"dataSet",
")",
"{",
"$",
"this",
"->",
"enqueue",
"(",
"Operation",
"::",
"OP_UPDATE",
",",
"$",
"table",
",",
"$",
"dataSet",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Enqueue one or more update mutations.
Example:
```
$transaction->updateBatch('Posts', [
[
'ID' => 10,
'title' => 'My New Post [Updated!]',
'content' => 'Modified Content'
]
]);
```
@param string $table The table to update.
@param array $dataSet The data to update.
@return Transaction The transaction, to enable method chaining. | [
"Enqueue",
"one",
"or",
"more",
"update",
"mutations",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Transaction.php#L190-L195 | train |
googleapis/google-cloud-php | Spanner/src/Transaction.php | Transaction.insertOrUpdateBatch | public function insertOrUpdateBatch($table, array $dataSet)
{
$this->enqueue(Operation::OP_INSERT_OR_UPDATE, $table, $dataSet);
return $this;
} | php | public function insertOrUpdateBatch($table, array $dataSet)
{
$this->enqueue(Operation::OP_INSERT_OR_UPDATE, $table, $dataSet);
return $this;
} | [
"public",
"function",
"insertOrUpdateBatch",
"(",
"$",
"table",
",",
"array",
"$",
"dataSet",
")",
"{",
"$",
"this",
"->",
"enqueue",
"(",
"Operation",
"::",
"OP_INSERT_OR_UPDATE",
",",
"$",
"table",
",",
"$",
"dataSet",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Enqueue one or more insert or update mutations.
Example:
```
$transaction->insertOrUpdateBatch('Posts', [
[
'ID' => 10,
'title' => 'My New Post',
'content' => 'Hello World'
]
]);
```
@param string $table The table to insert into or update.
@param array $dataSet The data to insert or update.
@return Transaction The transaction, to enable method chaining. | [
"Enqueue",
"one",
"or",
"more",
"insert",
"or",
"update",
"mutations",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Transaction.php#L236-L241 | train |
googleapis/google-cloud-php | Spanner/src/Transaction.php | Transaction.replaceBatch | public function replaceBatch($table, array $dataSet)
{
$this->enqueue(Operation::OP_REPLACE, $table, $dataSet);
return $this;
} | php | public function replaceBatch($table, array $dataSet)
{
$this->enqueue(Operation::OP_REPLACE, $table, $dataSet);
return $this;
} | [
"public",
"function",
"replaceBatch",
"(",
"$",
"table",
",",
"array",
"$",
"dataSet",
")",
"{",
"$",
"this",
"->",
"enqueue",
"(",
"Operation",
"::",
"OP_REPLACE",
",",
"$",
"table",
",",
"$",
"dataSet",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Enqueue one or more replace mutations.
Example:
```
$transaction->replaceBatch('Posts', [
[
'ID' => 10,
'title' => 'My New Post [Replaced]',
'content' => 'Hello Moon'
]
]);
```
@param string $table The table to replace into.
@param array $dataSet The data to replace.
@return Transaction The transaction, to enable method chaining. | [
"Enqueue",
"one",
"or",
"more",
"replace",
"mutations",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Transaction.php#L282-L287 | train |
googleapis/google-cloud-php | Spanner/src/Transaction.php | Transaction.delete | public function delete($table, KeySet $keySet)
{
$this->enqueue(Operation::OP_DELETE, $table, [$keySet]);
return $this;
} | php | public function delete($table, KeySet $keySet)
{
$this->enqueue(Operation::OP_DELETE, $table, [$keySet]);
return $this;
} | [
"public",
"function",
"delete",
"(",
"$",
"table",
",",
"KeySet",
"$",
"keySet",
")",
"{",
"$",
"this",
"->",
"enqueue",
"(",
"Operation",
"::",
"OP_DELETE",
",",
"$",
"table",
",",
"[",
"$",
"keySet",
"]",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Enqueue an delete mutation.
Example:
```
$keySet = new KeySet([
'keys' => [10]
]);
$transaction->delete('Posts', $keySet);
```
@param string $table The table to mutate.
@param KeySet $keySet The KeySet to identify rows to delete.
@return Transaction The transaction, to enable method chaining. | [
"Enqueue",
"an",
"delete",
"mutation",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Transaction.php#L305-L310 | train |
googleapis/google-cloud-php | Spanner/src/Transaction.php | Transaction.executeUpdate | public function executeUpdate($sql, array $options = [])
{
$options['seqno'] = $this->seqno;
$this->seqno++;
return $this->operation
->executeUpdate($this->session, $this, $sql, $options);
} | php | public function executeUpdate($sql, array $options = [])
{
$options['seqno'] = $this->seqno;
$this->seqno++;
return $this->operation
->executeUpdate($this->session, $this, $sql, $options);
} | [
"public",
"function",
"executeUpdate",
"(",
"$",
"sql",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"[",
"'seqno'",
"]",
"=",
"$",
"this",
"->",
"seqno",
";",
"$",
"this",
"->",
"seqno",
"++",
";",
"return",
"$",
"this",
"->",
"operation",
"->",
"executeUpdate",
"(",
"$",
"this",
"->",
"session",
",",
"$",
"this",
",",
"$",
"sql",
",",
"$",
"options",
")",
";",
"}"
] | Execute a Cloud Spanner DML statement.
Data Manipulation Language (DML) allows you to execute statements which
modify the state of the database (i.e. inserting, updating or deleting
rows).
To execute a SQL query (such as a SELECT), use
{@see Google\Cloud\Spanner\Transaction::execute()}.
Mutations performed via DML will be visible to subsequent operations
within the same transaction. In other words, unlike with other mutation
methods provided, you can read your uncommitted writes. If a transaction
is not committed (either because of a rollback or error), the DML writes
will not be applied.
Example:
```
$modifiedRowCount = $transaction->executeUpdate('UPDATE Posts SET content = @content WHERE id = @id', [
'parameters' => [
'content' => 'Hello world!',
'id' => 10
]
]);
@codingStandardsIgnoreStart
@see https://cloud.google.com/spanner/reference/rpc/google.spanner.v1#google.spanner.v1.ExecuteSqlRequest ExecuteSqlRequest
@codingStandardsIgnoreEnd
@param string $sql The query string to execute.
@param array $options [optional] {
Configuration Options.
@type array $parameters A key/value array of Query Parameters, where
the key is represented in the query string prefixed by a `@`
symbol.
@type array $types A key/value array of Query Parameter types.
Generally, Google Cloud PHP can infer types. Explicit type
declarations are required in the case of struct parameters,
or when a null value exists as a parameter.
Accepted values for primitive types are defined as constants on
{@see Google\Cloud\Spanner\Database}, and are as follows:
`Database::TYPE_BOOL`, `Database::TYPE_INT64`,
`Database::TYPE_FLOAT64`, `Database::TYPE_TIMESTAMP`,
`Database::TYPE_DATE`, `Database::TYPE_STRING`,
`Database::TYPE_BYTES`. If the value is an array, use
{@see Google\Cloud\Spanner\ArrayType} to declare the array
parameter types. Likewise, for structs, use
{@see Google\Cloud\Spanner\StructType}.
}
@return int The number of rows modified. | [
"Execute",
"a",
"Cloud",
"Spanner",
"DML",
"statement",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Transaction.php#L364-L371 | train |
googleapis/google-cloud-php | Spanner/src/Transaction.php | Transaction.commit | public function commit(array $options = [])
{
if ($this->state !== self::STATE_ACTIVE) {
throw new \BadMethodCallException('The transaction cannot be committed because it is not active');
}
if (!$this->singleUseState()) {
$this->state = self::STATE_COMMITTED;
}
$options += [
'mutations' => []
];
$options['mutations'] += $this->mutations;
$options['transactionId'] = $this->transactionId;
$t = $this->transactionOptions($options);
$options[$t[1]] = $t[0];
return $this->operation->commit($this->session, $this->pluck('mutations', $options), $options);
} | php | public function commit(array $options = [])
{
if ($this->state !== self::STATE_ACTIVE) {
throw new \BadMethodCallException('The transaction cannot be committed because it is not active');
}
if (!$this->singleUseState()) {
$this->state = self::STATE_COMMITTED;
}
$options += [
'mutations' => []
];
$options['mutations'] += $this->mutations;
$options['transactionId'] = $this->transactionId;
$t = $this->transactionOptions($options);
$options[$t[1]] = $t[0];
return $this->operation->commit($this->session, $this->pluck('mutations', $options), $options);
} | [
"public",
"function",
"commit",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"state",
"!==",
"self",
"::",
"STATE_ACTIVE",
")",
"{",
"throw",
"new",
"\\",
"BadMethodCallException",
"(",
"'The transaction cannot be committed because it is not active'",
")",
";",
"}",
"if",
"(",
"!",
"$",
"this",
"->",
"singleUseState",
"(",
")",
")",
"{",
"$",
"this",
"->",
"state",
"=",
"self",
"::",
"STATE_COMMITTED",
";",
"}",
"$",
"options",
"+=",
"[",
"'mutations'",
"=>",
"[",
"]",
"]",
";",
"$",
"options",
"[",
"'mutations'",
"]",
"+=",
"$",
"this",
"->",
"mutations",
";",
"$",
"options",
"[",
"'transactionId'",
"]",
"=",
"$",
"this",
"->",
"transactionId",
";",
"$",
"t",
"=",
"$",
"this",
"->",
"transactionOptions",
"(",
"$",
"options",
")",
";",
"$",
"options",
"[",
"$",
"t",
"[",
"1",
"]",
"]",
"=",
"$",
"t",
"[",
"0",
"]",
";",
"return",
"$",
"this",
"->",
"operation",
"->",
"commit",
"(",
"$",
"this",
"->",
"session",
",",
"$",
"this",
"->",
"pluck",
"(",
"'mutations'",
",",
"$",
"options",
")",
",",
"$",
"options",
")",
";",
"}"
] | Commit and end the transaction.
It is advised that transactions be run inside
{@see Google\Cloud\Spanner\Database::runTransaction()} in order to take
advantage of automated transaction retry in case of a transaction aborted
error.
Example:
```
$transaction->commit();
```
@param array $options [optional] {
Configuration Options.
@type array $mutations An array of mutations to commit. May be used
instead of or in addition to enqueing mutations separately.
}
@return Timestamp The commit timestamp.
@throws \BadMethodCall If the transaction is not active or already used.
@throws AbortedException If the commit is aborted for any reason. | [
"Commit",
"and",
"end",
"the",
"transaction",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Transaction.php#L512-L535 | train |
googleapis/google-cloud-php | Spanner/src/Transaction.php | Transaction.enqueue | private function enqueue($op, $table, array $dataSet)
{
foreach ($dataSet as $data) {
if ($op === Operation::OP_DELETE) {
$this->mutations[] = $this->operation->deleteMutation($table, $data);
} else {
$this->mutations[] = $this->operation->mutation($op, $table, $data);
}
}
} | php | private function enqueue($op, $table, array $dataSet)
{
foreach ($dataSet as $data) {
if ($op === Operation::OP_DELETE) {
$this->mutations[] = $this->operation->deleteMutation($table, $data);
} else {
$this->mutations[] = $this->operation->mutation($op, $table, $data);
}
}
} | [
"private",
"function",
"enqueue",
"(",
"$",
"op",
",",
"$",
"table",
",",
"array",
"$",
"dataSet",
")",
"{",
"foreach",
"(",
"$",
"dataSet",
"as",
"$",
"data",
")",
"{",
"if",
"(",
"$",
"op",
"===",
"Operation",
"::",
"OP_DELETE",
")",
"{",
"$",
"this",
"->",
"mutations",
"[",
"]",
"=",
"$",
"this",
"->",
"operation",
"->",
"deleteMutation",
"(",
"$",
"table",
",",
"$",
"data",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"mutations",
"[",
"]",
"=",
"$",
"this",
"->",
"operation",
"->",
"mutation",
"(",
"$",
"op",
",",
"$",
"table",
",",
"$",
"data",
")",
";",
"}",
"}",
"}"
] | Format, validate and enqueue mutations in the transaction.
@param string $op The operation type.
@param string $table The table name
@param array $dataSet the mutations to enqueue
@return void | [
"Format",
"validate",
"and",
"enqueue",
"mutations",
"in",
"the",
"transaction",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Transaction.php#L586-L595 | train |
googleapis/google-cloud-php | Dataproc/src/V1/ListWorkflowTemplatesResponse.php | ListWorkflowTemplatesResponse.setTemplates | public function setTemplates($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dataproc\V1\WorkflowTemplate::class);
$this->templates = $arr;
return $this;
} | php | public function setTemplates($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dataproc\V1\WorkflowTemplate::class);
$this->templates = $arr;
return $this;
} | [
"public",
"function",
"setTemplates",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dataproc",
"\\",
"V1",
"\\",
"WorkflowTemplate",
"::",
"class",
")",
";",
"$",
"this",
"->",
"templates",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | Output only. WorkflowTemplates list.
Generated from protobuf field <code>repeated .google.cloud.dataproc.v1.WorkflowTemplate templates = 1;</code>
@param \Google\Cloud\Dataproc\V1\WorkflowTemplate[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"Output",
"only",
".",
"WorkflowTemplates",
"list",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dataproc/src/V1/ListWorkflowTemplatesResponse.php#L70-L76 | train |
googleapis/google-cloud-php | CommonProtos/src/DevTools/Source/V1/GerritSourceContext.php | GerritSourceContext.setAliasContext | public function setAliasContext($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\DevTools\Source\V1\AliasContext::class);
$this->writeOneof(5, $var);
return $this;
} | php | public function setAliasContext($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\DevTools\Source\V1\AliasContext::class);
$this->writeOneof(5, $var);
return $this;
} | [
"public",
"function",
"setAliasContext",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"DevTools",
"\\",
"Source",
"\\",
"V1",
"\\",
"AliasContext",
"::",
"class",
")",
";",
"$",
"this",
"->",
"writeOneof",
"(",
"5",
",",
"$",
"var",
")",
";",
"return",
"$",
"this",
";",
"}"
] | An alias, which may be a branch or tag.
Generated from protobuf field <code>.google.devtools.source.v1.AliasContext alias_context = 5;</code>
@param \Google\Cloud\DevTools\Source\V1\AliasContext $var
@return $this | [
"An",
"alias",
"which",
"may",
"be",
"a",
"branch",
"or",
"tag",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/CommonProtos/src/DevTools/Source/V1/GerritSourceContext.php#L185-L191 | train |
googleapis/google-cloud-php | Firestore/src/DocumentReference.php | DocumentReference.create | public function create(array $fields = [], array $options = [])
{
return $this->writeResult(
$this->batchFactory()
->create($this->name, $fields, $options)
->commit($options)
);
} | php | public function create(array $fields = [], array $options = [])
{
return $this->writeResult(
$this->batchFactory()
->create($this->name, $fields, $options)
->commit($options)
);
} | [
"public",
"function",
"create",
"(",
"array",
"$",
"fields",
"=",
"[",
"]",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"writeResult",
"(",
"$",
"this",
"->",
"batchFactory",
"(",
")",
"->",
"create",
"(",
"$",
"this",
"->",
"name",
",",
"$",
"fields",
",",
"$",
"options",
")",
"->",
"commit",
"(",
"$",
"options",
")",
")",
";",
"}"
] | Create a new document in Firestore.
If the document already exists, this method will fail.
Example:
```
$document->create([
'name' => 'John',
'country' => 'USA'
]);
```
@codingStandardsIgnoreStart
@see https://cloud.google.com/firestore/docs/reference/rpc/google.firestore.v1beta1#google.firestore.v1beta1.Firestore.Commit Commit
@param array $fields An array containing fields, where keys are the field
names, and values are field values. Nested arrays are allowed.
Note that unlike {@see Google\Cloud\Firestore\DocumentReference::update()},
field paths are NOT supported by this method.
@param array $options Configuration Options.
@return array [WriteResult](https://cloud.google.com/firestore/docs/reference/rpc/google.firestore.v1beta1#google.firestore.v1beta1.WriteResult)
@codingStandardsIgnoreEnd | [
"Create",
"a",
"new",
"document",
"in",
"Firestore",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/DocumentReference.php#L179-L186 | train |
googleapis/google-cloud-php | Firestore/src/DocumentReference.php | DocumentReference.set | public function set(array $fields, array $options = [])
{
return $this->writeResult(
$this->batchFactory()
->set($this->name, $fields, $options)
->commit($options)
);
} | php | public function set(array $fields, array $options = [])
{
return $this->writeResult(
$this->batchFactory()
->set($this->name, $fields, $options)
->commit($options)
);
} | [
"public",
"function",
"set",
"(",
"array",
"$",
"fields",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"writeResult",
"(",
"$",
"this",
"->",
"batchFactory",
"(",
")",
"->",
"set",
"(",
"$",
"this",
"->",
"name",
",",
"$",
"fields",
",",
"$",
"options",
")",
"->",
"commit",
"(",
"$",
"options",
")",
")",
";",
"}"
] | Write to a Firestore document, with optional merge behavior.
This method will create the document if it does not already exist.
Unless `$options.merge` is set to true, this method will replace all
existing document data.
Example:
```
$document->set([
'name' => 'Dave'
]);
```
@codingStandardsIgnoreStart
@see https://cloud.google.com/firestore/docs/reference/rpc/google.firestore.v1beta1#google.firestore.v1beta1.Firestore.Commit Commit
@codingStandardsIgnoreEnd
@param array $fields An array containing fields, where keys are the field
names, and values are field values. Nested arrays are allowed.
Note that unlike {@see Google\Cloud\Firestore\DocumentReference::update()},
field paths are NOT supported by this method.
@param array $options {
Configuration Options
@type bool $merge If true, unwritten fields will be preserved.
Otherwise, they will be overwritten (removed). **Defaults to**
`false`.
}
@codingStandardsIgnoreStart
@return array [WriteResult](https://cloud.google.com/firestore/docs/reference/rpc/google.firestore.v1beta1#google.firestore.v1beta1.WriteResult)
@codingStandardsIgnoreEnd | [
"Write",
"to",
"a",
"Firestore",
"document",
"with",
"optional",
"merge",
"behavior",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/DocumentReference.php#L222-L229 | train |
googleapis/google-cloud-php | Firestore/src/DocumentReference.php | DocumentReference.update | public function update(array $data, array $options = [])
{
return $this->writeResult(
$this->batchFactory()
->update($this->name, $data, $options)
->commit($options)
);
} | php | public function update(array $data, array $options = [])
{
return $this->writeResult(
$this->batchFactory()
->update($this->name, $data, $options)
->commit($options)
);
} | [
"public",
"function",
"update",
"(",
"array",
"$",
"data",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"writeResult",
"(",
"$",
"this",
"->",
"batchFactory",
"(",
")",
"->",
"update",
"(",
"$",
"this",
"->",
"name",
",",
"$",
"data",
",",
"$",
"options",
")",
"->",
"commit",
"(",
"$",
"options",
")",
")",
";",
"}"
] | Update a Firestore document using field paths and values.
Merges provided data with data stored in Firestore.
Calling this method on a non-existent document will raise an exception.
This method supports various sentinel values, to perform special operations
on fields. Available sentinel values are provided as methods, found in
{@see Google\Cloud\Firestore\FieldValue}.
Note that field names must be provided using field paths, encoded either
as a dot-delimited string (i.e. `foo.bar`), or an instance of
{@see Google\Cloud\Firestore\FieldPath}. Nested arrays are not allowed.
Please note that conflicting paths will result in an exception. Paths
conflict when one path indicates a location nested within another path.
For instance, path `a.b` cannot be set directly if path `a` is also
provided.
Example:
```
$document->update([
['path' => 'name', 'value' => 'John'],
['path' => 'country', 'value' => 'USA'],
['path' => 'cryptoCurrencies.bitcoin', 'value' => 0.5],
['path' => 'cryptoCurrencies.ethereum', 'value' => 10],
['path' => 'cryptoCurrencies.litecoin', 'value' => 5.51]
]);
```
```
// Google Cloud PHP provides special field values to enable operations such
// as deleting fields or setting the value to the current server timestamp.
use Google\Cloud\Firestore\FieldValue;
$document->update([
['path' => 'country', 'value' => FieldValue::deleteField()],
['path' => 'lastLogin', 'value' => FieldValue::serverTimestamp()]
]);
```
```
// If your field names contain special characters (such as `.`, or symbols),
// using {@see Google\Cloud\Firestore\FieldPath} will properly escape each element.
use Google\Cloud\Firestore\FieldPath;
$document->update([
['path' => new FieldPath(['cryptoCurrencies', 'big$$$coin']), 'value' => 5.51]
]);
```
@codingStandardsIgnoreStart
@see https://cloud.google.com/firestore/docs/reference/rpc/google.firestore.v1beta1#google.firestore.v1beta1.Firestore.Commit Commit
@param array[] $data A list of arrays of form
`[FieldPath|string $path, mixed $value]`.
@param array $options Configuration options
@return array [WriteResult](https://cloud.google.com/firestore/docs/reference/rpc/google.firestore.v1beta1#google.firestore.v1beta1.WriteResult)
@throws \InvalidArgumentException If data is given in an invalid format
or is empty.
@throws \InvalidArgumentException If any field paths are empty.
@throws \InvalidArgumentException If field paths conflict.
@codingStandardsIgnoreEnd | [
"Update",
"a",
"Firestore",
"document",
"using",
"field",
"paths",
"and",
"values",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/DocumentReference.php#L297-L304 | train |
googleapis/google-cloud-php | Firestore/src/DocumentReference.php | DocumentReference.snapshot | public function snapshot(array $options = [])
{
return $this->createSnapshot($this->connection, $this->valueMapper, $this, $options);
} | php | public function snapshot(array $options = [])
{
return $this->createSnapshot($this->connection, $this->valueMapper, $this, $options);
} | [
"public",
"function",
"snapshot",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"createSnapshot",
"(",
"$",
"this",
"->",
"connection",
",",
"$",
"this",
"->",
"valueMapper",
",",
"$",
"this",
",",
"$",
"options",
")",
";",
"}"
] | Get a read-only snapshot of the document.
Example:
```
$snapshot = $document->snapshot();
```
@codingStandardsIgnoreStart
@see https://cloud.google.com/firestore/docs/reference/rpc/google.firestore.v1beta1#google.firestore.v1beta1.Firestore.BatchGetDocuments BatchGetDocuments
@codingStandardsIgnoreEnd
@param array $options Configuration Options
@return DocumentSnapshot | [
"Get",
"a",
"read",
"-",
"only",
"snapshot",
"of",
"the",
"document",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/DocumentReference.php#L345-L348 | train |
googleapis/google-cloud-php | Firestore/src/DocumentReference.php | DocumentReference.collection | public function collection($collectionId)
{
return new CollectionReference(
$this->connection,
$this->valueMapper,
$this->childPath($this->name, $collectionId)
);
} | php | public function collection($collectionId)
{
return new CollectionReference(
$this->connection,
$this->valueMapper,
$this->childPath($this->name, $collectionId)
);
} | [
"public",
"function",
"collection",
"(",
"$",
"collectionId",
")",
"{",
"return",
"new",
"CollectionReference",
"(",
"$",
"this",
"->",
"connection",
",",
"$",
"this",
"->",
"valueMapper",
",",
"$",
"this",
"->",
"childPath",
"(",
"$",
"this",
"->",
"name",
",",
"$",
"collectionId",
")",
")",
";",
"}"
] | Get a reference to a collection which is a child of the current document.
Example:
```
$child = $document->collection('wallet');
```
@param string $collectionId The ID of the child collection.
@return CollectionReference | [
"Get",
"a",
"reference",
"to",
"a",
"collection",
"which",
"is",
"a",
"child",
"of",
"the",
"current",
"document",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/DocumentReference.php#L361-L368 | train |
googleapis/google-cloud-php | Firestore/src/DocumentReference.php | DocumentReference.collections | public function collections(array $options = [])
{
$resultLimit = $this->pluck('resultLimit', $options, false);
return new ItemIterator(
new PageIterator(
function ($collectionId) {
return new CollectionReference(
$this->connection,
$this->valueMapper,
$this->childPath($this->name, $collectionId)
);
},
[$this->connection, 'listCollectionIds'],
$options + ['parent' => $this->name],
[
'itemsKey' => 'collectionIds',
'resultLimit' => $resultLimit
]
)
);
} | php | public function collections(array $options = [])
{
$resultLimit = $this->pluck('resultLimit', $options, false);
return new ItemIterator(
new PageIterator(
function ($collectionId) {
return new CollectionReference(
$this->connection,
$this->valueMapper,
$this->childPath($this->name, $collectionId)
);
},
[$this->connection, 'listCollectionIds'],
$options + ['parent' => $this->name],
[
'itemsKey' => 'collectionIds',
'resultLimit' => $resultLimit
]
)
);
} | [
"public",
"function",
"collections",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"resultLimit",
"=",
"$",
"this",
"->",
"pluck",
"(",
"'resultLimit'",
",",
"$",
"options",
",",
"false",
")",
";",
"return",
"new",
"ItemIterator",
"(",
"new",
"PageIterator",
"(",
"function",
"(",
"$",
"collectionId",
")",
"{",
"return",
"new",
"CollectionReference",
"(",
"$",
"this",
"->",
"connection",
",",
"$",
"this",
"->",
"valueMapper",
",",
"$",
"this",
"->",
"childPath",
"(",
"$",
"this",
"->",
"name",
",",
"$",
"collectionId",
")",
")",
";",
"}",
",",
"[",
"$",
"this",
"->",
"connection",
",",
"'listCollectionIds'",
"]",
",",
"$",
"options",
"+",
"[",
"'parent'",
"=>",
"$",
"this",
"->",
"name",
"]",
",",
"[",
"'itemsKey'",
"=>",
"'collectionIds'",
",",
"'resultLimit'",
"=>",
"$",
"resultLimit",
"]",
")",
")",
";",
"}"
] | List all collections which are children of the current document.
Example:
```
$collections = $document->collections();
```
@codingStandardsIgnoreStart
https://cloud.google.com/firestore/docs/reference/rpc/google.firestore.v1beta1#google.firestore.v1beta1.Firestore.ListCollectionIds ListCollectionIds
@codingStandardsIgnoreEnd
@param array $options Configuration options.
@return ItemIterator<CollectionReference> | [
"List",
"all",
"collections",
"which",
"are",
"children",
"of",
"the",
"current",
"document",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/DocumentReference.php#L385-L405 | train |
googleapis/google-cloud-php | Firestore/src/DocumentReference.php | DocumentReference.batchFactory | protected function batchFactory()
{
return new WriteBatch(
$this->connection,
$this->valueMapper,
$this->databaseFromName($this->name)
);
} | php | protected function batchFactory()
{
return new WriteBatch(
$this->connection,
$this->valueMapper,
$this->databaseFromName($this->name)
);
} | [
"protected",
"function",
"batchFactory",
"(",
")",
"{",
"return",
"new",
"WriteBatch",
"(",
"$",
"this",
"->",
"connection",
",",
"$",
"this",
"->",
"valueMapper",
",",
"$",
"this",
"->",
"databaseFromName",
"(",
"$",
"this",
"->",
"name",
")",
")",
";",
"}"
] | Create a Batch Writer for single-use mutations in this class.
@return WriteBatch | [
"Create",
"a",
"Batch",
"Writer",
"for",
"single",
"-",
"use",
"mutations",
"in",
"this",
"class",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/DocumentReference.php#L412-L419 | train |
googleapis/google-cloud-php | Dataproc/src/V1beta2/Cluster.php | Cluster.setConfig | public function setConfig($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dataproc\V1beta2\ClusterConfig::class);
$this->config = $var;
return $this;
} | php | public function setConfig($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dataproc\V1beta2\ClusterConfig::class);
$this->config = $var;
return $this;
} | [
"public",
"function",
"setConfig",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dataproc",
"\\",
"V1beta2",
"\\",
"ClusterConfig",
"::",
"class",
")",
";",
"$",
"this",
"->",
"config",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Required. The cluster config. Note that Cloud Dataproc may set
default values, and values may change when clusters are updated.
Generated from protobuf field <code>.google.cloud.dataproc.v1beta2.ClusterConfig config = 3;</code>
@param \Google\Cloud\Dataproc\V1beta2\ClusterConfig $var
@return $this | [
"Required",
".",
"The",
"cluster",
"config",
".",
"Note",
"that",
"Cloud",
"Dataproc",
"may",
"set",
"default",
"values",
"and",
"values",
"may",
"change",
"when",
"clusters",
"are",
"updated",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dataproc/src/V1beta2/Cluster.php#L193-L199 | train |
googleapis/google-cloud-php | Firestore/src/V1beta1/StructuredQuery/UnaryFilter.php | UnaryFilter.setField | public function setField($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1beta1\StructuredQuery_FieldReference::class);
$this->writeOneof(2, $var);
return $this;
} | php | public function setField($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1beta1\StructuredQuery_FieldReference::class);
$this->writeOneof(2, $var);
return $this;
} | [
"public",
"function",
"setField",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Firestore",
"\\",
"V1beta1",
"\\",
"StructuredQuery_FieldReference",
"::",
"class",
")",
";",
"$",
"this",
"->",
"writeOneof",
"(",
"2",
",",
"$",
"var",
")",
";",
"return",
"$",
"this",
";",
"}"
] | The field to which to apply the operator.
Generated from protobuf field <code>.google.firestore.v1beta1.StructuredQuery.FieldReference field = 2;</code>
@param \Google\Cloud\Firestore\V1beta1\StructuredQuery\FieldReference $var
@return $this | [
"The",
"field",
"to",
"which",
"to",
"apply",
"the",
"operator",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/V1beta1/StructuredQuery/UnaryFilter.php#L87-L93 | train |
googleapis/google-cloud-php | Redis/src/V1/InputConfig.php | InputConfig.setGcsSource | public function setGcsSource($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Redis\V1\GcsSource::class);
$this->writeOneof(1, $var);
return $this;
} | php | public function setGcsSource($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Redis\V1\GcsSource::class);
$this->writeOneof(1, $var);
return $this;
} | [
"public",
"function",
"setGcsSource",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Redis",
"\\",
"V1",
"\\",
"GcsSource",
"::",
"class",
")",
";",
"$",
"this",
"->",
"writeOneof",
"(",
"1",
",",
"$",
"var",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Google Cloud Storage location where input content is located.
Generated from protobuf field <code>.google.cloud.redis.v1.GcsSource gcs_source = 1;</code>
@param \Google\Cloud\Redis\V1\GcsSource $var
@return $this | [
"Google",
"Cloud",
"Storage",
"location",
"where",
"input",
"content",
"is",
"located",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Redis/src/V1/InputConfig.php#L53-L59 | train |
googleapis/google-cloud-php | Talent/src/V4beta1/CompensationInfo/CompensationEntry.php | CompensationEntry.setRange | public function setRange($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Talent\V4beta1\CompensationInfo_CompensationRange::class);
$this->writeOneof(4, $var);
return $this;
} | php | public function setRange($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Talent\V4beta1\CompensationInfo_CompensationRange::class);
$this->writeOneof(4, $var);
return $this;
} | [
"public",
"function",
"setRange",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Talent",
"\\",
"V4beta1",
"\\",
"CompensationInfo_CompensationRange",
"::",
"class",
")",
";",
"$",
"this",
"->",
"writeOneof",
"(",
"4",
",",
"$",
"var",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Optional.
Compensation range.
Generated from protobuf field <code>.google.cloud.talent.v4beta1.CompensationInfo.CompensationRange range = 4;</code>
@param \Google\Cloud\Talent\V4beta1\CompensationInfo\CompensationRange $var
@return $this | [
"Optional",
".",
"Compensation",
"range",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Talent/src/V4beta1/CompensationInfo/CompensationEntry.php#L231-L237 | train |
googleapis/google-cloud-php | Iot/src/V1/DeviceRegistry.php | DeviceRegistry.setMqttConfig | public function setMqttConfig($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Iot\V1\MqttConfig::class);
$this->mqtt_config = $var;
return $this;
} | php | public function setMqttConfig($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Iot\V1\MqttConfig::class);
$this->mqtt_config = $var;
return $this;
} | [
"public",
"function",
"setMqttConfig",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Iot",
"\\",
"V1",
"\\",
"MqttConfig",
"::",
"class",
")",
";",
"$",
"this",
"->",
"mqtt_config",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | The MQTT configuration for this device registry.
Generated from protobuf field <code>.google.cloud.iot.v1.MqttConfig mqtt_config = 4;</code>
@param \Google\Cloud\Iot\V1\MqttConfig $var
@return $this | [
"The",
"MQTT",
"configuration",
"for",
"this",
"device",
"registry",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Iot/src/V1/DeviceRegistry.php#L296-L302 | train |
googleapis/google-cloud-php | Vision/src/V1/CreateProductSetRequest.php | CreateProductSetRequest.setProductSet | public function setProductSet($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ProductSet::class);
$this->product_set = $var;
return $this;
} | php | public function setProductSet($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ProductSet::class);
$this->product_set = $var;
return $this;
} | [
"public",
"function",
"setProductSet",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Vision",
"\\",
"V1",
"\\",
"ProductSet",
"::",
"class",
")",
";",
"$",
"this",
"->",
"product_set",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | The ProductSet to create.
Generated from protobuf field <code>.google.cloud.vision.v1.ProductSet product_set = 2;</code>
@param \Google\Cloud\Vision\V1\ProductSet $var
@return $this | [
"The",
"ProductSet",
"to",
"create",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Vision/src/V1/CreateProductSetRequest.php#L110-L116 | train |
googleapis/google-cloud-php | BigQuery/src/Table.php | Table.update | public function update(array $metadata, array $options = [])
{
$options = $this->applyEtagHeader(
$options
+ $metadata
+ $this->identity
);
if (!isset($options['etag']) && !isset($options['retries'])) {
$options['retries'] = 0;
}
return $this->info = $this->connection->patchTable($options);
} | php | public function update(array $metadata, array $options = [])
{
$options = $this->applyEtagHeader(
$options
+ $metadata
+ $this->identity
);
if (!isset($options['etag']) && !isset($options['retries'])) {
$options['retries'] = 0;
}
return $this->info = $this->connection->patchTable($options);
} | [
"public",
"function",
"update",
"(",
"array",
"$",
"metadata",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"applyEtagHeader",
"(",
"$",
"options",
"+",
"$",
"metadata",
"+",
"$",
"this",
"->",
"identity",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"options",
"[",
"'etag'",
"]",
")",
"&&",
"!",
"isset",
"(",
"$",
"options",
"[",
"'retries'",
"]",
")",
")",
"{",
"$",
"options",
"[",
"'retries'",
"]",
"=",
"0",
";",
"}",
"return",
"$",
"this",
"->",
"info",
"=",
"$",
"this",
"->",
"connection",
"->",
"patchTable",
"(",
"$",
"options",
")",
";",
"}"
] | Update the table.
Providing an `etag` key as part of `$metadata` will enable simultaneous
update protection. This is useful in preventing override of modifications
made by another user. The resource's current etag can be obtained via a
GET request on the resource.
Please note that by default the library will not automatically retry this
call on your behalf unless an `etag` is set.
Example:
```
$table->update([
'friendlyName' => 'A friendly name.'
]);
```
@see https://cloud.google.com/bigquery/docs/reference/v2/tables/patch Tables patch API documentation.
@see https://cloud.google.com/bigquery/docs/api-performance#patch Patch (Partial Update)
@param array $metadata The available options for metadata are outlined
at the [Table Resource API docs](https://cloud.google.com/bigquery/docs/reference/v2/tables#resource)
@param array $options [optional] Configuration options. | [
"Update",
"the",
"table",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/BigQuery/src/Table.php#L179-L192 | train |
googleapis/google-cloud-php | BigQuery/src/Table.php | Table.runJob | public function runJob(JobConfigurationInterface $config, array $options = [])
{
$maxRetries = $this->pluck('maxRetries', $options, false);
$job = $this->startJob($config, $options);
$job->waitUntilComplete(['maxRetries' => $maxRetries]);
return $job;
} | php | public function runJob(JobConfigurationInterface $config, array $options = [])
{
$maxRetries = $this->pluck('maxRetries', $options, false);
$job = $this->startJob($config, $options);
$job->waitUntilComplete(['maxRetries' => $maxRetries]);
return $job;
} | [
"public",
"function",
"runJob",
"(",
"JobConfigurationInterface",
"$",
"config",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"maxRetries",
"=",
"$",
"this",
"->",
"pluck",
"(",
"'maxRetries'",
",",
"$",
"options",
",",
"false",
")",
";",
"$",
"job",
"=",
"$",
"this",
"->",
"startJob",
"(",
"$",
"config",
",",
"$",
"options",
")",
";",
"$",
"job",
"->",
"waitUntilComplete",
"(",
"[",
"'maxRetries'",
"=>",
"$",
"maxRetries",
"]",
")",
";",
"return",
"$",
"job",
";",
"}"
] | Starts a job in an synchronous fashion, waiting for the job to complete
before returning.
Example:
```
$job = $table->runJob($jobConfig);
echo $job->isComplete(); // true
```
@see https://cloud.google.com/bigquery/docs/reference/v2/jobs Jobs insert API Documentation.
@param JobConfigurationInterface $config The job configuration.
@param array $options [optional] {
Configuration options.
@type int $maxRetries The number of times to retry, checking if the
job has completed. **Defaults to** `100`.
}
@return Job | [
"Starts",
"a",
"job",
"in",
"an",
"synchronous",
"fashion",
"waiting",
"for",
"the",
"job",
"to",
"complete",
"before",
"returning",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/BigQuery/src/Table.php#L279-L286 | train |
googleapis/google-cloud-php | BigQuery/src/Table.php | Table.startJob | public function startJob(JobConfigurationInterface $config, array $options = [])
{
$response = null;
$config = $config->toArray() + $options;
if (isset($config['data'])) {
$response = $this->connection->insertJobUpload($config)->upload();
} else {
$response = $this->connection->insertJob($config);
}
return new Job(
$this->connection,
$config['jobReference']['jobId'],
$this->identity['projectId'],
$this->mapper,
$response
);
} | php | public function startJob(JobConfigurationInterface $config, array $options = [])
{
$response = null;
$config = $config->toArray() + $options;
if (isset($config['data'])) {
$response = $this->connection->insertJobUpload($config)->upload();
} else {
$response = $this->connection->insertJob($config);
}
return new Job(
$this->connection,
$config['jobReference']['jobId'],
$this->identity['projectId'],
$this->mapper,
$response
);
} | [
"public",
"function",
"startJob",
"(",
"JobConfigurationInterface",
"$",
"config",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"null",
";",
"$",
"config",
"=",
"$",
"config",
"->",
"toArray",
"(",
")",
"+",
"$",
"options",
";",
"if",
"(",
"isset",
"(",
"$",
"config",
"[",
"'data'",
"]",
")",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"connection",
"->",
"insertJobUpload",
"(",
"$",
"config",
")",
"->",
"upload",
"(",
")",
";",
"}",
"else",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"connection",
"->",
"insertJob",
"(",
"$",
"config",
")",
";",
"}",
"return",
"new",
"Job",
"(",
"$",
"this",
"->",
"connection",
",",
"$",
"config",
"[",
"'jobReference'",
"]",
"[",
"'jobId'",
"]",
",",
"$",
"this",
"->",
"identity",
"[",
"'projectId'",
"]",
",",
"$",
"this",
"->",
"mapper",
",",
"$",
"response",
")",
";",
"}"
] | Starts a job in an asynchronous fashion. In this case, it will be
required to manually trigger a call to wait for job completion.
Example:
```
$job = $table->startJob($jobConfig);
```
@see https://cloud.google.com/bigquery/docs/reference/v2/jobs Jobs insert API Documentation.
@param JobConfigurationInterface $config The job configuration.
@param array $options [optional] Configuration options.
@return Job | [
"Starts",
"a",
"job",
"in",
"an",
"asynchronous",
"fashion",
".",
"In",
"this",
"case",
"it",
"will",
"be",
"required",
"to",
"manually",
"trigger",
"a",
"call",
"to",
"wait",
"for",
"job",
"completion",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/BigQuery/src/Table.php#L303-L321 | train |
googleapis/google-cloud-php | BigQuery/src/Table.php | Table.insertRow | public function insertRow(array $row, array $options = [])
{
$row = ['data' => $row];
if (isset($options['insertId'])) {
$row['insertId'] = $options['insertId'];
unset($options['insertId']);
}
return $this->insertRows([$row], $options);
} | php | public function insertRow(array $row, array $options = [])
{
$row = ['data' => $row];
if (isset($options['insertId'])) {
$row['insertId'] = $options['insertId'];
unset($options['insertId']);
}
return $this->insertRows([$row], $options);
} | [
"public",
"function",
"insertRow",
"(",
"array",
"$",
"row",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"row",
"=",
"[",
"'data'",
"=>",
"$",
"row",
"]",
";",
"if",
"(",
"isset",
"(",
"$",
"options",
"[",
"'insertId'",
"]",
")",
")",
"{",
"$",
"row",
"[",
"'insertId'",
"]",
"=",
"$",
"options",
"[",
"'insertId'",
"]",
";",
"unset",
"(",
"$",
"options",
"[",
"'insertId'",
"]",
")",
";",
"}",
"return",
"$",
"this",
"->",
"insertRows",
"(",
"[",
"$",
"row",
"]",
",",
"$",
"options",
")",
";",
"}"
] | Insert a record into the table without running a load job.
Please note that by default the library will not automatically retry this
call on your behalf unless an `insertId` is set.
Example:
```
$row = [
'city' => 'Detroit',
'state' => 'MI'
];
$insertResponse = $table->insertRow($row, [
'insertId' => '1'
]);
if (!$insertResponse->isSuccessful()) {
$row = $insertResponse->failedRows()[0];
print_r($row['rowData']);
foreach ($row['errors'] as $error) {
echo $error['reason'] . ': ' . $error['message'] . PHP_EOL;
}
}
```
@codingStandardsIgnoreStart
@see https://cloud.google.com/bigquery/docs/reference/v2/tabledata/insertAll Tabledata insertAll API Documentation.
@see https://cloud.google.com/bigquery/streaming-data-into-bigquery Streaming data into BigQuery.
@param array $row Key/value set of data matching the table's schema.
@param array $options [optional] {
Please see
{@see Google\Cloud\BigQuery\Table::insertRows()} for the
other available configuration options.
@type string $insertId Used to
[ensure data consistency](https://cloud.google.com/bigquery/streaming-data-into-bigquery#dataconsistency).
}
@return InsertResponse
@throws \InvalidArgumentException
@codingStandardsIgnoreEnd | [
"Insert",
"a",
"record",
"into",
"the",
"table",
"without",
"running",
"a",
"load",
"job",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/BigQuery/src/Table.php#L524-L534 | train |
googleapis/google-cloud-php | BigQuery/src/Table.php | Table.insertRows | public function insertRows(array $rows, array $options = [])
{
if (count($rows) === 0) {
throw new \InvalidArgumentException('Must provide at least a single row.');
}
foreach ($rows as $row) {
if (!isset($row['data'])) {
throw new \InvalidArgumentException('A row must have a data key.');
}
if (!isset($options['retries']) && !isset($row['insertId'])) {
$options['retries'] = 0;
}
foreach ($row['data'] as $key => $item) {
$row['data'][$key] = $this->mapper->toBigQuery($item);
}
$row['json'] = $row['data'];
unset($row['data']);
$options['rows'][] = $row;
}
return new InsertResponse(
$this->handleInsert($options),
$options['rows']
);
} | php | public function insertRows(array $rows, array $options = [])
{
if (count($rows) === 0) {
throw new \InvalidArgumentException('Must provide at least a single row.');
}
foreach ($rows as $row) {
if (!isset($row['data'])) {
throw new \InvalidArgumentException('A row must have a data key.');
}
if (!isset($options['retries']) && !isset($row['insertId'])) {
$options['retries'] = 0;
}
foreach ($row['data'] as $key => $item) {
$row['data'][$key] = $this->mapper->toBigQuery($item);
}
$row['json'] = $row['data'];
unset($row['data']);
$options['rows'][] = $row;
}
return new InsertResponse(
$this->handleInsert($options),
$options['rows']
);
} | [
"public",
"function",
"insertRows",
"(",
"array",
"$",
"rows",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"rows",
")",
"===",
"0",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Must provide at least a single row.'",
")",
";",
"}",
"foreach",
"(",
"$",
"rows",
"as",
"$",
"row",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"row",
"[",
"'data'",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'A row must have a data key.'",
")",
";",
"}",
"if",
"(",
"!",
"isset",
"(",
"$",
"options",
"[",
"'retries'",
"]",
")",
"&&",
"!",
"isset",
"(",
"$",
"row",
"[",
"'insertId'",
"]",
")",
")",
"{",
"$",
"options",
"[",
"'retries'",
"]",
"=",
"0",
";",
"}",
"foreach",
"(",
"$",
"row",
"[",
"'data'",
"]",
"as",
"$",
"key",
"=>",
"$",
"item",
")",
"{",
"$",
"row",
"[",
"'data'",
"]",
"[",
"$",
"key",
"]",
"=",
"$",
"this",
"->",
"mapper",
"->",
"toBigQuery",
"(",
"$",
"item",
")",
";",
"}",
"$",
"row",
"[",
"'json'",
"]",
"=",
"$",
"row",
"[",
"'data'",
"]",
";",
"unset",
"(",
"$",
"row",
"[",
"'data'",
"]",
")",
";",
"$",
"options",
"[",
"'rows'",
"]",
"[",
"]",
"=",
"$",
"row",
";",
"}",
"return",
"new",
"InsertResponse",
"(",
"$",
"this",
"->",
"handleInsert",
"(",
"$",
"options",
")",
",",
"$",
"options",
"[",
"'rows'",
"]",
")",
";",
"}"
] | Insert records into the table without running a load job.
Please note that by default the library will not automatically retry this
call on your behalf unless an `insertId` is set.
Example:
```
$rows = [
[
'insertId' => '1',
'data' => [
'city' => 'Detroit',
'state' => 'MI'
]
],
[
'insertId' => '2',
'data' => [
'city' => 'New York',
'state' => 'NY'
]
]
];
$insertResponse = $table->insertRows($rows);
if (!$insertResponse->isSuccessful()) {
foreach ($insertResponse->failedRows() as $row) {
print_r($row['rowData']);
foreach ($row['errors'] as $error) {
echo $error['reason'] . ': ' . $error['message'] . PHP_EOL;
}
}
}
```
@codingStandardsIgnoreStart
@see https://cloud.google.com/bigquery/docs/reference/v2/tabledata/insertAll Tabledata insertAll API Documentation.
@see https://cloud.google.com/bigquery/streaming-data-into-bigquery Streaming data into BigQuery.
@param array $rows The rows to insert. Each item in the array must
contain a `data` key which is to hold a key/value array with data
matching the schema of the table. Optionally, one may also provide
an `insertId` key which will be used to
[ensure data consistency](https://cloud.google.com/bigquery/streaming-data-into-bigquery#dataconsistency).
@param array $options [optional] {
Configuration options.
@type bool $autoCreate Whether or not to attempt to automatically
create the table in the case it does not exist. Please note, it
will be required to provide a schema through
$tableMetadata['schema'] in the case the table does not already
exist. **Defaults to** `false`.
@type array $tableMetadata Metadata to apply to table to be created. The
full set of metadata are outlined at the
[Table Resource API docs](https://cloud.google.com/bigquery/docs/reference/v2/tables#resource).
Only applies when `autoCreate` is `true`.
@type int $maxRetries The maximum number of times to attempt creating the
table in the case of failure. Please note, each retry attempt
may take up to two minutes. Only applies when `autoCreate` is
`true`. **Defaults to** `100`.
@type bool $skipInvalidRows Insert all valid rows of a request, even
if invalid rows exist. The default value is `false`, which
causes the entire request to fail if any invalid rows exist.
**Defaults to** `false`.
@type bool $ignoreUnknownValues Accept rows that contain values that
do not match the schema. The unknown values are ignored.
The default value is `false`, which treats unknown values as errors.
**Defaults to** `false`.
@type string $templateSuffix If specified, treats the destination
table as a base template, and inserts the rows into an instance
table named "{destination}{templateSuffix}". BigQuery will
manage creation of the instance table, using the schema of the
base template table. See
[Creating tables automatically using template tables](https://cloud.google.com/bigquery/streaming-data-into-bigquery#template-tables)
for considerations when working with templates tables.
}
@return InsertResponse
@throws \InvalidArgumentException If a provided row does not contain a
`data` key, if a schema is not defined when `autoCreate` is
`true`, or if less than 1 row is provided.
@codingStandardsIgnoreEnd | [
"Insert",
"records",
"into",
"the",
"table",
"without",
"running",
"a",
"load",
"job",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/BigQuery/src/Table.php#L621-L649 | train |
googleapis/google-cloud-php | BigQuery/src/Table.php | Table.reload | public function reload(array $options = [])
{
return $this->info = $this->connection->getTable($options + $this->identity);
} | php | public function reload(array $options = [])
{
return $this->info = $this->connection->getTable($options + $this->identity);
} | [
"public",
"function",
"reload",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"info",
"=",
"$",
"this",
"->",
"connection",
"->",
"getTable",
"(",
"$",
"options",
"+",
"$",
"this",
"->",
"identity",
")",
";",
"}"
] | Triggers a network request to reload the table's details.
Example:
```
$table->reload();
$info = $table->info();
echo $info['selfLink'];
```
@see https://cloud.google.com/bigquery/docs/reference/v2/tables/get Tables get API documentation.
@param array $options [optional] Configuration options.
@return array | [
"Triggers",
"a",
"network",
"request",
"to",
"reload",
"the",
"table",
"s",
"details",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/BigQuery/src/Table.php#L690-L693 | train |
googleapis/google-cloud-php | BigQuery/src/Table.php | Table.handleInsert | private function handleInsert(array $options)
{
$attempt = 0;
$metadata = $this->pluck('tableMetadata', $options, false) ?: [];
$autoCreate = $this->pluck('autoCreate', $options, false) ?: false;
$maxRetries = $this->pluck('maxRetries', $options, false) ?: self::MAX_RETRIES;
while (true) {
try {
return $this->connection->insertAllTableData(
$this->identity + $options
);
} catch (NotFoundException $ex) {
if ($autoCreate === true && $attempt <= $maxRetries) {
if (!isset($metadata['schema'])) {
throw new \InvalidArgumentException(
'A schema is required when creating a table.'
);
}
$this->usleep(mt_rand(1, self::INSERT_CREATE_MAX_DELAY_MICROSECONDS));
try {
$this->connection->insertTable($metadata + [
'projectId' => $this->identity['projectId'],
'datasetId' => $this->identity['datasetId'],
'tableReference' => $this->identity,
'retries' => 0
]);
} catch (ConflictException $ex) {
} catch (\Exception $ex) {
$retryFunction = $this->getRetryFunction();
if (!$retryFunction($ex)) {
throw $ex;
}
}
$this->usleep(self::INSERT_CREATE_MAX_DELAY_MICROSECONDS);
$attempt++;
} else {
throw $ex;
}
}
}
} | php | private function handleInsert(array $options)
{
$attempt = 0;
$metadata = $this->pluck('tableMetadata', $options, false) ?: [];
$autoCreate = $this->pluck('autoCreate', $options, false) ?: false;
$maxRetries = $this->pluck('maxRetries', $options, false) ?: self::MAX_RETRIES;
while (true) {
try {
return $this->connection->insertAllTableData(
$this->identity + $options
);
} catch (NotFoundException $ex) {
if ($autoCreate === true && $attempt <= $maxRetries) {
if (!isset($metadata['schema'])) {
throw new \InvalidArgumentException(
'A schema is required when creating a table.'
);
}
$this->usleep(mt_rand(1, self::INSERT_CREATE_MAX_DELAY_MICROSECONDS));
try {
$this->connection->insertTable($metadata + [
'projectId' => $this->identity['projectId'],
'datasetId' => $this->identity['datasetId'],
'tableReference' => $this->identity,
'retries' => 0
]);
} catch (ConflictException $ex) {
} catch (\Exception $ex) {
$retryFunction = $this->getRetryFunction();
if (!$retryFunction($ex)) {
throw $ex;
}
}
$this->usleep(self::INSERT_CREATE_MAX_DELAY_MICROSECONDS);
$attempt++;
} else {
throw $ex;
}
}
}
} | [
"private",
"function",
"handleInsert",
"(",
"array",
"$",
"options",
")",
"{",
"$",
"attempt",
"=",
"0",
";",
"$",
"metadata",
"=",
"$",
"this",
"->",
"pluck",
"(",
"'tableMetadata'",
",",
"$",
"options",
",",
"false",
")",
"?",
":",
"[",
"]",
";",
"$",
"autoCreate",
"=",
"$",
"this",
"->",
"pluck",
"(",
"'autoCreate'",
",",
"$",
"options",
",",
"false",
")",
"?",
":",
"false",
";",
"$",
"maxRetries",
"=",
"$",
"this",
"->",
"pluck",
"(",
"'maxRetries'",
",",
"$",
"options",
",",
"false",
")",
"?",
":",
"self",
"::",
"MAX_RETRIES",
";",
"while",
"(",
"true",
")",
"{",
"try",
"{",
"return",
"$",
"this",
"->",
"connection",
"->",
"insertAllTableData",
"(",
"$",
"this",
"->",
"identity",
"+",
"$",
"options",
")",
";",
"}",
"catch",
"(",
"NotFoundException",
"$",
"ex",
")",
"{",
"if",
"(",
"$",
"autoCreate",
"===",
"true",
"&&",
"$",
"attempt",
"<=",
"$",
"maxRetries",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"metadata",
"[",
"'schema'",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'A schema is required when creating a table.'",
")",
";",
"}",
"$",
"this",
"->",
"usleep",
"(",
"mt_rand",
"(",
"1",
",",
"self",
"::",
"INSERT_CREATE_MAX_DELAY_MICROSECONDS",
")",
")",
";",
"try",
"{",
"$",
"this",
"->",
"connection",
"->",
"insertTable",
"(",
"$",
"metadata",
"+",
"[",
"'projectId'",
"=>",
"$",
"this",
"->",
"identity",
"[",
"'projectId'",
"]",
",",
"'datasetId'",
"=>",
"$",
"this",
"->",
"identity",
"[",
"'datasetId'",
"]",
",",
"'tableReference'",
"=>",
"$",
"this",
"->",
"identity",
",",
"'retries'",
"=>",
"0",
"]",
")",
";",
"}",
"catch",
"(",
"ConflictException",
"$",
"ex",
")",
"{",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"ex",
")",
"{",
"$",
"retryFunction",
"=",
"$",
"this",
"->",
"getRetryFunction",
"(",
")",
";",
"if",
"(",
"!",
"$",
"retryFunction",
"(",
"$",
"ex",
")",
")",
"{",
"throw",
"$",
"ex",
";",
"}",
"}",
"$",
"this",
"->",
"usleep",
"(",
"self",
"::",
"INSERT_CREATE_MAX_DELAY_MICROSECONDS",
")",
";",
"$",
"attempt",
"++",
";",
"}",
"else",
"{",
"throw",
"$",
"ex",
";",
"}",
"}",
"}",
"}"
] | Handles inserting table data and manages custom retry logic in the case
a table needs to be created.
@param array $options Configuration options.
@return array | [
"Handles",
"inserting",
"table",
"data",
"and",
"manages",
"custom",
"retry",
"logic",
"in",
"the",
"case",
"a",
"table",
"needs",
"to",
"be",
"created",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/BigQuery/src/Table.php#L744-L789 | train |
googleapis/google-cloud-php | Monitoring/src/V3/ListGroupMembersResponse.php | ListGroupMembersResponse.setMembers | public function setMembers($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\MonitoredResource::class);
$this->members = $arr;
return $this;
} | php | public function setMembers($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\MonitoredResource::class);
$this->members = $arr;
return $this;
} | [
"public",
"function",
"setMembers",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Api",
"\\",
"MonitoredResource",
"::",
"class",
")",
";",
"$",
"this",
"->",
"members",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | A set of monitored resources in the group.
Generated from protobuf field <code>repeated .google.api.MonitoredResource members = 1;</code>
@param \Google\Api\MonitoredResource[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"A",
"set",
"of",
"monitored",
"resources",
"in",
"the",
"group",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Monitoring/src/V3/ListGroupMembersResponse.php#L78-L84 | train |
googleapis/google-cloud-php | BigQueryDataTransfer/src/V1/DataSourceParameter.php | DataSourceParameter.setType | public function setType($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\BigQuery\DataTransfer\V1\DataSourceParameter_Type::class);
$this->type = $var;
return $this;
} | php | public function setType($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\BigQuery\DataTransfer\V1\DataSourceParameter_Type::class);
$this->type = $var;
return $this;
} | [
"public",
"function",
"setType",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"BigQuery",
"\\",
"DataTransfer",
"\\",
"V1",
"\\",
"DataSourceParameter_Type",
"::",
"class",
")",
";",
"$",
"this",
"->",
"type",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Parameter type.
Generated from protobuf field <code>.google.cloud.bigquery.datatransfer.v1.DataSourceParameter.Type type = 4;</code>
@param int $var
@return $this | [
"Parameter",
"type",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/BigQueryDataTransfer/src/V1/DataSourceParameter.php#L257-L263 | train |
googleapis/google-cloud-php | BigQueryDataTransfer/src/V1/DataSourceParameter.php | DataSourceParameter.setAllowedValues | public function setAllowedValues($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->allowed_values = $arr;
return $this;
} | php | public function setAllowedValues($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->allowed_values = $arr;
return $this;
} | [
"public",
"function",
"setAllowedValues",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"STRING",
")",
";",
"$",
"this",
"->",
"allowed_values",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | All possible values for the parameter.
Generated from protobuf field <code>repeated string allowed_values = 8;</code>
@param string[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"All",
"possible",
"values",
"for",
"the",
"parameter",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/BigQueryDataTransfer/src/V1/DataSourceParameter.php#L361-L367 | train |
googleapis/google-cloud-php | BigQueryDataTransfer/src/V1/DataSourceParameter.php | DataSourceParameter.setFields | public function setFields($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\BigQuery\DataTransfer\V1\DataSourceParameter::class);
$this->fields = $arr;
return $this;
} | php | public function setFields($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\BigQuery\DataTransfer\V1\DataSourceParameter::class);
$this->fields = $arr;
return $this;
} | [
"public",
"function",
"setFields",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"BigQuery",
"\\",
"DataTransfer",
"\\",
"V1",
"\\",
"DataSourceParameter",
"::",
"class",
")",
";",
"$",
"this",
"->",
"fields",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | When parameter is a record, describes child fields.
Generated from protobuf field <code>repeated .google.cloud.bigquery.datatransfer.v1.DataSourceParameter fields = 11;</code>
@param \Google\Cloud\BigQuery\DataTransfer\V1\DataSourceParameter[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"When",
"parameter",
"is",
"a",
"record",
"describes",
"child",
"fields",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/BigQueryDataTransfer/src/V1/DataSourceParameter.php#L497-L503 | train |
googleapis/google-cloud-php | Debugger/src/DebuggerClient.php | DebuggerClient.debuggees | public function debuggees(array $extras = [])
{
$res = $this->connection->listDebuggees(['project' => $this->projectId] + $extras);
if (is_array($res) && array_key_exists('debuggees', $res)) {
return array_map(function ($info) {
return new Debuggee($this->connection, $info);
}, $res['debuggees']);
}
return [];
} | php | public function debuggees(array $extras = [])
{
$res = $this->connection->listDebuggees(['project' => $this->projectId] + $extras);
if (is_array($res) && array_key_exists('debuggees', $res)) {
return array_map(function ($info) {
return new Debuggee($this->connection, $info);
}, $res['debuggees']);
}
return [];
} | [
"public",
"function",
"debuggees",
"(",
"array",
"$",
"extras",
"=",
"[",
"]",
")",
"{",
"$",
"res",
"=",
"$",
"this",
"->",
"connection",
"->",
"listDebuggees",
"(",
"[",
"'project'",
"=>",
"$",
"this",
"->",
"projectId",
"]",
"+",
"$",
"extras",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"res",
")",
"&&",
"array_key_exists",
"(",
"'debuggees'",
",",
"$",
"res",
")",
")",
"{",
"return",
"array_map",
"(",
"function",
"(",
"$",
"info",
")",
"{",
"return",
"new",
"Debuggee",
"(",
"$",
"this",
"->",
"connection",
",",
"$",
"info",
")",
";",
"}",
",",
"$",
"res",
"[",
"'debuggees'",
"]",
")",
";",
"}",
"return",
"[",
"]",
";",
"}"
] | Fetches all the debuggees in the project.
Example:
```
$debuggees = $client->debuggees();
```
@return Debuggee[] | [
"Fetches",
"all",
"the",
"debuggees",
"in",
"the",
"project",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Debugger/src/DebuggerClient.php#L157-L166 | train |
googleapis/google-cloud-php | Datastore/src/V1/Projection.php | Projection.setProperty | public function setProperty($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Datastore\V1\PropertyReference::class);
$this->property = $var;
return $this;
} | php | public function setProperty($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Datastore\V1\PropertyReference::class);
$this->property = $var;
return $this;
} | [
"public",
"function",
"setProperty",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Datastore",
"\\",
"V1",
"\\",
"PropertyReference",
"::",
"class",
")",
";",
"$",
"this",
"->",
"property",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | The property to project.
Generated from protobuf field <code>.google.datastore.v1.PropertyReference property = 1;</code>
@param \Google\Cloud\Datastore\V1\PropertyReference $var
@return $this | [
"The",
"property",
"to",
"project",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Datastore/src/V1/Projection.php#L58-L64 | train |
googleapis/google-cloud-php | Firestore/src/V1beta1/CommitResponse.php | CommitResponse.setWriteResults | public function setWriteResults($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Firestore\V1beta1\WriteResult::class);
$this->write_results = $arr;
return $this;
} | php | public function setWriteResults($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Firestore\V1beta1\WriteResult::class);
$this->write_results = $arr;
return $this;
} | [
"public",
"function",
"setWriteResults",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Firestore",
"\\",
"V1beta1",
"\\",
"WriteResult",
"::",
"class",
")",
";",
"$",
"this",
"->",
"write_results",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | The result of applying the writes.
This i-th write result corresponds to the i-th write in the
request.
Generated from protobuf field <code>repeated .google.firestore.v1beta1.WriteResult write_results = 1;</code>
@param \Google\Cloud\Firestore\V1beta1\WriteResult[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"The",
"result",
"of",
"applying",
"the",
"writes",
".",
"This",
"i",
"-",
"th",
"write",
"result",
"corresponds",
"to",
"the",
"i",
"-",
"th",
"write",
"in",
"the",
"request",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/V1beta1/CommitResponse.php#L74-L80 | train |
googleapis/google-cloud-php | Debugger/src/Agent.php | Agent.handleSnapshot | public function handleSnapshot(array $snapshot)
{
if (array_key_exists($snapshot['id'], $this->breakpointsById)) {
$breakpoint = $this->breakpointsById[$snapshot['id']];
$evaluatedExpressions = $snapshot['evaluatedExpressions'];
$stackframes = $snapshot['stackframes'];
$breakpoint->evaluate($evaluatedExpressions, $stackframes, $this->evaluationOptions);
$this->batchRunner->submitItem($this->identifier, [$this->debuggeeId, $breakpoint]);
}
} | php | public function handleSnapshot(array $snapshot)
{
if (array_key_exists($snapshot['id'], $this->breakpointsById)) {
$breakpoint = $this->breakpointsById[$snapshot['id']];
$evaluatedExpressions = $snapshot['evaluatedExpressions'];
$stackframes = $snapshot['stackframes'];
$breakpoint->evaluate($evaluatedExpressions, $stackframes, $this->evaluationOptions);
$this->batchRunner->submitItem($this->identifier, [$this->debuggeeId, $breakpoint]);
}
} | [
"public",
"function",
"handleSnapshot",
"(",
"array",
"$",
"snapshot",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"snapshot",
"[",
"'id'",
"]",
",",
"$",
"this",
"->",
"breakpointsById",
")",
")",
"{",
"$",
"breakpoint",
"=",
"$",
"this",
"->",
"breakpointsById",
"[",
"$",
"snapshot",
"[",
"'id'",
"]",
"]",
";",
"$",
"evaluatedExpressions",
"=",
"$",
"snapshot",
"[",
"'evaluatedExpressions'",
"]",
";",
"$",
"stackframes",
"=",
"$",
"snapshot",
"[",
"'stackframes'",
"]",
";",
"$",
"breakpoint",
"->",
"evaluate",
"(",
"$",
"evaluatedExpressions",
",",
"$",
"stackframes",
",",
"$",
"this",
"->",
"evaluationOptions",
")",
";",
"$",
"this",
"->",
"batchRunner",
"->",
"submitItem",
"(",
"$",
"this",
"->",
"identifier",
",",
"[",
"$",
"this",
"->",
"debuggeeId",
",",
"$",
"breakpoint",
"]",
")",
";",
"}",
"}"
] | Callback for reporting a snapshot.
@access private
@param array $snapshot {
Snapshot data
@type string $id The breakpoint id of the snapshot
@type array $evaluatedExpressions The results of evaluating the
snapshot's expressions
@type array $stackframes List of captured stackframe data.
} | [
"Callback",
"for",
"reporting",
"a",
"snapshot",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Debugger/src/Agent.php#L228-L237 | train |
googleapis/google-cloud-php | Debugger/src/Agent.php | Agent.reportBreakpoints | public function reportBreakpoints(array $breakpointsInfo)
{
$client = $this->defaultClient();
foreach ($breakpointsInfo as $breakpointInfo) {
list($debuggeeId, $breakpoint) = $breakpointInfo;
$debuggee = $client->debuggee($debuggeeId);
$backoff = new ExponentialBackoff();
try {
$backoff->execute(function () use ($breakpoint, $debuggee) {
$debuggee->updateBreakpoint($breakpoint);
});
} catch (ServiceException $e) {
// Ignore this error for now
}
}
} | php | public function reportBreakpoints(array $breakpointsInfo)
{
$client = $this->defaultClient();
foreach ($breakpointsInfo as $breakpointInfo) {
list($debuggeeId, $breakpoint) = $breakpointInfo;
$debuggee = $client->debuggee($debuggeeId);
$backoff = new ExponentialBackoff();
try {
$backoff->execute(function () use ($breakpoint, $debuggee) {
$debuggee->updateBreakpoint($breakpoint);
});
} catch (ServiceException $e) {
// Ignore this error for now
}
}
} | [
"public",
"function",
"reportBreakpoints",
"(",
"array",
"$",
"breakpointsInfo",
")",
"{",
"$",
"client",
"=",
"$",
"this",
"->",
"defaultClient",
"(",
")",
";",
"foreach",
"(",
"$",
"breakpointsInfo",
"as",
"$",
"breakpointInfo",
")",
"{",
"list",
"(",
"$",
"debuggeeId",
",",
"$",
"breakpoint",
")",
"=",
"$",
"breakpointInfo",
";",
"$",
"debuggee",
"=",
"$",
"client",
"->",
"debuggee",
"(",
"$",
"debuggeeId",
")",
";",
"$",
"backoff",
"=",
"new",
"ExponentialBackoff",
"(",
")",
";",
"try",
"{",
"$",
"backoff",
"->",
"execute",
"(",
"function",
"(",
")",
"use",
"(",
"$",
"breakpoint",
",",
"$",
"debuggee",
")",
"{",
"$",
"debuggee",
"->",
"updateBreakpoint",
"(",
"$",
"breakpoint",
")",
";",
"}",
")",
";",
"}",
"catch",
"(",
"ServiceException",
"$",
"e",
")",
"{",
"// Ignore this error for now",
"}",
"}",
"}"
] | Callback for batch runner to report a breakpoint.
@access private
@param array $breakpointsInfo | [
"Callback",
"for",
"batch",
"runner",
"to",
"report",
"a",
"breakpoint",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Debugger/src/Agent.php#L259-L275 | train |
googleapis/google-cloud-php | Dialogflow/src/V2/Intent/Message/QuickReplies.php | QuickReplies.setQuickReplies | public function setQuickReplies($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->quick_replies = $arr;
return $this;
} | php | public function setQuickReplies($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->quick_replies = $arr;
return $this;
} | [
"public",
"function",
"setQuickReplies",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"STRING",
")",
";",
"$",
"this",
"->",
"quick_replies",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | Optional. The collection of quick replies.
Generated from protobuf field <code>repeated string quick_replies = 2;</code>
@param string[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"Optional",
".",
"The",
"collection",
"of",
"quick",
"replies",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dialogflow/src/V2/Intent/Message/QuickReplies.php#L92-L98 | train |
googleapis/google-cloud-php | Trace/src/TraceClient.php | TraceClient.insertBatch | public function insertBatch(array $traces, array $options = [])
{
$spans = [];
foreach ($traces as $trace) {
foreach ($trace->spans() as $span) {
$spans[] = $this->transformSpan($span);
}
}
// throws ServiceException on failure
$this->connection->traceBatchWrite([
'projectsId' => $this->projectId,
'spans' => $spans
] + $options);
return true;
} | php | public function insertBatch(array $traces, array $options = [])
{
$spans = [];
foreach ($traces as $trace) {
foreach ($trace->spans() as $span) {
$spans[] = $this->transformSpan($span);
}
}
// throws ServiceException on failure
$this->connection->traceBatchWrite([
'projectsId' => $this->projectId,
'spans' => $spans
] + $options);
return true;
} | [
"public",
"function",
"insertBatch",
"(",
"array",
"$",
"traces",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"spans",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"traces",
"as",
"$",
"trace",
")",
"{",
"foreach",
"(",
"$",
"trace",
"->",
"spans",
"(",
")",
"as",
"$",
"span",
")",
"{",
"$",
"spans",
"[",
"]",
"=",
"$",
"this",
"->",
"transformSpan",
"(",
"$",
"span",
")",
";",
"}",
"}",
"// throws ServiceException on failure",
"$",
"this",
"->",
"connection",
"->",
"traceBatchWrite",
"(",
"[",
"'projectsId'",
"=>",
"$",
"this",
"->",
"projectId",
",",
"'spans'",
"=>",
"$",
"spans",
"]",
"+",
"$",
"options",
")",
";",
"return",
"true",
";",
"}"
] | Sends multiple Trace logs in a simple fashion.
Example:
```
$trace = $traceClient->trace();
$result = $traceClient->insertBatch([$trace]);
```
@codingStandardsIgnoreStart
@see https://cloud.google.com/trace/docs/reference/v1/rest/v1/projects/patchTraces Project patchTraces API documentation.
@codingStandardsIgnoreEnd
@param Trace[] $traces The trace logs to send.
@param array $options [optional] Configuration Options
@return bool | [
"Sends",
"multiple",
"Trace",
"logs",
"in",
"a",
"simple",
"fashion",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Trace/src/TraceClient.php#L144-L158 | train |
googleapis/google-cloud-php | Dataproc/src/V1/ClusterConfig.php | ClusterConfig.setGceClusterConfig | public function setGceClusterConfig($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dataproc\V1\GceClusterConfig::class);
$this->gce_cluster_config = $var;
return $this;
} | php | public function setGceClusterConfig($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dataproc\V1\GceClusterConfig::class);
$this->gce_cluster_config = $var;
return $this;
} | [
"public",
"function",
"setGceClusterConfig",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dataproc",
"\\",
"V1",
"\\",
"GceClusterConfig",
"::",
"class",
")",
";",
"$",
"this",
"->",
"gce_cluster_config",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Required. The shared Compute Engine config settings for
all instances in a cluster.
Generated from protobuf field <code>.google.cloud.dataproc.v1.GceClusterConfig gce_cluster_config = 8;</code>
@param \Google\Cloud\Dataproc\V1\GceClusterConfig $var
@return $this | [
"Required",
".",
"The",
"shared",
"Compute",
"Engine",
"config",
"settings",
"for",
"all",
"instances",
"in",
"a",
"cluster",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dataproc/src/V1/ClusterConfig.php#L192-L198 | train |
googleapis/google-cloud-php | Dataproc/src/V1/ClusterConfig.php | ClusterConfig.setMasterConfig | public function setMasterConfig($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dataproc\V1\InstanceGroupConfig::class);
$this->master_config = $var;
return $this;
} | php | public function setMasterConfig($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dataproc\V1\InstanceGroupConfig::class);
$this->master_config = $var;
return $this;
} | [
"public",
"function",
"setMasterConfig",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dataproc",
"\\",
"V1",
"\\",
"InstanceGroupConfig",
"::",
"class",
")",
";",
"$",
"this",
"->",
"master_config",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Optional. The Compute Engine config settings for
the master instance in a cluster.
Generated from protobuf field <code>.google.cloud.dataproc.v1.InstanceGroupConfig master_config = 9;</code>
@param \Google\Cloud\Dataproc\V1\InstanceGroupConfig $var
@return $this | [
"Optional",
".",
"The",
"Compute",
"Engine",
"config",
"settings",
"for",
"the",
"master",
"instance",
"in",
"a",
"cluster",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dataproc/src/V1/ClusterConfig.php#L220-L226 | train |
googleapis/google-cloud-php | Dataproc/src/V1/ClusterConfig.php | ClusterConfig.setWorkerConfig | public function setWorkerConfig($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dataproc\V1\InstanceGroupConfig::class);
$this->worker_config = $var;
return $this;
} | php | public function setWorkerConfig($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dataproc\V1\InstanceGroupConfig::class);
$this->worker_config = $var;
return $this;
} | [
"public",
"function",
"setWorkerConfig",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dataproc",
"\\",
"V1",
"\\",
"InstanceGroupConfig",
"::",
"class",
")",
";",
"$",
"this",
"->",
"worker_config",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Optional. The Compute Engine config settings for
worker instances in a cluster.
Generated from protobuf field <code>.google.cloud.dataproc.v1.InstanceGroupConfig worker_config = 10;</code>
@param \Google\Cloud\Dataproc\V1\InstanceGroupConfig $var
@return $this | [
"Optional",
".",
"The",
"Compute",
"Engine",
"config",
"settings",
"for",
"worker",
"instances",
"in",
"a",
"cluster",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dataproc/src/V1/ClusterConfig.php#L248-L254 | train |
googleapis/google-cloud-php | Dlp/src/V2/UpdateJobTriggerRequest.php | UpdateJobTriggerRequest.setJobTrigger | public function setJobTrigger($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\JobTrigger::class);
$this->job_trigger = $var;
return $this;
} | php | public function setJobTrigger($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\JobTrigger::class);
$this->job_trigger = $var;
return $this;
} | [
"public",
"function",
"setJobTrigger",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dlp",
"\\",
"V2",
"\\",
"JobTrigger",
"::",
"class",
")",
";",
"$",
"this",
"->",
"job_trigger",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | New JobTrigger value.
Generated from protobuf field <code>.google.privacy.dlp.v2.JobTrigger job_trigger = 2;</code>
@param \Google\Cloud\Dlp\V2\JobTrigger $var
@return $this | [
"New",
"JobTrigger",
"value",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/UpdateJobTriggerRequest.php#L104-L110 | train |
googleapis/google-cloud-php | Datastore/src/V1/LookupResponse.php | LookupResponse.setFound | public function setFound($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Datastore\V1\EntityResult::class);
$this->found = $arr;
return $this;
} | php | public function setFound($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Datastore\V1\EntityResult::class);
$this->found = $arr;
return $this;
} | [
"public",
"function",
"setFound",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Datastore",
"\\",
"V1",
"\\",
"EntityResult",
"::",
"class",
")",
";",
"$",
"this",
"->",
"found",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | Entities found as `ResultType.FULL` entities. The order of results in this
field is undefined and has no relation to the order of the keys in the
input.
Generated from protobuf field <code>repeated .google.datastore.v1.EntityResult found = 1;</code>
@param \Google\Cloud\Datastore\V1\EntityResult[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"Entities",
"found",
"as",
"ResultType",
".",
"FULL",
"entities",
".",
"The",
"order",
"of",
"results",
"in",
"this",
"field",
"is",
"undefined",
"and",
"has",
"no",
"relation",
"to",
"the",
"order",
"of",
"the",
"keys",
"in",
"the",
"input",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Datastore/src/V1/LookupResponse.php#L90-L96 | train |
googleapis/google-cloud-php | Datastore/src/V1/LookupResponse.php | LookupResponse.setMissing | public function setMissing($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Datastore\V1\EntityResult::class);
$this->missing = $arr;
return $this;
} | php | public function setMissing($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Datastore\V1\EntityResult::class);
$this->missing = $arr;
return $this;
} | [
"public",
"function",
"setMissing",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Datastore",
"\\",
"V1",
"\\",
"EntityResult",
"::",
"class",
")",
";",
"$",
"this",
"->",
"missing",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | Entities not found as `ResultType.KEY_ONLY` entities. The order of results
in this field is undefined and has no relation to the order of the keys
in the input.
Generated from protobuf field <code>repeated .google.datastore.v1.EntityResult missing = 2;</code>
@param \Google\Cloud\Datastore\V1\EntityResult[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"Entities",
"not",
"found",
"as",
"ResultType",
".",
"KEY_ONLY",
"entities",
".",
"The",
"order",
"of",
"results",
"in",
"this",
"field",
"is",
"undefined",
"and",
"has",
"no",
"relation",
"to",
"the",
"order",
"of",
"the",
"keys",
"in",
"the",
"input",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Datastore/src/V1/LookupResponse.php#L120-L126 | train |
googleapis/google-cloud-php | Datastore/src/V1/LookupResponse.php | LookupResponse.setDeferred | public function setDeferred($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Datastore\V1\Key::class);
$this->deferred = $arr;
return $this;
} | php | public function setDeferred($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Datastore\V1\Key::class);
$this->deferred = $arr;
return $this;
} | [
"public",
"function",
"setDeferred",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Datastore",
"\\",
"V1",
"\\",
"Key",
"::",
"class",
")",
";",
"$",
"this",
"->",
"deferred",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | A list of keys that were not looked up due to resource constraints. The
order of results in this field is undefined and has no relation to the
order of the keys in the input.
Generated from protobuf field <code>repeated .google.datastore.v1.Key deferred = 3;</code>
@param \Google\Cloud\Datastore\V1\Key[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"A",
"list",
"of",
"keys",
"that",
"were",
"not",
"looked",
"up",
"due",
"to",
"resource",
"constraints",
".",
"The",
"order",
"of",
"results",
"in",
"this",
"field",
"is",
"undefined",
"and",
"has",
"no",
"relation",
"to",
"the",
"order",
"of",
"the",
"keys",
"in",
"the",
"input",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Datastore/src/V1/LookupResponse.php#L150-L156 | train |
googleapis/google-cloud-php | Vision/src/V1/CreateReferenceImageRequest.php | CreateReferenceImageRequest.setReferenceImage | public function setReferenceImage($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ReferenceImage::class);
$this->reference_image = $var;
return $this;
} | php | public function setReferenceImage($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ReferenceImage::class);
$this->reference_image = $var;
return $this;
} | [
"public",
"function",
"setReferenceImage",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Vision",
"\\",
"V1",
"\\",
"ReferenceImage",
"::",
"class",
")",
";",
"$",
"this",
"->",
"reference_image",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | The reference image to create.
If an image ID is specified, it is ignored.
Generated from protobuf field <code>.google.cloud.vision.v1.ReferenceImage reference_image = 2;</code>
@param \Google\Cloud\Vision\V1\ReferenceImage $var
@return $this | [
"The",
"reference",
"image",
"to",
"create",
".",
"If",
"an",
"image",
"ID",
"is",
"specified",
"it",
"is",
"ignored",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Vision/src/V1/CreateReferenceImageRequest.php#L118-L124 | train |
googleapis/google-cloud-php | Firestore/src/V1/BatchGetDocumentsResponse.php | BatchGetDocumentsResponse.setFound | public function setFound($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\Document::class);
$this->writeOneof(1, $var);
return $this;
} | php | public function setFound($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\Document::class);
$this->writeOneof(1, $var);
return $this;
} | [
"public",
"function",
"setFound",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Firestore",
"\\",
"V1",
"\\",
"Document",
"::",
"class",
")",
";",
"$",
"this",
"->",
"writeOneof",
"(",
"1",
",",
"$",
"var",
")",
";",
"return",
"$",
"this",
";",
"}"
] | A document that was requested.
Generated from protobuf field <code>.google.firestore.v1.Document found = 1;</code>
@param \Google\Cloud\Firestore\V1\Document $var
@return $this | [
"A",
"document",
"that",
"was",
"requested",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/V1/BatchGetDocumentsResponse.php#L82-L88 | train |
googleapis/google-cloud-php | Asset/src/V1beta1/ExportAssetsRequest.php | ExportAssetsRequest.setOutputConfig | public function setOutputConfig($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Asset\V1beta1\OutputConfig::class);
$this->output_config = $var;
return $this;
} | php | public function setOutputConfig($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Asset\V1beta1\OutputConfig::class);
$this->output_config = $var;
return $this;
} | [
"public",
"function",
"setOutputConfig",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Asset",
"\\",
"V1beta1",
"\\",
"OutputConfig",
"::",
"class",
")",
";",
"$",
"this",
"->",
"output_config",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Required. Output configuration indicating where the results will be output
to. All results will be in newline delimited JSON format.
Generated from protobuf field <code>.google.cloud.asset.v1beta1.OutputConfig output_config = 5;</code>
@param \Google\Cloud\Asset\V1beta1\OutputConfig $var
@return $this | [
"Required",
".",
"Output",
"configuration",
"indicating",
"where",
"the",
"results",
"will",
"be",
"output",
"to",
".",
"All",
"results",
"will",
"be",
"in",
"newline",
"delimited",
"JSON",
"format",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Asset/src/V1beta1/ExportAssetsRequest.php#L246-L252 | train |
googleapis/google-cloud-php | Dialogflow/src/V2/CreateIntentRequest.php | CreateIntentRequest.setIntentView | public function setIntentView($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\V2\IntentView::class);
$this->intent_view = $var;
return $this;
} | php | public function setIntentView($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\V2\IntentView::class);
$this->intent_view = $var;
return $this;
} | [
"public",
"function",
"setIntentView",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dialogflow",
"\\",
"V2",
"\\",
"IntentView",
"::",
"class",
")",
";",
"$",
"this",
"->",
"intent_view",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Optional. The resource view to apply to the returned intent.
Generated from protobuf field <code>.google.cloud.dialogflow.v2.IntentView intent_view = 4;</code>
@param int $var
@return $this | [
"Optional",
".",
"The",
"resource",
"view",
"to",
"apply",
"to",
"the",
"returned",
"intent",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dialogflow/src/V2/CreateIntentRequest.php#L184-L190 | train |
googleapis/google-cloud-php | Bigtable/src/DataUtil.php | DataUtil.isSystemLittleEndian | public static function isSystemLittleEndian()
{
if (self::$isLittleEndian === null) {
self::$isLittleEndian = (pack("P", 2) === pack("Q", 2));
}
return self::$isLittleEndian;
} | php | public static function isSystemLittleEndian()
{
if (self::$isLittleEndian === null) {
self::$isLittleEndian = (pack("P", 2) === pack("Q", 2));
}
return self::$isLittleEndian;
} | [
"public",
"static",
"function",
"isSystemLittleEndian",
"(",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"isLittleEndian",
"===",
"null",
")",
"{",
"self",
"::",
"$",
"isLittleEndian",
"=",
"(",
"pack",
"(",
"\"P\"",
",",
"2",
")",
"===",
"pack",
"(",
"\"Q\"",
",",
"2",
")",
")",
";",
"}",
"return",
"self",
"::",
"$",
"isLittleEndian",
";",
"}"
] | Check if system is little-endian.
@return bool | [
"Check",
"if",
"system",
"is",
"little",
"-",
"endian",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Bigtable/src/DataUtil.php#L34-L40 | train |
googleapis/google-cloud-php | Bigtable/src/DataUtil.php | DataUtil.intToByteString | public static function intToByteString($intValue)
{
if (!self::isSupported()) {
throw new \RuntimeException('This utility is only supported on 64 bit machines with PHP version > 5.5.');
}
if (!is_int($intValue)) {
throw new \InvalidArgumentException(
sprintf(
'Expected argument to be of type int, instead got \'%s\'.',
gettype($intValue)
)
);
}
$bytes = pack("J", $intValue);
return $bytes;
} | php | public static function intToByteString($intValue)
{
if (!self::isSupported()) {
throw new \RuntimeException('This utility is only supported on 64 bit machines with PHP version > 5.5.');
}
if (!is_int($intValue)) {
throw new \InvalidArgumentException(
sprintf(
'Expected argument to be of type int, instead got \'%s\'.',
gettype($intValue)
)
);
}
$bytes = pack("J", $intValue);
return $bytes;
} | [
"public",
"static",
"function",
"intToByteString",
"(",
"$",
"intValue",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"isSupported",
"(",
")",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'This utility is only supported on 64 bit machines with PHP version > 5.5.'",
")",
";",
"}",
"if",
"(",
"!",
"is_int",
"(",
"$",
"intValue",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'Expected argument to be of type int, instead got \\'%s\\'.'",
",",
"gettype",
"(",
"$",
"intValue",
")",
")",
")",
";",
"}",
"$",
"bytes",
"=",
"pack",
"(",
"\"J\"",
",",
"$",
"intValue",
")",
";",
"return",
"$",
"bytes",
";",
"}"
] | Utility method to convert an integer to a 64-bit big-endian signed integer byte string.
@param int $intValue Integer value to convert to.
@return string Returns a string of bytes representing a 64-bit big-endian signed integer.
@throws \InvalidArgumentException If value is not an integer.
@throws \RuntimeException If called on PHP version <= 5.5. | [
"Utility",
"method",
"to",
"convert",
"an",
"integer",
"to",
"a",
"64",
"-",
"bit",
"big",
"-",
"endian",
"signed",
"integer",
"byte",
"string",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Bigtable/src/DataUtil.php#L65-L80 | train |
googleapis/google-cloud-php | Bigtable/src/DataUtil.php | DataUtil.byteStringToInt | public static function byteStringToInt($bytes)
{
if (!self::isSupported()) {
throw new \RuntimeException('This utility is only supported on 64 bit machines with PHP version > 5.5.');
}
if (self::isSystemLittleEndian()) {
$bytes = strrev($bytes);
}
return unpack("q", $bytes)[1];
} | php | public static function byteStringToInt($bytes)
{
if (!self::isSupported()) {
throw new \RuntimeException('This utility is only supported on 64 bit machines with PHP version > 5.5.');
}
if (self::isSystemLittleEndian()) {
$bytes = strrev($bytes);
}
return unpack("q", $bytes)[1];
} | [
"public",
"static",
"function",
"byteStringToInt",
"(",
"$",
"bytes",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"isSupported",
"(",
")",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'This utility is only supported on 64 bit machines with PHP version > 5.5.'",
")",
";",
"}",
"if",
"(",
"self",
"::",
"isSystemLittleEndian",
"(",
")",
")",
"{",
"$",
"bytes",
"=",
"strrev",
"(",
"$",
"bytes",
")",
";",
"}",
"return",
"unpack",
"(",
"\"q\"",
",",
"$",
"bytes",
")",
"[",
"1",
"]",
";",
"}"
] | Converts a 64-bit big-endian signed integer represented as a byte string to an integer.
@param string $bytes String of bytes to convert.
@return int Integer value of the string bytes.
@throws \RuntimeException If called on PHP version <= 5.5. | [
"Converts",
"a",
"64",
"-",
"bit",
"big",
"-",
"endian",
"signed",
"integer",
"represented",
"as",
"a",
"byte",
"string",
"to",
"an",
"integer",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Bigtable/src/DataUtil.php#L89-L98 | train |
googleapis/google-cloud-php | Bigtable/src/V2/MutateRowRequest.php | MutateRowRequest.setMutations | public function setMutations($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Bigtable\V2\Mutation::class);
$this->mutations = $arr;
return $this;
} | php | public function setMutations($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Bigtable\V2\Mutation::class);
$this->mutations = $arr;
return $this;
} | [
"public",
"function",
"setMutations",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Bigtable",
"\\",
"V2",
"\\",
"Mutation",
"::",
"class",
")",
";",
"$",
"this",
"->",
"mutations",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | Changes to be atomically applied to the specified row. Entries are applied
in order, meaning that earlier mutations can be masked by later ones.
Must contain at least one entry and at most 100000.
Generated from protobuf field <code>repeated .google.bigtable.v2.Mutation mutations = 3;</code>
@param \Google\Cloud\Bigtable\V2\Mutation[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"Changes",
"to",
"be",
"atomically",
"applied",
"to",
"the",
"specified",
"row",
".",
"Entries",
"are",
"applied",
"in",
"order",
"meaning",
"that",
"earlier",
"mutations",
"can",
"be",
"masked",
"by",
"later",
"ones",
".",
"Must",
"contain",
"at",
"least",
"one",
"entry",
"and",
"at",
"most",
"100000",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Bigtable/src/V2/MutateRowRequest.php#L180-L186 | train |
googleapis/google-cloud-php | Core/src/RequestBuilder.php | RequestBuilder.build | public function build($resource, $method, array $options = [])
{
$root = $this->resourceRoot;
array_push($root, 'resources');
$root = array_merge($root, explode('.', $resource));
array_push($root, 'methods', $method);
$action = $this->service;
foreach ($root as $rootItem) {
if (!isset($action[$rootItem])) {
throw new \InvalidArgumentException('Provided path item ' . $rootItem . ' does not exist.');
}
$action = $action[$rootItem];
}
$path = [];
$query = [];
$body = [];
if (isset($action['parameters'])) {
foreach ($action['parameters'] as $parameter => $parameterOptions) {
if ($parameterOptions['location'] === 'path' && array_key_exists($parameter, $options)) {
$path[$parameter] = $options[$parameter];
unset($options[$parameter]);
}
if ($parameterOptions['location'] === 'query' && array_key_exists($parameter, $options)) {
$query[$parameter] = $options[$parameter];
}
}
}
if (isset($this->service['parameters'])) {
foreach ($this->service['parameters'] as $parameter => $parameterOptions) {
if ($parameterOptions['location'] === 'query' && array_key_exists($parameter, $options)) {
$query[$parameter] = $options[$parameter];
}
}
}
if (isset($action['request'])) {
$schema = $action['request']['$ref'];
foreach ($this->service['schemas'][$schema]['properties'] as $property => $propertyOptions) {
if (array_key_exists($property, $options)) {
$body[$property] = $options[$property];
}
}
}
$uri = $this->buildUriWithQuery(
$this->expandUri($this->baseUri . $action['path'], $path),
$query
);
return new Request(
$action['httpMethod'],
$uri,
['Content-Type' => 'application/json'],
$body ? $this->jsonEncode($body) : null
);
} | php | public function build($resource, $method, array $options = [])
{
$root = $this->resourceRoot;
array_push($root, 'resources');
$root = array_merge($root, explode('.', $resource));
array_push($root, 'methods', $method);
$action = $this->service;
foreach ($root as $rootItem) {
if (!isset($action[$rootItem])) {
throw new \InvalidArgumentException('Provided path item ' . $rootItem . ' does not exist.');
}
$action = $action[$rootItem];
}
$path = [];
$query = [];
$body = [];
if (isset($action['parameters'])) {
foreach ($action['parameters'] as $parameter => $parameterOptions) {
if ($parameterOptions['location'] === 'path' && array_key_exists($parameter, $options)) {
$path[$parameter] = $options[$parameter];
unset($options[$parameter]);
}
if ($parameterOptions['location'] === 'query' && array_key_exists($parameter, $options)) {
$query[$parameter] = $options[$parameter];
}
}
}
if (isset($this->service['parameters'])) {
foreach ($this->service['parameters'] as $parameter => $parameterOptions) {
if ($parameterOptions['location'] === 'query' && array_key_exists($parameter, $options)) {
$query[$parameter] = $options[$parameter];
}
}
}
if (isset($action['request'])) {
$schema = $action['request']['$ref'];
foreach ($this->service['schemas'][$schema]['properties'] as $property => $propertyOptions) {
if (array_key_exists($property, $options)) {
$body[$property] = $options[$property];
}
}
}
$uri = $this->buildUriWithQuery(
$this->expandUri($this->baseUri . $action['path'], $path),
$query
);
return new Request(
$action['httpMethod'],
$uri,
['Content-Type' => 'application/json'],
$body ? $this->jsonEncode($body) : null
);
} | [
"public",
"function",
"build",
"(",
"$",
"resource",
",",
"$",
"method",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"root",
"=",
"$",
"this",
"->",
"resourceRoot",
";",
"array_push",
"(",
"$",
"root",
",",
"'resources'",
")",
";",
"$",
"root",
"=",
"array_merge",
"(",
"$",
"root",
",",
"explode",
"(",
"'.'",
",",
"$",
"resource",
")",
")",
";",
"array_push",
"(",
"$",
"root",
",",
"'methods'",
",",
"$",
"method",
")",
";",
"$",
"action",
"=",
"$",
"this",
"->",
"service",
";",
"foreach",
"(",
"$",
"root",
"as",
"$",
"rootItem",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"action",
"[",
"$",
"rootItem",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Provided path item '",
".",
"$",
"rootItem",
".",
"' does not exist.'",
")",
";",
"}",
"$",
"action",
"=",
"$",
"action",
"[",
"$",
"rootItem",
"]",
";",
"}",
"$",
"path",
"=",
"[",
"]",
";",
"$",
"query",
"=",
"[",
"]",
";",
"$",
"body",
"=",
"[",
"]",
";",
"if",
"(",
"isset",
"(",
"$",
"action",
"[",
"'parameters'",
"]",
")",
")",
"{",
"foreach",
"(",
"$",
"action",
"[",
"'parameters'",
"]",
"as",
"$",
"parameter",
"=>",
"$",
"parameterOptions",
")",
"{",
"if",
"(",
"$",
"parameterOptions",
"[",
"'location'",
"]",
"===",
"'path'",
"&&",
"array_key_exists",
"(",
"$",
"parameter",
",",
"$",
"options",
")",
")",
"{",
"$",
"path",
"[",
"$",
"parameter",
"]",
"=",
"$",
"options",
"[",
"$",
"parameter",
"]",
";",
"unset",
"(",
"$",
"options",
"[",
"$",
"parameter",
"]",
")",
";",
"}",
"if",
"(",
"$",
"parameterOptions",
"[",
"'location'",
"]",
"===",
"'query'",
"&&",
"array_key_exists",
"(",
"$",
"parameter",
",",
"$",
"options",
")",
")",
"{",
"$",
"query",
"[",
"$",
"parameter",
"]",
"=",
"$",
"options",
"[",
"$",
"parameter",
"]",
";",
"}",
"}",
"}",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"service",
"[",
"'parameters'",
"]",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"service",
"[",
"'parameters'",
"]",
"as",
"$",
"parameter",
"=>",
"$",
"parameterOptions",
")",
"{",
"if",
"(",
"$",
"parameterOptions",
"[",
"'location'",
"]",
"===",
"'query'",
"&&",
"array_key_exists",
"(",
"$",
"parameter",
",",
"$",
"options",
")",
")",
"{",
"$",
"query",
"[",
"$",
"parameter",
"]",
"=",
"$",
"options",
"[",
"$",
"parameter",
"]",
";",
"}",
"}",
"}",
"if",
"(",
"isset",
"(",
"$",
"action",
"[",
"'request'",
"]",
")",
")",
"{",
"$",
"schema",
"=",
"$",
"action",
"[",
"'request'",
"]",
"[",
"'$ref'",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"service",
"[",
"'schemas'",
"]",
"[",
"$",
"schema",
"]",
"[",
"'properties'",
"]",
"as",
"$",
"property",
"=>",
"$",
"propertyOptions",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"property",
",",
"$",
"options",
")",
")",
"{",
"$",
"body",
"[",
"$",
"property",
"]",
"=",
"$",
"options",
"[",
"$",
"property",
"]",
";",
"}",
"}",
"}",
"$",
"uri",
"=",
"$",
"this",
"->",
"buildUriWithQuery",
"(",
"$",
"this",
"->",
"expandUri",
"(",
"$",
"this",
"->",
"baseUri",
".",
"$",
"action",
"[",
"'path'",
"]",
",",
"$",
"path",
")",
",",
"$",
"query",
")",
";",
"return",
"new",
"Request",
"(",
"$",
"action",
"[",
"'httpMethod'",
"]",
",",
"$",
"uri",
",",
"[",
"'Content-Type'",
"=>",
"'application/json'",
"]",
",",
"$",
"body",
"?",
"$",
"this",
"->",
"jsonEncode",
"(",
"$",
"body",
")",
":",
"null",
")",
";",
"}"
] | Build the request.
@param string $resource
@param string $method
@param array $options [optional]
@return RequestInterface
@todo complexity high, revisit
@todo consider validating against the schemas | [
"Build",
"the",
"request",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Core/src/RequestBuilder.php#L74-L136 | train |
googleapis/google-cloud-php | BigQueryDataTransfer/src/V1/ListTransferConfigsResponse.php | ListTransferConfigsResponse.setTransferConfigs | public function setTransferConfigs($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\BigQuery\DataTransfer\V1\TransferConfig::class);
$this->transfer_configs = $arr;
return $this;
} | php | public function setTransferConfigs($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\BigQuery\DataTransfer\V1\TransferConfig::class);
$this->transfer_configs = $arr;
return $this;
} | [
"public",
"function",
"setTransferConfigs",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"BigQuery",
"\\",
"DataTransfer",
"\\",
"V1",
"\\",
"TransferConfig",
"::",
"class",
")",
";",
"$",
"this",
"->",
"transfer_configs",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | Output only. The stored pipeline transfer configurations.
Generated from protobuf field <code>repeated .google.cloud.bigquery.datatransfer.v1.TransferConfig transfer_configs = 1;</code>
@param \Google\Cloud\BigQuery\DataTransfer\V1\TransferConfig[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"Output",
"only",
".",
"The",
"stored",
"pipeline",
"transfer",
"configurations",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/BigQueryDataTransfer/src/V1/ListTransferConfigsResponse.php#L72-L78 | train |
googleapis/google-cloud-php | Debugger/src/Breakpoint.php | Breakpoint.evaluate | public function evaluate(array $evaluatedExpressions, array $stackframes, array $options = [])
{
$this->variableTable->setOptions($options);
$this->addEvaluatedExpressions($evaluatedExpressions);
$this->addStackFrames($stackframes);
$this->finalize();
} | php | public function evaluate(array $evaluatedExpressions, array $stackframes, array $options = [])
{
$this->variableTable->setOptions($options);
$this->addEvaluatedExpressions($evaluatedExpressions);
$this->addStackFrames($stackframes);
$this->finalize();
} | [
"public",
"function",
"evaluate",
"(",
"array",
"$",
"evaluatedExpressions",
",",
"array",
"$",
"stackframes",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"variableTable",
"->",
"setOptions",
"(",
"$",
"options",
")",
";",
"$",
"this",
"->",
"addEvaluatedExpressions",
"(",
"$",
"evaluatedExpressions",
")",
";",
"$",
"this",
"->",
"addStackFrames",
"(",
"$",
"stackframes",
")",
";",
"$",
"this",
"->",
"finalize",
"(",
")",
";",
"}"
] | Evaluate this breakpoint with the provided evaluated expressions and
captured stackframe data.
@access private
@param array $expressions Key is the expression executed. Value is the
execution result.
@param array $stackFrames Array of stackframe data.
@param array $options [optional] {
Configuration options.
@type int $maxMemberDepth Maximum depth of member variables to capture.
**Defaults to** 5.
@type int $maxPayloadSize Maximum amount of space of captured data.
**Defaults to** 32768.
@type int $maxMembers Maximum number of member variables captured per
variable. **Defaults to** 1000.
@type int $maxValueLength Maximum length of the string representing
the captured variable. **Defaults to** 500.
} | [
"Evaluate",
"this",
"breakpoint",
"with",
"the",
"provided",
"evaluated",
"expressions",
"and",
"captured",
"stackframe",
"data",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Debugger/src/Breakpoint.php#L450-L456 | train |
googleapis/google-cloud-php | Debugger/src/Breakpoint.php | Breakpoint.finalize | public function finalize()
{
list($usec, $sec) = explode(' ', microtime());
$micro = sprintf("%06d", $usec * 1000000);
$when = new \DateTime(date('Y-m-d H:i:s.' . $micro));
$when->setTimezone(new \DateTimeZone('UTC'));
$this->finalTime = $when->format('Y-m-d\TH:i:s.u\Z');
$this->isFinalState = true;
} | php | public function finalize()
{
list($usec, $sec) = explode(' ', microtime());
$micro = sprintf("%06d", $usec * 1000000);
$when = new \DateTime(date('Y-m-d H:i:s.' . $micro));
$when->setTimezone(new \DateTimeZone('UTC'));
$this->finalTime = $when->format('Y-m-d\TH:i:s.u\Z');
$this->isFinalState = true;
} | [
"public",
"function",
"finalize",
"(",
")",
"{",
"list",
"(",
"$",
"usec",
",",
"$",
"sec",
")",
"=",
"explode",
"(",
"' '",
",",
"microtime",
"(",
")",
")",
";",
"$",
"micro",
"=",
"sprintf",
"(",
"\"%06d\"",
",",
"$",
"usec",
"*",
"1000000",
")",
";",
"$",
"when",
"=",
"new",
"\\",
"DateTime",
"(",
"date",
"(",
"'Y-m-d H:i:s.'",
".",
"$",
"micro",
")",
")",
";",
"$",
"when",
"->",
"setTimezone",
"(",
"new",
"\\",
"DateTimeZone",
"(",
"'UTC'",
")",
")",
";",
"$",
"this",
"->",
"finalTime",
"=",
"$",
"when",
"->",
"format",
"(",
"'Y-m-d\\TH:i:s.u\\Z'",
")",
";",
"$",
"this",
"->",
"isFinalState",
"=",
"true",
";",
"}"
] | Mark this breakpoint as final state and record the current timestamp.
Example:
```
$breakpoint->finalize();
``` | [
"Mark",
"this",
"breakpoint",
"as",
"final",
"state",
"and",
"record",
"the",
"current",
"timestamp",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Debugger/src/Breakpoint.php#L507-L515 | train |
googleapis/google-cloud-php | Debugger/src/Breakpoint.php | Breakpoint.addStackFrame | public function addStackFrame($stackFrameData)
{
$stackFrameData += [
'function' => '',
'locals' => []
];
$sf = new StackFrame(
$stackFrameData['function'],
new SourceLocation($stackFrameData['filename'], $stackFrameData['line'])
);
foreach ($stackFrameData['locals'] as $local) {
if ($this->variableTable->isFull()) {
break;
}
$value = isset($local['value']) ? $local['value'] : null;
$hash = isset($local['id']) ? $local['id'] : null;
try {
$variable = $this->addVariable($local['name'], $value, $hash);
} catch (BufferFullException $e) {
$sf->addLocal($this->variableTable->bufferFullVariable());
break;
}
$sf->addLocal($variable);
}
array_push($this->stackFrames, $sf);
} | php | public function addStackFrame($stackFrameData)
{
$stackFrameData += [
'function' => '',
'locals' => []
];
$sf = new StackFrame(
$stackFrameData['function'],
new SourceLocation($stackFrameData['filename'], $stackFrameData['line'])
);
foreach ($stackFrameData['locals'] as $local) {
if ($this->variableTable->isFull()) {
break;
}
$value = isset($local['value']) ? $local['value'] : null;
$hash = isset($local['id']) ? $local['id'] : null;
try {
$variable = $this->addVariable($local['name'], $value, $hash);
} catch (BufferFullException $e) {
$sf->addLocal($this->variableTable->bufferFullVariable());
break;
}
$sf->addLocal($variable);
}
array_push($this->stackFrames, $sf);
} | [
"public",
"function",
"addStackFrame",
"(",
"$",
"stackFrameData",
")",
"{",
"$",
"stackFrameData",
"+=",
"[",
"'function'",
"=>",
"''",
",",
"'locals'",
"=>",
"[",
"]",
"]",
";",
"$",
"sf",
"=",
"new",
"StackFrame",
"(",
"$",
"stackFrameData",
"[",
"'function'",
"]",
",",
"new",
"SourceLocation",
"(",
"$",
"stackFrameData",
"[",
"'filename'",
"]",
",",
"$",
"stackFrameData",
"[",
"'line'",
"]",
")",
")",
";",
"foreach",
"(",
"$",
"stackFrameData",
"[",
"'locals'",
"]",
"as",
"$",
"local",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"variableTable",
"->",
"isFull",
"(",
")",
")",
"{",
"break",
";",
"}",
"$",
"value",
"=",
"isset",
"(",
"$",
"local",
"[",
"'value'",
"]",
")",
"?",
"$",
"local",
"[",
"'value'",
"]",
":",
"null",
";",
"$",
"hash",
"=",
"isset",
"(",
"$",
"local",
"[",
"'id'",
"]",
")",
"?",
"$",
"local",
"[",
"'id'",
"]",
":",
"null",
";",
"try",
"{",
"$",
"variable",
"=",
"$",
"this",
"->",
"addVariable",
"(",
"$",
"local",
"[",
"'name'",
"]",
",",
"$",
"value",
",",
"$",
"hash",
")",
";",
"}",
"catch",
"(",
"BufferFullException",
"$",
"e",
")",
"{",
"$",
"sf",
"->",
"addLocal",
"(",
"$",
"this",
"->",
"variableTable",
"->",
"bufferFullVariable",
"(",
")",
")",
";",
"break",
";",
"}",
"$",
"sf",
"->",
"addLocal",
"(",
"$",
"variable",
")",
";",
"}",
"array_push",
"(",
"$",
"this",
"->",
"stackFrames",
",",
"$",
"sf",
")",
";",
"}"
] | Add single stackframe of data to this breakpoint.
Example:
```
$breakpoint->addStackFrame([
'filename' => '/path/to/file.php',
'line' => 10
]);
$stackFrames = $breakpoint->stackFrames();
```
@param array $stackFrameData {
Stackframe information.
@type string $function The name of the function executed.
@type string $filename The name of the file executed.
@type int $line The line number of the file executed.
@type array $locals Captured local variables. | [
"Add",
"single",
"stackframe",
"of",
"data",
"to",
"this",
"breakpoint",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Debugger/src/Breakpoint.php#L560-L588 | train |
googleapis/google-cloud-php | Debugger/src/Breakpoint.php | Breakpoint.addEvaluatedExpressions | public function addEvaluatedExpressions(array $expressions)
{
foreach ($expressions as $expression => $result) {
try {
$this->evaluatedExpressions[] = $this->addVariable($expression, $result);
} catch (BufferFullException $e) {
$this->evaluatedExpressions[] = $this->variableTable->bufferFullVariable();
}
}
} | php | public function addEvaluatedExpressions(array $expressions)
{
foreach ($expressions as $expression => $result) {
try {
$this->evaluatedExpressions[] = $this->addVariable($expression, $result);
} catch (BufferFullException $e) {
$this->evaluatedExpressions[] = $this->variableTable->bufferFullVariable();
}
}
} | [
"public",
"function",
"addEvaluatedExpressions",
"(",
"array",
"$",
"expressions",
")",
"{",
"foreach",
"(",
"$",
"expressions",
"as",
"$",
"expression",
"=>",
"$",
"result",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"evaluatedExpressions",
"[",
"]",
"=",
"$",
"this",
"->",
"addVariable",
"(",
"$",
"expression",
",",
"$",
"result",
")",
";",
"}",
"catch",
"(",
"BufferFullException",
"$",
"e",
")",
"{",
"$",
"this",
"->",
"evaluatedExpressions",
"[",
"]",
"=",
"$",
"this",
"->",
"variableTable",
"->",
"bufferFullVariable",
"(",
")",
";",
"}",
"}",
"}"
] | Add evaluated expression results to this breakpoint.
Example:
```
$breakpoint->addEvaluatedExpressions([
'2 + 3' => '5',
'$foo' => 'variable value'
]);
```
@param array $expressions Key is the expression executed. Value is the
execution result. | [
"Add",
"evaluated",
"expression",
"results",
"to",
"this",
"breakpoint",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Debugger/src/Breakpoint.php#L604-L613 | train |
googleapis/google-cloud-php | AutoMl/src/V1beta1/ExamplePayload.php | ExamplePayload.setImage | public function setImage($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\AutoMl\V1beta1\Image::class);
$this->writeOneof(1, $var);
return $this;
} | php | public function setImage($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\AutoMl\V1beta1\Image::class);
$this->writeOneof(1, $var);
return $this;
} | [
"public",
"function",
"setImage",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"AutoMl",
"\\",
"V1beta1",
"\\",
"Image",
"::",
"class",
")",
";",
"$",
"this",
"->",
"writeOneof",
"(",
"1",
",",
"$",
"var",
")",
";",
"return",
"$",
"this",
";",
"}"
] | An example image.
Generated from protobuf field <code>.google.cloud.automl.v1beta1.Image image = 1;</code>
@param \Google\Cloud\AutoMl\V1beta1\Image $var
@return $this | [
"An",
"example",
"image",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/AutoMl/src/V1beta1/ExamplePayload.php#L55-L61 | train |
googleapis/google-cloud-php | AutoMl/src/V1beta1/ExamplePayload.php | ExamplePayload.setTextSnippet | public function setTextSnippet($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\AutoMl\V1beta1\TextSnippet::class);
$this->writeOneof(2, $var);
return $this;
} | php | public function setTextSnippet($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\AutoMl\V1beta1\TextSnippet::class);
$this->writeOneof(2, $var);
return $this;
} | [
"public",
"function",
"setTextSnippet",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"AutoMl",
"\\",
"V1beta1",
"\\",
"TextSnippet",
"::",
"class",
")",
";",
"$",
"this",
"->",
"writeOneof",
"(",
"2",
",",
"$",
"var",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Example text.
Generated from protobuf field <code>.google.cloud.automl.v1beta1.TextSnippet text_snippet = 2;</code>
@param \Google\Cloud\AutoMl\V1beta1\TextSnippet $var
@return $this | [
"Example",
"text",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/AutoMl/src/V1beta1/ExamplePayload.php#L81-L87 | train |
googleapis/google-cloud-php | Bigtable/src/V2/Gapic/BigtableGapicClient.php | BigtableGapicClient.tableName | public static function tableName($project, $instance, $table)
{
return self::getTableNameTemplate()->render([
'project' => $project,
'instance' => $instance,
'table' => $table,
]);
} | php | public static function tableName($project, $instance, $table)
{
return self::getTableNameTemplate()->render([
'project' => $project,
'instance' => $instance,
'table' => $table,
]);
} | [
"public",
"static",
"function",
"tableName",
"(",
"$",
"project",
",",
"$",
"instance",
",",
"$",
"table",
")",
"{",
"return",
"self",
"::",
"getTableNameTemplate",
"(",
")",
"->",
"render",
"(",
"[",
"'project'",
"=>",
"$",
"project",
",",
"'instance'",
"=>",
"$",
"instance",
",",
"'table'",
"=>",
"$",
"table",
",",
"]",
")",
";",
"}"
] | Formats a string containing the fully-qualified path to represent
a table resource.
@param string $project
@param string $instance
@param string $table
@return string The formatted table resource.
@experimental | [
"Formats",
"a",
"string",
"containing",
"the",
"fully",
"-",
"qualified",
"path",
"to",
"represent",
"a",
"table",
"resource",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Bigtable/src/V2/Gapic/BigtableGapicClient.php#L172-L179 | train |
googleapis/google-cloud-php | AutoMl/src/V1beta1/Gapic/PredictionServiceGapicClient.php | PredictionServiceGapicClient.modelName | public static function modelName($project, $location, $model)
{
return self::getModelNameTemplate()->render([
'project' => $project,
'location' => $location,
'model' => $model,
]);
} | php | public static function modelName($project, $location, $model)
{
return self::getModelNameTemplate()->render([
'project' => $project,
'location' => $location,
'model' => $model,
]);
} | [
"public",
"static",
"function",
"modelName",
"(",
"$",
"project",
",",
"$",
"location",
",",
"$",
"model",
")",
"{",
"return",
"self",
"::",
"getModelNameTemplate",
"(",
")",
"->",
"render",
"(",
"[",
"'project'",
"=>",
"$",
"project",
",",
"'location'",
"=>",
"$",
"location",
",",
"'model'",
"=>",
"$",
"model",
",",
"]",
")",
";",
"}"
] | Formats a string containing the fully-qualified path to represent
a model resource.
@param string $project
@param string $location
@param string $model
@return string The formatted model resource.
@experimental | [
"Formats",
"a",
"string",
"containing",
"the",
"fully",
"-",
"qualified",
"path",
"to",
"represent",
"a",
"model",
"resource",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/AutoMl/src/V1beta1/Gapic/PredictionServiceGapicClient.php#L148-L155 | train |
googleapis/google-cloud-php | Firestore/src/V1beta1/DocumentTransform/FieldTransform.php | FieldTransform.setSetToServerValue | public function setSetToServerValue($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Firestore\V1beta1\DocumentTransform_FieldTransform_ServerValue::class);
$this->writeOneof(2, $var);
return $this;
} | php | public function setSetToServerValue($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Firestore\V1beta1\DocumentTransform_FieldTransform_ServerValue::class);
$this->writeOneof(2, $var);
return $this;
} | [
"public",
"function",
"setSetToServerValue",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Firestore",
"\\",
"V1beta1",
"\\",
"DocumentTransform_FieldTransform_ServerValue",
"::",
"class",
")",
";",
"$",
"this",
"->",
"writeOneof",
"(",
"2",
",",
"$",
"var",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Sets the field to the given server value.
Generated from protobuf field <code>.google.firestore.v1beta1.DocumentTransform.FieldTransform.ServerValue set_to_server_value = 2;</code>
@param int $var
@return $this | [
"Sets",
"the",
"field",
"to",
"the",
"given",
"server",
"value",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/V1beta1/DocumentTransform/FieldTransform.php#L145-L151 | train |
googleapis/google-cloud-php | Core/src/Timestamp.php | Timestamp.nanoSeconds | public function nanoSeconds()
{
return $this->nanoSeconds === null
? (int) $this->value->format('u') * 1000
: $this->nanoSeconds;
} | php | public function nanoSeconds()
{
return $this->nanoSeconds === null
? (int) $this->value->format('u') * 1000
: $this->nanoSeconds;
} | [
"public",
"function",
"nanoSeconds",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"nanoSeconds",
"===",
"null",
"?",
"(",
"int",
")",
"$",
"this",
"->",
"value",
"->",
"format",
"(",
"'u'",
")",
"*",
"1000",
":",
"$",
"this",
"->",
"nanoSeconds",
";",
"}"
] | Return the number of nanoseconds.
Example:
```
$nanos = $timestamp->nanoSeconds();
```
@return int | [
"Return",
"the",
"number",
"of",
"nanoseconds",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Core/src/Timestamp.php#L105-L110 | train |
googleapis/google-cloud-php | Talent/src/V4beta1/Application.php | Application.setState | public function setState($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Talent\V4beta1\Application_ApplicationState::class);
$this->state = $var;
return $this;
} | php | public function setState($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Talent\V4beta1\Application_ApplicationState::class);
$this->state = $var;
return $this;
} | [
"public",
"function",
"setState",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Talent",
"\\",
"V4beta1",
"\\",
"Application_ApplicationState",
"::",
"class",
")",
";",
"$",
"this",
"->",
"state",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Optional.
The application state.
Generated from protobuf field <code>.google.cloud.talent.v4beta1.Application.ApplicationState state = 13;</code>
@param int $var
@return $this | [
"Optional",
".",
"The",
"application",
"state",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Talent/src/V4beta1/Application.php#L492-L498 | train |
googleapis/google-cloud-php | Talent/src/V4beta1/Application.php | Application.setOutcome | public function setOutcome($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Talent\V4beta1\Outcome::class);
$this->outcome = $var;
return $this;
} | php | public function setOutcome($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Talent\V4beta1\Outcome::class);
$this->outcome = $var;
return $this;
} | [
"public",
"function",
"setOutcome",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Talent",
"\\",
"V4beta1",
"\\",
"Outcome",
"::",
"class",
")",
";",
"$",
"this",
"->",
"outcome",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Optional.
Outcome positiveness shows how positive the outcome is.
Generated from protobuf field <code>.google.cloud.talent.v4beta1.Outcome outcome = 22;</code>
@param int $var
@return $this | [
"Optional",
".",
"Outcome",
"positiveness",
"shows",
"how",
"positive",
"the",
"outcome",
"is",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Talent/src/V4beta1/Application.php#L699-L705 | train |
googleapis/google-cloud-php | Iot/src/V1/Gapic/DeviceManagerGapicClient.php | DeviceManagerGapicClient.deviceName | public static function deviceName($project, $location, $registry, $device)
{
return self::getDeviceNameTemplate()->render([
'project' => $project,
'location' => $location,
'registry' => $registry,
'device' => $device,
]);
} | php | public static function deviceName($project, $location, $registry, $device)
{
return self::getDeviceNameTemplate()->render([
'project' => $project,
'location' => $location,
'registry' => $registry,
'device' => $device,
]);
} | [
"public",
"static",
"function",
"deviceName",
"(",
"$",
"project",
",",
"$",
"location",
",",
"$",
"registry",
",",
"$",
"device",
")",
"{",
"return",
"self",
"::",
"getDeviceNameTemplate",
"(",
")",
"->",
"render",
"(",
"[",
"'project'",
"=>",
"$",
"project",
",",
"'location'",
"=>",
"$",
"location",
",",
"'registry'",
"=>",
"$",
"registry",
",",
"'device'",
"=>",
"$",
"device",
",",
"]",
")",
";",
"}"
] | Formats a string containing the fully-qualified path to represent
a device resource.
@param string $project
@param string $location
@param string $registry
@param string $device
@return string The formatted device resource.
@experimental | [
"Formats",
"a",
"string",
"containing",
"the",
"fully",
"-",
"qualified",
"path",
"to",
"represent",
"a",
"device",
"resource",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Iot/src/V1/Gapic/DeviceManagerGapicClient.php#L204-L212 | train |
googleapis/google-cloud-php | Iot/src/V1/Gapic/DeviceManagerGapicClient.php | DeviceManagerGapicClient.registryName | public static function registryName($project, $location, $registry)
{
return self::getRegistryNameTemplate()->render([
'project' => $project,
'location' => $location,
'registry' => $registry,
]);
} | php | public static function registryName($project, $location, $registry)
{
return self::getRegistryNameTemplate()->render([
'project' => $project,
'location' => $location,
'registry' => $registry,
]);
} | [
"public",
"static",
"function",
"registryName",
"(",
"$",
"project",
",",
"$",
"location",
",",
"$",
"registry",
")",
"{",
"return",
"self",
"::",
"getRegistryNameTemplate",
"(",
")",
"->",
"render",
"(",
"[",
"'project'",
"=>",
"$",
"project",
",",
"'location'",
"=>",
"$",
"location",
",",
"'registry'",
"=>",
"$",
"registry",
",",
"]",
")",
";",
"}"
] | Formats a string containing the fully-qualified path to represent
a registry resource.
@param string $project
@param string $location
@param string $registry
@return string The formatted registry resource.
@experimental | [
"Formats",
"a",
"string",
"containing",
"the",
"fully",
"-",
"qualified",
"path",
"to",
"represent",
"a",
"registry",
"resource",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Iot/src/V1/Gapic/DeviceManagerGapicClient.php#L243-L250 | train |
googleapis/google-cloud-php | Dlp/src/V2/RecordCondition.php | RecordCondition.setExpressions | public function setExpressions($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\RecordCondition_Expressions::class);
$this->expressions = $var;
return $this;
} | php | public function setExpressions($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\RecordCondition_Expressions::class);
$this->expressions = $var;
return $this;
} | [
"public",
"function",
"setExpressions",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dlp",
"\\",
"V2",
"\\",
"RecordCondition_Expressions",
"::",
"class",
")",
";",
"$",
"this",
"->",
"expressions",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | An expression.
Generated from protobuf field <code>.google.privacy.dlp.v2.RecordCondition.Expressions expressions = 3;</code>
@param \Google\Cloud\Dlp\V2\RecordCondition\Expressions $var
@return $this | [
"An",
"expression",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/RecordCondition.php#L59-L65 | train |
googleapis/google-cloud-php | Dialogflow/src/V2/QueryParameters.php | QueryParameters.setContexts | public function setContexts($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\V2\Context::class);
$this->contexts = $arr;
return $this;
} | php | public function setContexts($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\V2\Context::class);
$this->contexts = $arr;
return $this;
} | [
"public",
"function",
"setContexts",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dialogflow",
"\\",
"V2",
"\\",
"Context",
"::",
"class",
")",
";",
"$",
"this",
"->",
"contexts",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | Optional. The collection of contexts to be activated before this query is
executed.
Generated from protobuf field <code>repeated .google.cloud.dialogflow.v2.Context contexts = 3;</code>
@param \Google\Cloud\Dialogflow\V2\Context[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"Optional",
".",
"The",
"collection",
"of",
"contexts",
"to",
"be",
"activated",
"before",
"this",
"query",
"is",
"executed",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dialogflow/src/V2/QueryParameters.php#L184-L190 | train |
googleapis/google-cloud-php | Dialogflow/src/V2/QueryParameters.php | QueryParameters.setSessionEntityTypes | public function setSessionEntityTypes($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\V2\SessionEntityType::class);
$this->session_entity_types = $arr;
return $this;
} | php | public function setSessionEntityTypes($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\V2\SessionEntityType::class);
$this->session_entity_types = $arr;
return $this;
} | [
"public",
"function",
"setSessionEntityTypes",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkRepeatedField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"MESSAGE",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dialogflow",
"\\",
"V2",
"\\",
"SessionEntityType",
"::",
"class",
")",
";",
"$",
"this",
"->",
"session_entity_types",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | Optional. Additional session entity types to replace or extend developer
entity types with. The entity synonyms apply to all languages and persist
for the session of this query.
Generated from protobuf field <code>repeated .google.cloud.dialogflow.v2.SessionEntityType session_entity_types = 5;</code>
@param \Google\Cloud\Dialogflow\V2\SessionEntityType[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"Optional",
".",
"Additional",
"session",
"entity",
"types",
"to",
"replace",
"or",
"extend",
"developer",
"entity",
"types",
"with",
".",
"The",
"entity",
"synonyms",
"apply",
"to",
"all",
"languages",
"and",
"persist",
"for",
"the",
"session",
"of",
"this",
"query",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dialogflow/src/V2/QueryParameters.php#L242-L248 | train |
googleapis/google-cloud-php | Dialogflow/src/V2/QueryParameters.php | QueryParameters.setSentimentAnalysisRequestConfig | public function setSentimentAnalysisRequestConfig($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\SentimentAnalysisRequestConfig::class);
$this->sentiment_analysis_request_config = $var;
return $this;
} | php | public function setSentimentAnalysisRequestConfig($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\SentimentAnalysisRequestConfig::class);
$this->sentiment_analysis_request_config = $var;
return $this;
} | [
"public",
"function",
"setSentimentAnalysisRequestConfig",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dialogflow",
"\\",
"V2",
"\\",
"SentimentAnalysisRequestConfig",
"::",
"class",
")",
";",
"$",
"this",
"->",
"sentiment_analysis_request_config",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Optional. Configures the type of sentiment analysis to perform. If not
provided, sentiment analysis is not performed.
Generated from protobuf field <code>.google.cloud.dialogflow.v2.SentimentAnalysisRequestConfig sentiment_analysis_request_config = 10;</code>
@param \Google\Cloud\Dialogflow\V2\SentimentAnalysisRequestConfig $var
@return $this | [
"Optional",
".",
"Configures",
"the",
"type",
"of",
"sentiment",
"analysis",
"to",
"perform",
".",
"If",
"not",
"provided",
"sentiment",
"analysis",
"is",
"not",
"performed",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dialogflow/src/V2/QueryParameters.php#L298-L304 | train |
googleapis/google-cloud-php | WebRisk/src/V1beta1/ThreatEntryRemovals.php | ThreatEntryRemovals.setRawIndices | public function setRawIndices($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\WebRisk\V1beta1\RawIndices::class);
$this->raw_indices = $var;
return $this;
} | php | public function setRawIndices($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\WebRisk\V1beta1\RawIndices::class);
$this->raw_indices = $var;
return $this;
} | [
"public",
"function",
"setRawIndices",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"WebRisk",
"\\",
"V1beta1",
"\\",
"RawIndices",
"::",
"class",
")",
";",
"$",
"this",
"->",
"raw_indices",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | The raw removal indices for a local list.
Generated from protobuf field <code>.google.cloud.webrisk.v1beta1.RawIndices raw_indices = 1;</code>
@param \Google\Cloud\WebRisk\V1beta1\RawIndices $var
@return $this | [
"The",
"raw",
"removal",
"indices",
"for",
"a",
"local",
"list",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/WebRisk/src/V1beta1/ThreatEntryRemovals.php#L72-L78 | train |
googleapis/google-cloud-php | Talent/src/V4beta1/ParseResumeResponse.php | ParseResumeResponse.setProfile | public function setProfile($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Talent\V4beta1\Profile::class);
$this->profile = $var;
return $this;
} | php | public function setProfile($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Talent\V4beta1\Profile::class);
$this->profile = $var;
return $this;
} | [
"public",
"function",
"setProfile",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Talent",
"\\",
"V4beta1",
"\\",
"Profile",
"::",
"class",
")",
";",
"$",
"this",
"->",
"profile",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | The profile parsed from resume.
Generated from protobuf field <code>.google.cloud.talent.v4beta1.Profile profile = 1;</code>
@param \Google\Cloud\Talent\V4beta1\Profile $var
@return $this | [
"The",
"profile",
"parsed",
"from",
"resume",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Talent/src/V4beta1/ParseResumeResponse.php#L66-L72 | train |
googleapis/google-cloud-php | Dlp/src/V2/InspectDataSourceDetails.php | InspectDataSourceDetails.setRequestedOptions | public function setRequestedOptions($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\InspectDataSourceDetails_RequestedOptions::class);
$this->requested_options = $var;
return $this;
} | php | public function setRequestedOptions($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\InspectDataSourceDetails_RequestedOptions::class);
$this->requested_options = $var;
return $this;
} | [
"public",
"function",
"setRequestedOptions",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dlp",
"\\",
"V2",
"\\",
"InspectDataSourceDetails_RequestedOptions",
"::",
"class",
")",
";",
"$",
"this",
"->",
"requested_options",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | The configuration used for this job.
Generated from protobuf field <code>.google.privacy.dlp.v2.InspectDataSourceDetails.RequestedOptions requested_options = 2;</code>
@param \Google\Cloud\Dlp\V2\InspectDataSourceDetails\RequestedOptions $var
@return $this | [
"The",
"configuration",
"used",
"for",
"this",
"job",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/InspectDataSourceDetails.php#L66-L72 | train |
googleapis/google-cloud-php | Dlp/src/V2/InspectDataSourceDetails.php | InspectDataSourceDetails.setResult | public function setResult($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\InspectDataSourceDetails_Result::class);
$this->result = $var;
return $this;
} | php | public function setResult($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\InspectDataSourceDetails_Result::class);
$this->result = $var;
return $this;
} | [
"public",
"function",
"setResult",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dlp",
"\\",
"V2",
"\\",
"InspectDataSourceDetails_Result",
"::",
"class",
")",
";",
"$",
"this",
"->",
"result",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | A summary of the outcome of this inspect job.
Generated from protobuf field <code>.google.privacy.dlp.v2.InspectDataSourceDetails.Result result = 3;</code>
@param \Google\Cloud\Dlp\V2\InspectDataSourceDetails\Result $var
@return $this | [
"A",
"summary",
"of",
"the",
"outcome",
"of",
"this",
"inspect",
"job",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/InspectDataSourceDetails.php#L92-L98 | train |
googleapis/google-cloud-php | Spanner/src/Admin/Database/V1/DatabaseAdminGrpcClient.php | DatabaseAdminGrpcClient.GetIamPolicy | public function GetIamPolicy(\Google\Cloud\Iam\V1\GetIamPolicyRequest $argument,
$metadata = [], $options = []) {
return $this->_simpleRequest('/google.spanner.admin.database.v1.DatabaseAdmin/GetIamPolicy',
$argument,
['\Google\Cloud\Iam\V1\Policy', 'decode'],
$metadata, $options);
} | php | public function GetIamPolicy(\Google\Cloud\Iam\V1\GetIamPolicyRequest $argument,
$metadata = [], $options = []) {
return $this->_simpleRequest('/google.spanner.admin.database.v1.DatabaseAdmin/GetIamPolicy',
$argument,
['\Google\Cloud\Iam\V1\Policy', 'decode'],
$metadata, $options);
} | [
"public",
"function",
"GetIamPolicy",
"(",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Iam",
"\\",
"V1",
"\\",
"GetIamPolicyRequest",
"$",
"argument",
",",
"$",
"metadata",
"=",
"[",
"]",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"_simpleRequest",
"(",
"'/google.spanner.admin.database.v1.DatabaseAdmin/GetIamPolicy'",
",",
"$",
"argument",
",",
"[",
"'\\Google\\Cloud\\Iam\\V1\\Policy'",
",",
"'decode'",
"]",
",",
"$",
"metadata",
",",
"$",
"options",
")",
";",
"}"
] | Gets the access control policy for a database resource. Returns an empty
policy if a database exists but does not have a policy set.
Authorization requires `spanner.databases.getIamPolicy` permission on
[resource][google.iam.v1.GetIamPolicyRequest.resource].
@param \Google\Cloud\Iam\V1\GetIamPolicyRequest $argument input argument
@param array $metadata metadata
@param array $options call options | [
"Gets",
"the",
"access",
"control",
"policy",
"for",
"a",
"database",
"resource",
".",
"Returns",
"an",
"empty",
"policy",
"if",
"a",
"database",
"exists",
"but",
"does",
"not",
"have",
"a",
"policy",
"set",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/Admin/Database/V1/DatabaseAdminGrpcClient.php#L167-L173 | train |
googleapis/google-cloud-php | Dataproc/src/V1beta2/ClusterMetrics.php | ClusterMetrics.setHdfsMetrics | public function setHdfsMetrics($var)
{
$arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::INT64);
$this->hdfs_metrics = $arr;
return $this;
} | php | public function setHdfsMetrics($var)
{
$arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::INT64);
$this->hdfs_metrics = $arr;
return $this;
} | [
"public",
"function",
"setHdfsMetrics",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkMapField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"STRING",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"INT64",
")",
";",
"$",
"this",
"->",
"hdfs_metrics",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | The HDFS metrics.
Generated from protobuf field <code>map<string, int64> hdfs_metrics = 1;</code>
@param array|\Google\Protobuf\Internal\MapField $var
@return $this | [
"The",
"HDFS",
"metrics",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dataproc/src/V1beta2/ClusterMetrics.php#L68-L74 | train |
googleapis/google-cloud-php | Dataproc/src/V1beta2/ClusterMetrics.php | ClusterMetrics.setYarnMetrics | public function setYarnMetrics($var)
{
$arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::INT64);
$this->yarn_metrics = $arr;
return $this;
} | php | public function setYarnMetrics($var)
{
$arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::INT64);
$this->yarn_metrics = $arr;
return $this;
} | [
"public",
"function",
"setYarnMetrics",
"(",
"$",
"var",
")",
"{",
"$",
"arr",
"=",
"GPBUtil",
"::",
"checkMapField",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"STRING",
",",
"\\",
"Google",
"\\",
"Protobuf",
"\\",
"Internal",
"\\",
"GPBType",
"::",
"INT64",
")",
";",
"$",
"this",
"->",
"yarn_metrics",
"=",
"$",
"arr",
";",
"return",
"$",
"this",
";",
"}"
] | The YARN metrics.
Generated from protobuf field <code>map<string, int64> yarn_metrics = 2;</code>
@param array|\Google\Protobuf\Internal\MapField $var
@return $this | [
"The",
"YARN",
"metrics",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dataproc/src/V1beta2/ClusterMetrics.php#L94-L100 | train |
googleapis/google-cloud-php | Kms/src/V1/Gapic/KeyManagementServiceGapicClient.php | KeyManagementServiceGapicClient.cryptoKeyName | public static function cryptoKeyName($project, $location, $keyRing, $cryptoKey)
{
return self::getCryptoKeyNameTemplate()->render([
'project' => $project,
'location' => $location,
'key_ring' => $keyRing,
'crypto_key' => $cryptoKey,
]);
} | php | public static function cryptoKeyName($project, $location, $keyRing, $cryptoKey)
{
return self::getCryptoKeyNameTemplate()->render([
'project' => $project,
'location' => $location,
'key_ring' => $keyRing,
'crypto_key' => $cryptoKey,
]);
} | [
"public",
"static",
"function",
"cryptoKeyName",
"(",
"$",
"project",
",",
"$",
"location",
",",
"$",
"keyRing",
",",
"$",
"cryptoKey",
")",
"{",
"return",
"self",
"::",
"getCryptoKeyNameTemplate",
"(",
")",
"->",
"render",
"(",
"[",
"'project'",
"=>",
"$",
"project",
",",
"'location'",
"=>",
"$",
"location",
",",
"'key_ring'",
"=>",
"$",
"keyRing",
",",
"'crypto_key'",
"=>",
"$",
"cryptoKey",
",",
"]",
")",
";",
"}"
] | Formats a string containing the fully-qualified path to represent
a crypto_key resource.
@param string $project
@param string $location
@param string $keyRing
@param string $cryptoKey
@return string The formatted crypto_key resource.
@experimental | [
"Formats",
"a",
"string",
"containing",
"the",
"fully",
"-",
"qualified",
"path",
"to",
"represent",
"a",
"crypto_key",
"resource",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Kms/src/V1/Gapic/KeyManagementServiceGapicClient.php#L253-L261 | train |
googleapis/google-cloud-php | Kms/src/V1/Gapic/KeyManagementServiceGapicClient.php | KeyManagementServiceGapicClient.cryptoKeyPathName | public static function cryptoKeyPathName($project, $location, $keyRing, $cryptoKeyPath)
{
return self::getCryptoKeyPathNameTemplate()->render([
'project' => $project,
'location' => $location,
'key_ring' => $keyRing,
'crypto_key_path' => $cryptoKeyPath,
]);
} | php | public static function cryptoKeyPathName($project, $location, $keyRing, $cryptoKeyPath)
{
return self::getCryptoKeyPathNameTemplate()->render([
'project' => $project,
'location' => $location,
'key_ring' => $keyRing,
'crypto_key_path' => $cryptoKeyPath,
]);
} | [
"public",
"static",
"function",
"cryptoKeyPathName",
"(",
"$",
"project",
",",
"$",
"location",
",",
"$",
"keyRing",
",",
"$",
"cryptoKeyPath",
")",
"{",
"return",
"self",
"::",
"getCryptoKeyPathNameTemplate",
"(",
")",
"->",
"render",
"(",
"[",
"'project'",
"=>",
"$",
"project",
",",
"'location'",
"=>",
"$",
"location",
",",
"'key_ring'",
"=>",
"$",
"keyRing",
",",
"'crypto_key_path'",
"=>",
"$",
"cryptoKeyPath",
",",
"]",
")",
";",
"}"
] | Formats a string containing the fully-qualified path to represent
a crypto_key_path resource.
@param string $project
@param string $location
@param string $keyRing
@param string $cryptoKeyPath
@return string The formatted crypto_key_path resource.
@experimental | [
"Formats",
"a",
"string",
"containing",
"the",
"fully",
"-",
"qualified",
"path",
"to",
"represent",
"a",
"crypto_key_path",
"resource",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Kms/src/V1/Gapic/KeyManagementServiceGapicClient.php#L275-L283 | train |
googleapis/google-cloud-php | Kms/src/V1/Gapic/KeyManagementServiceGapicClient.php | KeyManagementServiceGapicClient.cryptoKeyVersionName | public static function cryptoKeyVersionName($project, $location, $keyRing, $cryptoKey, $cryptoKeyVersion)
{
return self::getCryptoKeyVersionNameTemplate()->render([
'project' => $project,
'location' => $location,
'key_ring' => $keyRing,
'crypto_key' => $cryptoKey,
'crypto_key_version' => $cryptoKeyVersion,
]);
} | php | public static function cryptoKeyVersionName($project, $location, $keyRing, $cryptoKey, $cryptoKeyVersion)
{
return self::getCryptoKeyVersionNameTemplate()->render([
'project' => $project,
'location' => $location,
'key_ring' => $keyRing,
'crypto_key' => $cryptoKey,
'crypto_key_version' => $cryptoKeyVersion,
]);
} | [
"public",
"static",
"function",
"cryptoKeyVersionName",
"(",
"$",
"project",
",",
"$",
"location",
",",
"$",
"keyRing",
",",
"$",
"cryptoKey",
",",
"$",
"cryptoKeyVersion",
")",
"{",
"return",
"self",
"::",
"getCryptoKeyVersionNameTemplate",
"(",
")",
"->",
"render",
"(",
"[",
"'project'",
"=>",
"$",
"project",
",",
"'location'",
"=>",
"$",
"location",
",",
"'key_ring'",
"=>",
"$",
"keyRing",
",",
"'crypto_key'",
"=>",
"$",
"cryptoKey",
",",
"'crypto_key_version'",
"=>",
"$",
"cryptoKeyVersion",
",",
"]",
")",
";",
"}"
] | Formats a string containing the fully-qualified path to represent
a crypto_key_version resource.
@param string $project
@param string $location
@param string $keyRing
@param string $cryptoKey
@param string $cryptoKeyVersion
@return string The formatted crypto_key_version resource.
@experimental | [
"Formats",
"a",
"string",
"containing",
"the",
"fully",
"-",
"qualified",
"path",
"to",
"represent",
"a",
"crypto_key_version",
"resource",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Kms/src/V1/Gapic/KeyManagementServiceGapicClient.php#L298-L307 | train |
googleapis/google-cloud-php | Kms/src/V1/Gapic/KeyManagementServiceGapicClient.php | KeyManagementServiceGapicClient.keyRingName | public static function keyRingName($project, $location, $keyRing)
{
return self::getKeyRingNameTemplate()->render([
'project' => $project,
'location' => $location,
'key_ring' => $keyRing,
]);
} | php | public static function keyRingName($project, $location, $keyRing)
{
return self::getKeyRingNameTemplate()->render([
'project' => $project,
'location' => $location,
'key_ring' => $keyRing,
]);
} | [
"public",
"static",
"function",
"keyRingName",
"(",
"$",
"project",
",",
"$",
"location",
",",
"$",
"keyRing",
")",
"{",
"return",
"self",
"::",
"getKeyRingNameTemplate",
"(",
")",
"->",
"render",
"(",
"[",
"'project'",
"=>",
"$",
"project",
",",
"'location'",
"=>",
"$",
"location",
",",
"'key_ring'",
"=>",
"$",
"keyRing",
",",
"]",
")",
";",
"}"
] | Formats a string containing the fully-qualified path to represent
a key_ring resource.
@param string $project
@param string $location
@param string $keyRing
@return string The formatted key_ring resource.
@experimental | [
"Formats",
"a",
"string",
"containing",
"the",
"fully",
"-",
"qualified",
"path",
"to",
"represent",
"a",
"key_ring",
"resource",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Kms/src/V1/Gapic/KeyManagementServiceGapicClient.php#L320-L327 | train |
googleapis/google-cloud-php | Kms/src/V1/Gapic/KeyManagementServiceGapicClient.php | KeyManagementServiceGapicClient.setIamPolicy | public function setIamPolicy($resource, $policy, array $optionalArgs = [])
{
$request = new SetIamPolicyRequest();
$request->setResource($resource);
$request->setPolicy($policy);
$requestParams = new RequestParamsHeaderDescriptor([
'resource' => $request->getResource(),
]);
$optionalArgs['headers'] = isset($optionalArgs['headers'])
? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
: $requestParams->getHeader();
return $this->startCall(
'SetIamPolicy',
Policy::class,
$optionalArgs,
$request,
Call::UNARY_CALL,
'google.iam.v1.IAMPolicy'
)->wait();
} | php | public function setIamPolicy($resource, $policy, array $optionalArgs = [])
{
$request = new SetIamPolicyRequest();
$request->setResource($resource);
$request->setPolicy($policy);
$requestParams = new RequestParamsHeaderDescriptor([
'resource' => $request->getResource(),
]);
$optionalArgs['headers'] = isset($optionalArgs['headers'])
? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
: $requestParams->getHeader();
return $this->startCall(
'SetIamPolicy',
Policy::class,
$optionalArgs,
$request,
Call::UNARY_CALL,
'google.iam.v1.IAMPolicy'
)->wait();
} | [
"public",
"function",
"setIamPolicy",
"(",
"$",
"resource",
",",
"$",
"policy",
",",
"array",
"$",
"optionalArgs",
"=",
"[",
"]",
")",
"{",
"$",
"request",
"=",
"new",
"SetIamPolicyRequest",
"(",
")",
";",
"$",
"request",
"->",
"setResource",
"(",
"$",
"resource",
")",
";",
"$",
"request",
"->",
"setPolicy",
"(",
"$",
"policy",
")",
";",
"$",
"requestParams",
"=",
"new",
"RequestParamsHeaderDescriptor",
"(",
"[",
"'resource'",
"=>",
"$",
"request",
"->",
"getResource",
"(",
")",
",",
"]",
")",
";",
"$",
"optionalArgs",
"[",
"'headers'",
"]",
"=",
"isset",
"(",
"$",
"optionalArgs",
"[",
"'headers'",
"]",
")",
"?",
"array_merge",
"(",
"$",
"requestParams",
"->",
"getHeader",
"(",
")",
",",
"$",
"optionalArgs",
"[",
"'headers'",
"]",
")",
":",
"$",
"requestParams",
"->",
"getHeader",
"(",
")",
";",
"return",
"$",
"this",
"->",
"startCall",
"(",
"'SetIamPolicy'",
",",
"Policy",
"::",
"class",
",",
"$",
"optionalArgs",
",",
"$",
"request",
",",
"Call",
"::",
"UNARY_CALL",
",",
"'google.iam.v1.IAMPolicy'",
")",
"->",
"wait",
"(",
")",
";",
"}"
] | Sets the access control policy on the specified resource. Replaces any
existing policy.
Sample code:
```
$keyManagementServiceClient = new KeyManagementServiceClient();
try {
$formattedResource = $keyManagementServiceClient->keyRingName('[PROJECT]', '[LOCATION]', '[KEY_RING]');
$policy = new Policy();
$response = $keyManagementServiceClient->setIamPolicy($formattedResource, $policy);
} finally {
$keyManagementServiceClient->close();
}
```
@param string $resource REQUIRED: The resource for which the policy is being specified.
`resource` is usually specified as a path. For example, a Project
resource is specified as `projects/{project}`.
@param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of
the policy is limited to a few 10s of KB. An empty policy is a
valid policy but certain Cloud Platform services (such as Projects)
might reject them.
@param array $optionalArgs {
Optional.
@type RetrySettings|array $retrySettings
Retry settings to use for this call. Can be a
{@see Google\ApiCore\RetrySettings} object, or an associative array
of retry settings parameters. See the documentation on
{@see Google\ApiCore\RetrySettings} for example usage.
}
@return \Google\Cloud\Iam\V1\Policy
@throws ApiException if the remote call fails
@experimental | [
"Sets",
"the",
"access",
"control",
"policy",
"on",
"the",
"specified",
"resource",
".",
"Replaces",
"any",
"existing",
"policy",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Kms/src/V1/Gapic/KeyManagementServiceGapicClient.php#L1727-L1748 | train |
googleapis/google-cloud-php | Kms/src/V1/Gapic/KeyManagementServiceGapicClient.php | KeyManagementServiceGapicClient.getIamPolicy | public function getIamPolicy($resource, array $optionalArgs = [])
{
$request = new GetIamPolicyRequest();
$request->setResource($resource);
$requestParams = new RequestParamsHeaderDescriptor([
'resource' => $request->getResource(),
]);
$optionalArgs['headers'] = isset($optionalArgs['headers'])
? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
: $requestParams->getHeader();
return $this->startCall(
'GetIamPolicy',
Policy::class,
$optionalArgs,
$request,
Call::UNARY_CALL,
'google.iam.v1.IAMPolicy'
)->wait();
} | php | public function getIamPolicy($resource, array $optionalArgs = [])
{
$request = new GetIamPolicyRequest();
$request->setResource($resource);
$requestParams = new RequestParamsHeaderDescriptor([
'resource' => $request->getResource(),
]);
$optionalArgs['headers'] = isset($optionalArgs['headers'])
? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
: $requestParams->getHeader();
return $this->startCall(
'GetIamPolicy',
Policy::class,
$optionalArgs,
$request,
Call::UNARY_CALL,
'google.iam.v1.IAMPolicy'
)->wait();
} | [
"public",
"function",
"getIamPolicy",
"(",
"$",
"resource",
",",
"array",
"$",
"optionalArgs",
"=",
"[",
"]",
")",
"{",
"$",
"request",
"=",
"new",
"GetIamPolicyRequest",
"(",
")",
";",
"$",
"request",
"->",
"setResource",
"(",
"$",
"resource",
")",
";",
"$",
"requestParams",
"=",
"new",
"RequestParamsHeaderDescriptor",
"(",
"[",
"'resource'",
"=>",
"$",
"request",
"->",
"getResource",
"(",
")",
",",
"]",
")",
";",
"$",
"optionalArgs",
"[",
"'headers'",
"]",
"=",
"isset",
"(",
"$",
"optionalArgs",
"[",
"'headers'",
"]",
")",
"?",
"array_merge",
"(",
"$",
"requestParams",
"->",
"getHeader",
"(",
")",
",",
"$",
"optionalArgs",
"[",
"'headers'",
"]",
")",
":",
"$",
"requestParams",
"->",
"getHeader",
"(",
")",
";",
"return",
"$",
"this",
"->",
"startCall",
"(",
"'GetIamPolicy'",
",",
"Policy",
"::",
"class",
",",
"$",
"optionalArgs",
",",
"$",
"request",
",",
"Call",
"::",
"UNARY_CALL",
",",
"'google.iam.v1.IAMPolicy'",
")",
"->",
"wait",
"(",
")",
";",
"}"
] | Gets the access control policy for a resource.
Returns an empty policy if the resource exists and does not have a policy
set.
Sample code:
```
$keyManagementServiceClient = new KeyManagementServiceClient();
try {
$formattedResource = $keyManagementServiceClient->keyRingName('[PROJECT]', '[LOCATION]', '[KEY_RING]');
$response = $keyManagementServiceClient->getIamPolicy($formattedResource);
} finally {
$keyManagementServiceClient->close();
}
```
@param string $resource REQUIRED: The resource for which the policy is being requested.
`resource` is usually specified as a path. For example, a Project
resource is specified as `projects/{project}`.
@param array $optionalArgs {
Optional.
@type RetrySettings|array $retrySettings
Retry settings to use for this call. Can be a
{@see Google\ApiCore\RetrySettings} object, or an associative array
of retry settings parameters. See the documentation on
{@see Google\ApiCore\RetrySettings} for example usage.
}
@return \Google\Cloud\Iam\V1\Policy
@throws ApiException if the remote call fails
@experimental | [
"Gets",
"the",
"access",
"control",
"policy",
"for",
"a",
"resource",
".",
"Returns",
"an",
"empty",
"policy",
"if",
"the",
"resource",
"exists",
"and",
"does",
"not",
"have",
"a",
"policy",
"set",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Kms/src/V1/Gapic/KeyManagementServiceGapicClient.php#L1784-L1804 | train |
googleapis/google-cloud-php | Storage/src/ReadStream.php | ReadStream.getSizeFromMetadata | private function getSizeFromMetadata()
{
foreach ($this->stream->getMetadata('wrapper_data') as $value) {
if (substr($value, 0, 15) == "Content-Length:") {
return (int) substr($value, 16);
}
}
return 0;
} | php | private function getSizeFromMetadata()
{
foreach ($this->stream->getMetadata('wrapper_data') as $value) {
if (substr($value, 0, 15) == "Content-Length:") {
return (int) substr($value, 16);
}
}
return 0;
} | [
"private",
"function",
"getSizeFromMetadata",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"stream",
"->",
"getMetadata",
"(",
"'wrapper_data'",
")",
"as",
"$",
"value",
")",
"{",
"if",
"(",
"substr",
"(",
"$",
"value",
",",
"0",
",",
"15",
")",
"==",
"\"Content-Length:\"",
")",
"{",
"return",
"(",
"int",
")",
"substr",
"(",
"$",
"value",
",",
"16",
")",
";",
"}",
"}",
"return",
"0",
";",
"}"
] | Attempt to fetch the size from the Content-Length response header.
If we cannot, return 0.
@return int The Size of the stream | [
"Attempt",
"to",
"fetch",
"the",
"size",
"from",
"the",
"Content",
"-",
"Length",
"response",
"header",
".",
"If",
"we",
"cannot",
"return",
"0",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Storage/src/ReadStream.php#L61-L69 | train |
googleapis/google-cloud-php | Storage/src/ReadStream.php | ReadStream.read | public function read($length)
{
$data = '';
do {
$moreData = $this->stream->read($length);
$data .= $moreData;
$readLength = strlen($moreData);
$length -= $readLength;
} while ($length > 0 && $readLength > 0);
return $data;
} | php | public function read($length)
{
$data = '';
do {
$moreData = $this->stream->read($length);
$data .= $moreData;
$readLength = strlen($moreData);
$length -= $readLength;
} while ($length > 0 && $readLength > 0);
return $data;
} | [
"public",
"function",
"read",
"(",
"$",
"length",
")",
"{",
"$",
"data",
"=",
"''",
";",
"do",
"{",
"$",
"moreData",
"=",
"$",
"this",
"->",
"stream",
"->",
"read",
"(",
"$",
"length",
")",
";",
"$",
"data",
".=",
"$",
"moreData",
";",
"$",
"readLength",
"=",
"strlen",
"(",
"$",
"moreData",
")",
";",
"$",
"length",
"-=",
"$",
"readLength",
";",
"}",
"while",
"(",
"$",
"length",
">",
"0",
"&&",
"$",
"readLength",
">",
"0",
")",
";",
"return",
"$",
"data",
";",
"}"
] | Read bytes from the underlying buffer, retrying until we have read
enough bytes or we cannot read any more. We do this because the
internal C code for filling a buffer does not account for when
we try to read large chunks from a user-land stream that does not
return enough bytes.
@param int $length The number of bytes to read.
@return string Read bytes from the underlying stream. | [
"Read",
"bytes",
"from",
"the",
"underlying",
"buffer",
"retrying",
"until",
"we",
"have",
"read",
"enough",
"bytes",
"or",
"we",
"cannot",
"read",
"any",
"more",
".",
"We",
"do",
"this",
"because",
"the",
"internal",
"C",
"code",
"for",
"filling",
"a",
"buffer",
"does",
"not",
"account",
"for",
"when",
"we",
"try",
"to",
"read",
"large",
"chunks",
"from",
"a",
"user",
"-",
"land",
"stream",
"that",
"does",
"not",
"return",
"enough",
"bytes",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Storage/src/ReadStream.php#L81-L92 | train |
googleapis/google-cloud-php | Talent/src/V4beta1/CommuteFilter.php | CommuteFilter.setCommuteMethod | public function setCommuteMethod($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Talent\V4beta1\CommuteMethod::class);
$this->commute_method = $var;
return $this;
} | php | public function setCommuteMethod($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Talent\V4beta1\CommuteMethod::class);
$this->commute_method = $var;
return $this;
} | [
"public",
"function",
"setCommuteMethod",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Talent",
"\\",
"V4beta1",
"\\",
"CommuteMethod",
"::",
"class",
")",
";",
"$",
"this",
"->",
"commute_method",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | Required.
The method of transportation for which to calculate the commute time.
Generated from protobuf field <code>.google.cloud.talent.v4beta1.CommuteMethod commute_method = 1;</code>
@param int $var
@return $this | [
"Required",
".",
"The",
"method",
"of",
"transportation",
"for",
"which",
"to",
"calculate",
"the",
"commute",
"time",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Talent/src/V4beta1/CommuteFilter.php#L114-L120 | train |
googleapis/google-cloud-php | Talent/src/V4beta1/CommuteFilter.php | CommuteFilter.setRoadTraffic | public function setRoadTraffic($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Talent\V4beta1\CommuteFilter_RoadTraffic::class);
$this->writeOneof(5, $var);
return $this;
} | php | public function setRoadTraffic($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Talent\V4beta1\CommuteFilter_RoadTraffic::class);
$this->writeOneof(5, $var);
return $this;
} | [
"public",
"function",
"setRoadTraffic",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkEnum",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Talent",
"\\",
"V4beta1",
"\\",
"CommuteFilter_RoadTraffic",
"::",
"class",
")",
";",
"$",
"this",
"->",
"writeOneof",
"(",
"5",
",",
"$",
"var",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Optional.
Specifies the traffic density to use when calculating commute time.
Generated from protobuf field <code>.google.cloud.talent.v4beta1.CommuteFilter.RoadTraffic road_traffic = 5;</code>
@param int $var
@return $this | [
"Optional",
".",
"Specifies",
"the",
"traffic",
"density",
"to",
"use",
"when",
"calculating",
"commute",
"time",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Talent/src/V4beta1/CommuteFilter.php#L238-L244 | train |
googleapis/google-cloud-php | dev/src/DocGenerator/DocGenerator.php | DocGenerator.generate | public function generate($basePath, $pretty)
{
$fileReflectorRegister = new ReflectorRegister();
$rootPath = $this->executionPath;
foreach ($this->files as $file) {
$currentFileArr = $this->isComponent
? explode("/$basePath/", $file)
: explode("$rootPath", $file);
if (isset($currentFileArr[1])) {
$currentFile = str_replace('src/', '', $currentFileArr[1]);
} else {
throw new \Exception(
sprintf('Failed to determine currentFile: %s', $file)
);
}
$isPhp = strrpos($file, '.php') == strlen($file) - strlen('.php');
$pathInfo = pathinfo($currentFile);
$servicePath = $pathInfo['dirname'] === '.'
? strtolower($pathInfo['filename'])
: strtolower($pathInfo['dirname'] . '/' . $pathInfo['filename']);
$id = $this->isComponent
? strtolower($basePath) . '/' . $servicePath
: $servicePath;
if ($isPhp) {
$parser = new CodeParser(
$file,
$fileReflectorRegister,
$rootPath,
$this->componentId,
$this->manifestPath,
$this->release,
$this->output,
$id,
$this->isComponent
);
} else {
$content = file_get_contents($file);
$parser = new MarkdownParser($currentFile, $content, $id);
}
$document = $parser->parse();
if ($document) {
$writer = new Writer($document, $this->outputPath, $pretty);
$writer->write($currentFile);
$this->types->addType([
'id' => $id,
'title' => $document['title'],
'contents' => $servicePath . '.json'
]);
}
}
} | php | public function generate($basePath, $pretty)
{
$fileReflectorRegister = new ReflectorRegister();
$rootPath = $this->executionPath;
foreach ($this->files as $file) {
$currentFileArr = $this->isComponent
? explode("/$basePath/", $file)
: explode("$rootPath", $file);
if (isset($currentFileArr[1])) {
$currentFile = str_replace('src/', '', $currentFileArr[1]);
} else {
throw new \Exception(
sprintf('Failed to determine currentFile: %s', $file)
);
}
$isPhp = strrpos($file, '.php') == strlen($file) - strlen('.php');
$pathInfo = pathinfo($currentFile);
$servicePath = $pathInfo['dirname'] === '.'
? strtolower($pathInfo['filename'])
: strtolower($pathInfo['dirname'] . '/' . $pathInfo['filename']);
$id = $this->isComponent
? strtolower($basePath) . '/' . $servicePath
: $servicePath;
if ($isPhp) {
$parser = new CodeParser(
$file,
$fileReflectorRegister,
$rootPath,
$this->componentId,
$this->manifestPath,
$this->release,
$this->output,
$id,
$this->isComponent
);
} else {
$content = file_get_contents($file);
$parser = new MarkdownParser($currentFile, $content, $id);
}
$document = $parser->parse();
if ($document) {
$writer = new Writer($document, $this->outputPath, $pretty);
$writer->write($currentFile);
$this->types->addType([
'id' => $id,
'title' => $document['title'],
'contents' => $servicePath . '.json'
]);
}
}
} | [
"public",
"function",
"generate",
"(",
"$",
"basePath",
",",
"$",
"pretty",
")",
"{",
"$",
"fileReflectorRegister",
"=",
"new",
"ReflectorRegister",
"(",
")",
";",
"$",
"rootPath",
"=",
"$",
"this",
"->",
"executionPath",
";",
"foreach",
"(",
"$",
"this",
"->",
"files",
"as",
"$",
"file",
")",
"{",
"$",
"currentFileArr",
"=",
"$",
"this",
"->",
"isComponent",
"?",
"explode",
"(",
"\"/$basePath/\"",
",",
"$",
"file",
")",
":",
"explode",
"(",
"\"$rootPath\"",
",",
"$",
"file",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"currentFileArr",
"[",
"1",
"]",
")",
")",
"{",
"$",
"currentFile",
"=",
"str_replace",
"(",
"'src/'",
",",
"''",
",",
"$",
"currentFileArr",
"[",
"1",
"]",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"sprintf",
"(",
"'Failed to determine currentFile: %s'",
",",
"$",
"file",
")",
")",
";",
"}",
"$",
"isPhp",
"=",
"strrpos",
"(",
"$",
"file",
",",
"'.php'",
")",
"==",
"strlen",
"(",
"$",
"file",
")",
"-",
"strlen",
"(",
"'.php'",
")",
";",
"$",
"pathInfo",
"=",
"pathinfo",
"(",
"$",
"currentFile",
")",
";",
"$",
"servicePath",
"=",
"$",
"pathInfo",
"[",
"'dirname'",
"]",
"===",
"'.'",
"?",
"strtolower",
"(",
"$",
"pathInfo",
"[",
"'filename'",
"]",
")",
":",
"strtolower",
"(",
"$",
"pathInfo",
"[",
"'dirname'",
"]",
".",
"'/'",
".",
"$",
"pathInfo",
"[",
"'filename'",
"]",
")",
";",
"$",
"id",
"=",
"$",
"this",
"->",
"isComponent",
"?",
"strtolower",
"(",
"$",
"basePath",
")",
".",
"'/'",
".",
"$",
"servicePath",
":",
"$",
"servicePath",
";",
"if",
"(",
"$",
"isPhp",
")",
"{",
"$",
"parser",
"=",
"new",
"CodeParser",
"(",
"$",
"file",
",",
"$",
"fileReflectorRegister",
",",
"$",
"rootPath",
",",
"$",
"this",
"->",
"componentId",
",",
"$",
"this",
"->",
"manifestPath",
",",
"$",
"this",
"->",
"release",
",",
"$",
"this",
"->",
"output",
",",
"$",
"id",
",",
"$",
"this",
"->",
"isComponent",
")",
";",
"}",
"else",
"{",
"$",
"content",
"=",
"file_get_contents",
"(",
"$",
"file",
")",
";",
"$",
"parser",
"=",
"new",
"MarkdownParser",
"(",
"$",
"currentFile",
",",
"$",
"content",
",",
"$",
"id",
")",
";",
"}",
"$",
"document",
"=",
"$",
"parser",
"->",
"parse",
"(",
")",
";",
"if",
"(",
"$",
"document",
")",
"{",
"$",
"writer",
"=",
"new",
"Writer",
"(",
"$",
"document",
",",
"$",
"this",
"->",
"outputPath",
",",
"$",
"pretty",
")",
";",
"$",
"writer",
"->",
"write",
"(",
"$",
"currentFile",
")",
";",
"$",
"this",
"->",
"types",
"->",
"addType",
"(",
"[",
"'id'",
"=>",
"$",
"id",
",",
"'title'",
"=>",
"$",
"document",
"[",
"'title'",
"]",
",",
"'contents'",
"=>",
"$",
"servicePath",
".",
"'.json'",
"]",
")",
";",
"}",
"}",
"}"
] | Generates JSON documentation from provided files.
@return void | [
"Generates",
"JSON",
"documentation",
"from",
"provided",
"files",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/dev/src/DocGenerator/DocGenerator.php#L78-L134 | train |
googleapis/google-cloud-php | Dlp/src/V2/CustomInfoType/Dictionary.php | Dictionary.setWordList | public function setWordList($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\CustomInfoType_Dictionary_WordList::class);
$this->writeOneof(1, $var);
return $this;
} | php | public function setWordList($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\CustomInfoType_Dictionary_WordList::class);
$this->writeOneof(1, $var);
return $this;
} | [
"public",
"function",
"setWordList",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dlp",
"\\",
"V2",
"\\",
"CustomInfoType_Dictionary_WordList",
"::",
"class",
")",
";",
"$",
"this",
"->",
"writeOneof",
"(",
"1",
",",
"$",
"var",
")",
";",
"return",
"$",
"this",
";",
"}"
] | List of words or phrases to search for.
Generated from protobuf field <code>.google.privacy.dlp.v2.CustomInfoType.Dictionary.WordList word_list = 1;</code>
@param \Google\Cloud\Dlp\V2\CustomInfoType\Dictionary\WordList $var
@return $this | [
"List",
"of",
"words",
"or",
"phrases",
"to",
"search",
"for",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/CustomInfoType/Dictionary.php#L76-L82 | train |
googleapis/google-cloud-php | Dlp/src/V2/CustomInfoType/Dictionary.php | Dictionary.setCloudStoragePath | public function setCloudStoragePath($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\CloudStoragePath::class);
$this->writeOneof(3, $var);
return $this;
} | php | public function setCloudStoragePath($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\CloudStoragePath::class);
$this->writeOneof(3, $var);
return $this;
} | [
"public",
"function",
"setCloudStoragePath",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Dlp",
"\\",
"V2",
"\\",
"CloudStoragePath",
"::",
"class",
")",
";",
"$",
"this",
"->",
"writeOneof",
"(",
"3",
",",
"$",
"var",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Newline-delimited file of words in Cloud Storage. Only a single file
is accepted.
Generated from protobuf field <code>.google.privacy.dlp.v2.CloudStoragePath cloud_storage_path = 3;</code>
@param \Google\Cloud\Dlp\V2\CloudStoragePath $var
@return $this | [
"Newline",
"-",
"delimited",
"file",
"of",
"words",
"in",
"Cloud",
"Storage",
".",
"Only",
"a",
"single",
"file",
"is",
"accepted",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/CustomInfoType/Dictionary.php#L104-L110 | train |
googleapis/google-cloud-php | Firestore/src/V1beta1/StructuredQuery/FieldFilter.php | FieldFilter.setValue | public function setValue($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1beta1\Value::class);
$this->value = $var;
return $this;
} | php | public function setValue($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1beta1\Value::class);
$this->value = $var;
return $this;
} | [
"public",
"function",
"setValue",
"(",
"$",
"var",
")",
"{",
"GPBUtil",
"::",
"checkMessage",
"(",
"$",
"var",
",",
"\\",
"Google",
"\\",
"Cloud",
"\\",
"Firestore",
"\\",
"V1beta1",
"\\",
"Value",
"::",
"class",
")",
";",
"$",
"this",
"->",
"value",
"=",
"$",
"var",
";",
"return",
"$",
"this",
";",
"}"
] | The value to compare to.
Generated from protobuf field <code>.google.firestore.v1beta1.Value value = 3;</code>
@param \Google\Cloud\Firestore\V1beta1\Value $var
@return $this | [
"The",
"value",
"to",
"compare",
"to",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/V1beta1/StructuredQuery/FieldFilter.php#L126-L132 | train |
googleapis/google-cloud-php | BigQuery/src/BigQueryClient.php | BigQueryClient.runQuery | public function runQuery(JobConfigurationInterface $query, array $options = [])
{
$queryResultsOptions = $this->pluckArray([
'maxResults',
'startIndex',
'timeoutMs',
'maxRetries'
], $options);
$queryResultsOptions['initialTimeoutMs'] = 10000;
$queryResults = $this->startQuery(
$query,
$options
)->queryResults($queryResultsOptions + $options);
$queryResults->waitUntilComplete();
return $queryResults;
} | php | public function runQuery(JobConfigurationInterface $query, array $options = [])
{
$queryResultsOptions = $this->pluckArray([
'maxResults',
'startIndex',
'timeoutMs',
'maxRetries'
], $options);
$queryResultsOptions['initialTimeoutMs'] = 10000;
$queryResults = $this->startQuery(
$query,
$options
)->queryResults($queryResultsOptions + $options);
$queryResults->waitUntilComplete();
return $queryResults;
} | [
"public",
"function",
"runQuery",
"(",
"JobConfigurationInterface",
"$",
"query",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"queryResultsOptions",
"=",
"$",
"this",
"->",
"pluckArray",
"(",
"[",
"'maxResults'",
",",
"'startIndex'",
",",
"'timeoutMs'",
",",
"'maxRetries'",
"]",
",",
"$",
"options",
")",
";",
"$",
"queryResultsOptions",
"[",
"'initialTimeoutMs'",
"]",
"=",
"10000",
";",
"$",
"queryResults",
"=",
"$",
"this",
"->",
"startQuery",
"(",
"$",
"query",
",",
"$",
"options",
")",
"->",
"queryResults",
"(",
"$",
"queryResultsOptions",
"+",
"$",
"options",
")",
";",
"$",
"queryResults",
"->",
"waitUntilComplete",
"(",
")",
";",
"return",
"$",
"queryResults",
";",
"}"
] | Runs a BigQuery SQL query in a synchronous fashion.
Unless `$options.maxRetries` is specified, this method will block until
the query completes, at which time the result set will be returned.
Queries constructed using
[standard SQL](https://cloud.google.com/bigquery/docs/reference/standard-sql/)
can take advantage of parameterization.
Refer to the table below for a guide on how parameter types are mapped to
their BigQuery equivalents.
| **PHP Type** | **BigQuery Data Type** |
|--------------------------------------------|--------------------------------------|
| `\DateTimeInterface` | `DATETIME` |
| {@see Google\Cloud\BigQuery\Bytes} | `BYTES` |
| {@see Google\Cloud\BigQuery\Date} | `DATE` |
| {@see Google\Cloud\Core\Int64} | `INT64` |
| {@see Google\Cloud\BigQuery\Time} | `TIME` |
| {@see Google\Cloud\BigQuery\Timestamp} | `TIMESTAMP` |
| Associative Array | `STRUCT` |
| Non-Associative Array | `ARRAY` |
| `float` | `FLOAT64` |
| `int` | `INT64` |
| `string` | `STRING` |
| `resource` | `BYTES` |
| `bool` | `BOOL` |
| `object` (Outside types specified above) | **ERROR** `InvalidArgumentException` |
Example:
```
$queryJobConfig = $bigQuery->query(
'SELECT commit FROM `bigquery-public-data.github_repos.commits` LIMIT 100'
);
$queryResults = $bigQuery->runQuery($queryJobConfig);
foreach ($queryResults as $row) {
echo $row['commit'];
}
```
```
// Construct a query utilizing named parameters.
$query = 'SELECT commit FROM `bigquery-public-data.github_repos.commits`' .
'WHERE author.date < @date AND message = @message LIMIT 100';
$queryJobConfig = $bigQuery->query($query)
->parameters([
'date' => $bigQuery->timestamp(new \DateTime('1980-01-01 12:15:00Z')),
'message' => 'A commit message.'
]);
$queryResults = $bigQuery->runQuery($queryJobConfig);
foreach ($queryResults as $row) {
echo $row['commit'];
}
```
```
// Construct a query utilizing positional parameters.
$query = 'SELECT commit FROM `bigquery-public-data.github_repos.commits` WHERE message = ? LIMIT 100';
$queryJobConfig = $bigQuery->query($query)
->parameters(['A commit message.']);
$queryResults = $bigQuery->runQuery($queryJobConfig);
foreach ($queryResults as $row) {
echo $row['commit'];
}
```
@see https://cloud.google.com/bigquery/docs/reference/v2/jobs/query Query API documentation.
@param QueryJobConfiguration $query A BigQuery SQL query configuration.
@param array $options [optional] {
Configuration options.
@type int $maxResults The maximum number of rows to return per page
of results. Setting this flag to a small value such as 1000 and
then paging through results might improve reliability when the
query result set is large.
@type int $startIndex Zero-based index of the starting row.
@type int $timeoutMs How long, in milliseconds, each API call will
wait for query results to become available before timing out.
Depending on whether the $maxRetries has been exceeded, the
results will be polled again after the timeout has been reached.
**Defaults to** `10000` milliseconds (10 seconds).
@type int $maxRetries The number of times to poll the Job status,
until the job is complete. By default, will poll indefinitely.
}
@return QueryResults
@throws JobException If the maximum number of retries while waiting for
query completion has been exceeded. | [
"Runs",
"a",
"BigQuery",
"SQL",
"query",
"in",
"a",
"synchronous",
"fashion",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/BigQuery/src/BigQueryClient.php#L324-L340 | train |
googleapis/google-cloud-php | BigQuery/src/BigQueryClient.php | BigQueryClient.startQuery | public function startQuery(JobConfigurationInterface $query, array $options = [])
{
$config = $query->toArray();
$response = $this->connection->insertJob($config + $options);
return new Job(
$this->connection,
$config['jobReference']['jobId'],
$this->projectId,
$this->mapper,
$response
);
} | php | public function startQuery(JobConfigurationInterface $query, array $options = [])
{
$config = $query->toArray();
$response = $this->connection->insertJob($config + $options);
return new Job(
$this->connection,
$config['jobReference']['jobId'],
$this->projectId,
$this->mapper,
$response
);
} | [
"public",
"function",
"startQuery",
"(",
"JobConfigurationInterface",
"$",
"query",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"config",
"=",
"$",
"query",
"->",
"toArray",
"(",
")",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"connection",
"->",
"insertJob",
"(",
"$",
"config",
"+",
"$",
"options",
")",
";",
"return",
"new",
"Job",
"(",
"$",
"this",
"->",
"connection",
",",
"$",
"config",
"[",
"'jobReference'",
"]",
"[",
"'jobId'",
"]",
",",
"$",
"this",
"->",
"projectId",
",",
"$",
"this",
"->",
"mapper",
",",
"$",
"response",
")",
";",
"}"
] | Runs a BigQuery SQL query in an asynchronous fashion.
Queries constructed using
[standard SQL](https://cloud.google.com/bigquery/docs/reference/standard-sql/)
can take advantage of parameterization. For more details and examples
please see {@see Google\Cloud\BigQuery\BigQueryClient::runQuery()}.
Example:
```
$queryJobConfig = $bigQuery->query(
'SELECT commit FROM `bigquery-public-data.github_repos.commits` LIMIT 100'
);
$job = $bigQuery->startQuery($queryJobConfig);
$queryResults = $job->queryResults();
foreach ($queryResults as $row) {
echo $row['commit'];
}
```
@see https://cloud.google.com/bigquery/docs/reference/v2/jobs/insert Jobs insert API documentation.
@param QueryJobConfiguration $query A BigQuery SQL query configuration.
@param array $options [optional] Configuration options.
@return Job | [
"Runs",
"a",
"BigQuery",
"SQL",
"query",
"in",
"an",
"asynchronous",
"fashion",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/BigQuery/src/BigQueryClient.php#L369-L381 | train |
googleapis/google-cloud-php | BigQuery/src/BigQueryClient.php | BigQueryClient.jobs | public function jobs(array $options = [])
{
$resultLimit = $this->pluck('resultLimit', $options, false);
return new ItemIterator(
new PageIterator(
function (array $job) {
return new Job(
$this->connection,
$job['jobReference']['jobId'],
$this->projectId,
$this->mapper,
$job
);
},
[$this->connection, 'listJobs'],
$options + ['projectId' => $this->projectId],
[
'itemsKey' => 'jobs',
'resultLimit' => $resultLimit
]
)
);
} | php | public function jobs(array $options = [])
{
$resultLimit = $this->pluck('resultLimit', $options, false);
return new ItemIterator(
new PageIterator(
function (array $job) {
return new Job(
$this->connection,
$job['jobReference']['jobId'],
$this->projectId,
$this->mapper,
$job
);
},
[$this->connection, 'listJobs'],
$options + ['projectId' => $this->projectId],
[
'itemsKey' => 'jobs',
'resultLimit' => $resultLimit
]
)
);
} | [
"public",
"function",
"jobs",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"resultLimit",
"=",
"$",
"this",
"->",
"pluck",
"(",
"'resultLimit'",
",",
"$",
"options",
",",
"false",
")",
";",
"return",
"new",
"ItemIterator",
"(",
"new",
"PageIterator",
"(",
"function",
"(",
"array",
"$",
"job",
")",
"{",
"return",
"new",
"Job",
"(",
"$",
"this",
"->",
"connection",
",",
"$",
"job",
"[",
"'jobReference'",
"]",
"[",
"'jobId'",
"]",
",",
"$",
"this",
"->",
"projectId",
",",
"$",
"this",
"->",
"mapper",
",",
"$",
"job",
")",
";",
"}",
",",
"[",
"$",
"this",
"->",
"connection",
",",
"'listJobs'",
"]",
",",
"$",
"options",
"+",
"[",
"'projectId'",
"=>",
"$",
"this",
"->",
"projectId",
"]",
",",
"[",
"'itemsKey'",
"=>",
"'jobs'",
",",
"'resultLimit'",
"=>",
"$",
"resultLimit",
"]",
")",
")",
";",
"}"
] | Fetches jobs in the project.
Example:
```
// Get all jobs with the state of 'done'
$jobs = $bigQuery->jobs([
'stateFilter' => 'done'
]);
foreach ($jobs as $job) {
echo $job->id() . PHP_EOL;
}
```
@see https://cloud.google.com/bigquery/docs/reference/v2/jobs/list Jobs list API documentation.
@param array $options [optional] {
Configuration options.
@type bool $allUsers Whether to display jobs owned by all users in
the project. **Defaults to** `false`.
@type int $maxResults Maximum number of results to return per page.
@type int $resultLimit Limit the number of results returned in total.
**Defaults to** `0` (return all results).
@type string $pageToken A previously-returned page token used to
resume the loading of results from a specific point.
@type string $stateFilter Filter for job state. Maybe be either
`done`, `pending`, or `running`.
@type int $maxCreationTime Milliseconds since the POSIX epoch. If set, only jobs created
before or at this timestamp are returned.
@type int $minCreationTime Milliseconds since the POSIX epoch. If set, only jobs created
after or at this timestamp are returned.
}
@return ItemIterator<Job> | [
"Fetches",
"jobs",
"in",
"the",
"project",
"."
] | ff5030ffa1f12904565509a7bc24ecc0bd794a3e | https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/BigQuery/src/BigQueryClient.php#L454-L477 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.