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
Dialogflow/src/V2/Intent/Parameter.php
Parameter.setPrompts
public function setPrompts($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); $this->prompts = $arr; return $this; }
php
public function setPrompts($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); $this->prompts = $arr; return $this; }
[ "public", "function", "setPrompts", "(", "$", "var", ")", "{", "$", "arr", "=", "GPBUtil", "::", "checkRepeatedField", "(", "$", "var", ",", "\\", "Google", "\\", "Protobuf", "\\", "Internal", "\\", "GPBType", "::", "STRING", ")", ";", "$", "this", "->", "prompts", "=", "$", "arr", ";", "return", "$", "this", ";", "}" ]
Optional. The collection of prompts that the agent can present to the user in order to collect value for the parameter. Generated from protobuf field <code>repeated string prompts = 7;</code> @param string[]|\Google\Protobuf\Internal\RepeatedField $var @return $this
[ "Optional", ".", "The", "collection", "of", "prompts", "that", "the", "agent", "can", "present", "to", "the", "user", "in", "order", "to", "collect", "value", "for", "the", "parameter", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dialogflow/src/V2/Intent/Parameter.php#L322-L328
train
googleapis/google-cloud-php
Dlp/src/V2/DateShiftConfig.php
DateShiftConfig.setCryptoKey
public function setCryptoKey($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\CryptoKey::class); $this->writeOneof(4, $var); return $this; }
php
public function setCryptoKey($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\CryptoKey::class); $this->writeOneof(4, $var); return $this; }
[ "public", "function", "setCryptoKey", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Dlp", "\\", "V2", "\\", "CryptoKey", "::", "class", ")", ";", "$", "this", "->", "writeOneof", "(", "4", ",", "$", "var", ")", ";", "return", "$", "this", ";", "}" ]
Causes the shift to be computed based on this key and the context. This results in the same shift for the same context and crypto_key. Generated from protobuf field <code>.google.privacy.dlp.v2.CryptoKey crypto_key = 4;</code> @param \Google\Cloud\Dlp\V2\CryptoKey $var @return $this
[ "Causes", "the", "shift", "to", "be", "computed", "based", "on", "this", "key", "and", "the", "context", ".", "This", "results", "in", "the", "same", "shift", "for", "the", "same", "context", "and", "crypto_key", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/DateShiftConfig.php#L188-L194
train
googleapis/google-cloud-php
PubSub/src/PubSubClient.php
PubSubClient.topics
public function topics(array $options = []) { $resultLimit = $this->pluck('resultLimit', $options, false); return new ItemIterator( new PageIterator( function (array $topic) { return $this->topicFactory($topic['name'], $topic); }, [$this->connection, 'listTopics'], $options + ['project' => $this->formatName('project', $this->projectId)], [ 'itemsKey' => 'topics', 'resultLimit' => $resultLimit ] ) ); }
php
public function topics(array $options = []) { $resultLimit = $this->pluck('resultLimit', $options, false); return new ItemIterator( new PageIterator( function (array $topic) { return $this->topicFactory($topic['name'], $topic); }, [$this->connection, 'listTopics'], $options + ['project' => $this->formatName('project', $this->projectId)], [ 'itemsKey' => 'topics', 'resultLimit' => $resultLimit ] ) ); }
[ "public", "function", "topics", "(", "array", "$", "options", "=", "[", "]", ")", "{", "$", "resultLimit", "=", "$", "this", "->", "pluck", "(", "'resultLimit'", ",", "$", "options", ",", "false", ")", ";", "return", "new", "ItemIterator", "(", "new", "PageIterator", "(", "function", "(", "array", "$", "topic", ")", "{", "return", "$", "this", "->", "topicFactory", "(", "$", "topic", "[", "'name'", "]", ",", "$", "topic", ")", ";", "}", ",", "[", "$", "this", "->", "connection", ",", "'listTopics'", "]", ",", "$", "options", "+", "[", "'project'", "=>", "$", "this", "->", "formatName", "(", "'project'", ",", "$", "this", "->", "projectId", ")", "]", ",", "[", "'itemsKey'", "=>", "'topics'", ",", "'resultLimit'", "=>", "$", "resultLimit", "]", ")", ")", ";", "}" ]
Get a list of the topics registered to your project. Example: ``` $topics = $pubsub->topics(); foreach ($topics as $topic) { $info = $topic->info(); echo $info['name']; // `projects/my-awesome-project/topics/my-new-topic` } ``` @see https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics/list List Topics @param array $options [optional] { Configuration Options @type int $pageSize Maximum number of results to return per request. @type int $resultLimit Limit the number of results returned in total. **Defaults to** `0` (return all results). @type string $pageToken A previously-returned page token used to resume the loading of results from a specific point. } @return ItemIterator<Topic>
[ "Get", "a", "list", "of", "the", "topics", "registered", "to", "your", "project", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/PubSub/src/PubSubClient.php#L238-L255
train
googleapis/google-cloud-php
PubSub/src/PubSubClient.php
PubSubClient.subscriptions
public function subscriptions(array $options = []) { $resultLimit = $this->pluck('resultLimit', $options, false); return new ItemIterator( new PageIterator( function (array $subscription) { return $this->subscriptionFactory( $subscription['name'], $subscription['topic'], $subscription ); }, [$this->connection, 'listSubscriptions'], $options + ['project' => $this->formatName('project', $this->projectId)], [ 'itemsKey' => 'subscriptions', 'resultLimit' => $resultLimit ] ) ); }
php
public function subscriptions(array $options = []) { $resultLimit = $this->pluck('resultLimit', $options, false); return new ItemIterator( new PageIterator( function (array $subscription) { return $this->subscriptionFactory( $subscription['name'], $subscription['topic'], $subscription ); }, [$this->connection, 'listSubscriptions'], $options + ['project' => $this->formatName('project', $this->projectId)], [ 'itemsKey' => 'subscriptions', 'resultLimit' => $resultLimit ] ) ); }
[ "public", "function", "subscriptions", "(", "array", "$", "options", "=", "[", "]", ")", "{", "$", "resultLimit", "=", "$", "this", "->", "pluck", "(", "'resultLimit'", ",", "$", "options", ",", "false", ")", ";", "return", "new", "ItemIterator", "(", "new", "PageIterator", "(", "function", "(", "array", "$", "subscription", ")", "{", "return", "$", "this", "->", "subscriptionFactory", "(", "$", "subscription", "[", "'name'", "]", ",", "$", "subscription", "[", "'topic'", "]", ",", "$", "subscription", ")", ";", "}", ",", "[", "$", "this", "->", "connection", ",", "'listSubscriptions'", "]", ",", "$", "options", "+", "[", "'project'", "=>", "$", "this", "->", "formatName", "(", "'project'", ",", "$", "this", "->", "projectId", ")", "]", ",", "[", "'itemsKey'", "=>", "'subscriptions'", ",", "'resultLimit'", "=>", "$", "resultLimit", "]", ")", ")", ";", "}" ]
Get a list of the subscriptions registered to all of your project's topics. Example: ``` $subscriptions = $pubsub->subscriptions(); foreach ($subscriptions as $subscription) { $info = $subscription->info(); echo $info['name']; // `projects/my-awesome-project/subscriptions/<subscription-name>` } ``` @see https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.subscriptions/list List Subscriptions @param array $options [optional] { Configuration Options @type int $pageSize Maximum number of results to return per request. @type int $resultLimit Limit the number of results returned in total. **Defaults to** `0` (return all results). @type string $pageToken A previously-returned page token used to resume the loading of results from a specific point. } @return ItemIterator<Subscription>
[ "Get", "a", "list", "of", "the", "subscriptions", "registered", "to", "all", "of", "your", "project", "s", "topics", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/PubSub/src/PubSubClient.php#L337-L358
train
googleapis/google-cloud-php
PubSub/src/PubSubClient.php
PubSubClient.snapshot
public function snapshot($name, array $info = []) { return new Snapshot($this->connection, $this->projectId, $name, $this->encode, $info); }
php
public function snapshot($name, array $info = []) { return new Snapshot($this->connection, $this->projectId, $name, $this->encode, $info); }
[ "public", "function", "snapshot", "(", "$", "name", ",", "array", "$", "info", "=", "[", "]", ")", "{", "return", "new", "Snapshot", "(", "$", "this", "->", "connection", ",", "$", "this", "->", "projectId", ",", "$", "name", ",", "$", "this", "->", "encode", ",", "$", "info", ")", ";", "}" ]
Lazily create a snapshot instance. Example: ``` $snapshot = $pubsub->snapshot('my-snapshot'); ``` @param string $name The snapshot name. @param array $info [optional] Snapshot info. @return Snapshot
[ "Lazily", "create", "a", "snapshot", "instance", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/PubSub/src/PubSubClient.php#L399-L402
train
googleapis/google-cloud-php
PubSub/src/PubSubClient.php
PubSubClient.snapshots
public function snapshots(array $options = []) { $resultLimit = $this->pluck('resultLimit', $options, false); return new ItemIterator( new PageIterator( function (array $snapshot) { return new Snapshot( $this->connection, $this->projectId, $this->pluckName('snapshot', $snapshot['name']), $this->encode, $snapshot ); }, [$this->connection, 'listSnapshots'], ['project' => $this->formatName('project', $this->projectId)] + $options, [ 'itemsKey' => 'snapshots', 'resultLimit' => $resultLimit ] ) ); }
php
public function snapshots(array $options = []) { $resultLimit = $this->pluck('resultLimit', $options, false); return new ItemIterator( new PageIterator( function (array $snapshot) { return new Snapshot( $this->connection, $this->projectId, $this->pluckName('snapshot', $snapshot['name']), $this->encode, $snapshot ); }, [$this->connection, 'listSnapshots'], ['project' => $this->formatName('project', $this->projectId)] + $options, [ 'itemsKey' => 'snapshots', 'resultLimit' => $resultLimit ] ) ); }
[ "public", "function", "snapshots", "(", "array", "$", "options", "=", "[", "]", ")", "{", "$", "resultLimit", "=", "$", "this", "->", "pluck", "(", "'resultLimit'", ",", "$", "options", ",", "false", ")", ";", "return", "new", "ItemIterator", "(", "new", "PageIterator", "(", "function", "(", "array", "$", "snapshot", ")", "{", "return", "new", "Snapshot", "(", "$", "this", "->", "connection", ",", "$", "this", "->", "projectId", ",", "$", "this", "->", "pluckName", "(", "'snapshot'", ",", "$", "snapshot", "[", "'name'", "]", ")", ",", "$", "this", "->", "encode", ",", "$", "snapshot", ")", ";", "}", ",", "[", "$", "this", "->", "connection", ",", "'listSnapshots'", "]", ",", "[", "'project'", "=>", "$", "this", "->", "formatName", "(", "'project'", ",", "$", "this", "->", "projectId", ")", "]", "+", "$", "options", ",", "[", "'itemsKey'", "=>", "'snapshots'", ",", "'resultLimit'", "=>", "$", "resultLimit", "]", ")", ")", ";", "}" ]
Get a list of the snapshots in the project. Please note that this method may not yet be available in your project. Example: ``` $snapshots = $pubsub->snapshots(); foreach ($snapshots as $snapshot) { $info = $snapshot->info(); echo $info['name']; } ``` @param array $options [optional] { Configuration Options @type int $pageSize Maximum number of results to return per request. @type int $resultLimit Limit the number of results returned in total. **Defaults to** `0` (return all results). @type string $pageToken A previously-returned page token used to resume the loading of results from a specific point. } @return ItemIterator<Snapshot>
[ "Get", "a", "list", "of", "the", "snapshots", "in", "the", "project", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/PubSub/src/PubSubClient.php#L430-L453
train
googleapis/google-cloud-php
PubSub/src/PubSubClient.php
PubSubClient.consume
public function consume(array $requestData) { return $this->messageFactory($requestData, $this->connection, $this->projectId, $this->encode); }
php
public function consume(array $requestData) { return $this->messageFactory($requestData, $this->connection, $this->projectId, $this->encode); }
[ "public", "function", "consume", "(", "array", "$", "requestData", ")", "{", "return", "$", "this", "->", "messageFactory", "(", "$", "requestData", ",", "$", "this", "->", "connection", ",", "$", "this", "->", "projectId", ",", "$", "this", "->", "encode", ")", ";", "}" ]
Consume an incoming message and return a PubSub Message. This method is for use with push delivery only. Example: ``` $httpPostRequestBody = file_get_contents('php://input'); $requestData = json_decode($httpPostRequestBody, true); $message = $pubsub->consume($requestData); ``` @param array $requestBody The HTTP Request body @return Message
[ "Consume", "an", "incoming", "message", "and", "return", "a", "PubSub", "Message", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/PubSub/src/PubSubClient.php#L471-L474
train
googleapis/google-cloud-php
PubSub/src/PubSubClient.php
PubSubClient.topicFactory
private function topicFactory($name, array $info = []) { return new Topic( $this->connection, $this->projectId, $name, $this->encode, $info, $this->clientConfig ); }
php
private function topicFactory($name, array $info = []) { return new Topic( $this->connection, $this->projectId, $name, $this->encode, $info, $this->clientConfig ); }
[ "private", "function", "topicFactory", "(", "$", "name", ",", "array", "$", "info", "=", "[", "]", ")", "{", "return", "new", "Topic", "(", "$", "this", "->", "connection", ",", "$", "this", "->", "projectId", ",", "$", "name", ",", "$", "this", "->", "encode", ",", "$", "info", ",", "$", "this", "->", "clientConfig", ")", ";", "}" ]
Create an instance of a topic @codingStandardsIgnoreStart @param string $name The topic name @param array $info [optional] Information about the topic. Used internally to populate topic objects with an API result. Should be a representation of a [Topic](https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics#Topic). @return Topic @codingStandardsIgnoreEnd
[ "Create", "an", "instance", "of", "a", "topic" ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/PubSub/src/PubSubClient.php#L523-L533
train
googleapis/google-cloud-php
Talent/src/V4beta1/EmploymentRecord.php
EmploymentRecord.setAddress
public function setAddress($var) { GPBUtil::checkMessage($var, \Google\Cloud\Talent\V4beta1\Address::class); $this->address = $var; return $this; }
php
public function setAddress($var) { GPBUtil::checkMessage($var, \Google\Cloud\Talent\V4beta1\Address::class); $this->address = $var; return $this; }
[ "public", "function", "setAddress", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Talent", "\\", "V4beta1", "\\", "Address", "::", "class", ")", ";", "$", "this", "->", "address", "=", "$", "var", ";", "return", "$", "this", ";", "}" ]
Optional. The physical address of the employer. Generated from protobuf field <code>.google.cloud.talent.v4beta1.Address address = 5;</code> @param \Google\Cloud\Talent\V4beta1\Address $var @return $this
[ "Optional", ".", "The", "physical", "address", "of", "the", "employer", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Talent/src/V4beta1/EmploymentRecord.php#L378-L384
train
googleapis/google-cloud-php
AutoMl/src/V1beta1/Gapic/AutoMlGapicClient.php
AutoMlGapicClient.datasetName
public static function datasetName($project, $location, $dataset) { return self::getDatasetNameTemplate()->render([ 'project' => $project, 'location' => $location, 'dataset' => $dataset, ]); }
php
public static function datasetName($project, $location, $dataset) { return self::getDatasetNameTemplate()->render([ 'project' => $project, 'location' => $location, 'dataset' => $dataset, ]); }
[ "public", "static", "function", "datasetName", "(", "$", "project", ",", "$", "location", ",", "$", "dataset", ")", "{", "return", "self", "::", "getDatasetNameTemplate", "(", ")", "->", "render", "(", "[", "'project'", "=>", "$", "project", ",", "'location'", "=>", "$", "location", ",", "'dataset'", "=>", "$", "dataset", ",", "]", ")", ";", "}" ]
Formats a string containing the fully-qualified path to represent a dataset resource. @param string $project @param string $location @param string $dataset @return string The formatted dataset resource. @experimental
[ "Formats", "a", "string", "containing", "the", "fully", "-", "qualified", "path", "to", "represent", "a", "dataset", "resource", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/AutoMl/src/V1beta1/Gapic/AutoMlGapicClient.php#L231-L238
train
googleapis/google-cloud-php
AutoMl/src/V1beta1/Gapic/AutoMlGapicClient.php
AutoMlGapicClient.modelEvaluationName
public static function modelEvaluationName($project, $location, $model, $modelEvaluation) { return self::getModelEvaluationNameTemplate()->render([ 'project' => $project, 'location' => $location, 'model' => $model, 'model_evaluation' => $modelEvaluation, ]); }
php
public static function modelEvaluationName($project, $location, $model, $modelEvaluation) { return self::getModelEvaluationNameTemplate()->render([ 'project' => $project, 'location' => $location, 'model' => $model, 'model_evaluation' => $modelEvaluation, ]); }
[ "public", "static", "function", "modelEvaluationName", "(", "$", "project", ",", "$", "location", ",", "$", "model", ",", "$", "modelEvaluation", ")", "{", "return", "self", "::", "getModelEvaluationNameTemplate", "(", ")", "->", "render", "(", "[", "'project'", "=>", "$", "project", ",", "'location'", "=>", "$", "location", ",", "'model'", "=>", "$", "model", ",", "'model_evaluation'", "=>", "$", "modelEvaluation", ",", "]", ")", ";", "}" ]
Formats a string containing the fully-qualified path to represent a model_evaluation resource. @param string $project @param string $location @param string $model @param string $modelEvaluation @return string The formatted model_evaluation resource. @experimental
[ "Formats", "a", "string", "containing", "the", "fully", "-", "qualified", "path", "to", "represent", "a", "model_evaluation", "resource", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/AutoMl/src/V1beta1/Gapic/AutoMlGapicClient.php#L272-L280
train
googleapis/google-cloud-php
Firestore/src/Query.php
Query.documents
public function documents(array $options = []) { $maxRetries = $this->pluck('maxRetries', $options, false); $maxRetries = $maxRetries === null ? FirestoreClient::MAX_RETRIES : $maxRetries; $rows = (new ExponentialBackoff($maxRetries))->execute(function () use ($options) { $query = $this->finalQueryPrepare($this->query); $generator = $this->connection->runQuery($this->arrayFilterRemoveNull([ 'parent' => $this->parent, 'structuredQuery' => $query, 'retries' => 0 ]) + $options); // cache collection references $collections = []; $out = []; while ($generator->valid()) { $result = $generator->current(); if (isset($result['document']) && $result['document']) { $collectionName = $this->parentPath($result['document']['name']); if (!isset($collections[$collectionName])) { $collections[$collectionName] = new CollectionReference( $this->connection, $this->valueMapper, $collectionName ); } $ref = new DocumentReference( $this->connection, $this->valueMapper, $collections[$collectionName], $result['document']['name'] ); $document = $result['document']; $document['readTime'] = $result['readTime']; $out[] = $this->createSnapshotWithData($this->valueMapper, $ref, $document); } $generator->next(); } return $out; }); return new QuerySnapshot($this, $rows); }
php
public function documents(array $options = []) { $maxRetries = $this->pluck('maxRetries', $options, false); $maxRetries = $maxRetries === null ? FirestoreClient::MAX_RETRIES : $maxRetries; $rows = (new ExponentialBackoff($maxRetries))->execute(function () use ($options) { $query = $this->finalQueryPrepare($this->query); $generator = $this->connection->runQuery($this->arrayFilterRemoveNull([ 'parent' => $this->parent, 'structuredQuery' => $query, 'retries' => 0 ]) + $options); // cache collection references $collections = []; $out = []; while ($generator->valid()) { $result = $generator->current(); if (isset($result['document']) && $result['document']) { $collectionName = $this->parentPath($result['document']['name']); if (!isset($collections[$collectionName])) { $collections[$collectionName] = new CollectionReference( $this->connection, $this->valueMapper, $collectionName ); } $ref = new DocumentReference( $this->connection, $this->valueMapper, $collections[$collectionName], $result['document']['name'] ); $document = $result['document']; $document['readTime'] = $result['readTime']; $out[] = $this->createSnapshotWithData($this->valueMapper, $ref, $document); } $generator->next(); } return $out; }); return new QuerySnapshot($this, $rows); }
[ "public", "function", "documents", "(", "array", "$", "options", "=", "[", "]", ")", "{", "$", "maxRetries", "=", "$", "this", "->", "pluck", "(", "'maxRetries'", ",", "$", "options", ",", "false", ")", ";", "$", "maxRetries", "=", "$", "maxRetries", "===", "null", "?", "FirestoreClient", "::", "MAX_RETRIES", ":", "$", "maxRetries", ";", "$", "rows", "=", "(", "new", "ExponentialBackoff", "(", "$", "maxRetries", ")", ")", "->", "execute", "(", "function", "(", ")", "use", "(", "$", "options", ")", "{", "$", "query", "=", "$", "this", "->", "finalQueryPrepare", "(", "$", "this", "->", "query", ")", ";", "$", "generator", "=", "$", "this", "->", "connection", "->", "runQuery", "(", "$", "this", "->", "arrayFilterRemoveNull", "(", "[", "'parent'", "=>", "$", "this", "->", "parent", ",", "'structuredQuery'", "=>", "$", "query", ",", "'retries'", "=>", "0", "]", ")", "+", "$", "options", ")", ";", "// cache collection references", "$", "collections", "=", "[", "]", ";", "$", "out", "=", "[", "]", ";", "while", "(", "$", "generator", "->", "valid", "(", ")", ")", "{", "$", "result", "=", "$", "generator", "->", "current", "(", ")", ";", "if", "(", "isset", "(", "$", "result", "[", "'document'", "]", ")", "&&", "$", "result", "[", "'document'", "]", ")", "{", "$", "collectionName", "=", "$", "this", "->", "parentPath", "(", "$", "result", "[", "'document'", "]", "[", "'name'", "]", ")", ";", "if", "(", "!", "isset", "(", "$", "collections", "[", "$", "collectionName", "]", ")", ")", "{", "$", "collections", "[", "$", "collectionName", "]", "=", "new", "CollectionReference", "(", "$", "this", "->", "connection", ",", "$", "this", "->", "valueMapper", ",", "$", "collectionName", ")", ";", "}", "$", "ref", "=", "new", "DocumentReference", "(", "$", "this", "->", "connection", ",", "$", "this", "->", "valueMapper", ",", "$", "collections", "[", "$", "collectionName", "]", ",", "$", "result", "[", "'document'", "]", "[", "'name'", "]", ")", ";", "$", "document", "=", "$", "result", "[", "'document'", "]", ";", "$", "document", "[", "'readTime'", "]", "=", "$", "result", "[", "'readTime'", "]", ";", "$", "out", "[", "]", "=", "$", "this", "->", "createSnapshotWithData", "(", "$", "this", "->", "valueMapper", ",", "$", "ref", ",", "$", "document", ")", ";", "}", "$", "generator", "->", "next", "(", ")", ";", "}", "return", "$", "out", ";", "}", ")", ";", "return", "new", "QuerySnapshot", "(", "$", "this", ",", "$", "rows", ")", ";", "}" ]
Get all documents matching the provided query filters. Example: ``` $result = $query->documents(); ``` @codingStandardsIgnoreStart @see https://cloud.google.com/firestore/docs/reference/rpc/google.firestore.v1beta1#google.firestore.v1beta1.Firestore.RunQuery RunQuery @codingStandardsIgnoreEnd @param array $options { Configuration options. @type int $maxRetries The maximum number of times to retry a query. **Defaults to** `5`. } @return QuerySnapshot<DocumentSnapshot>
[ "Get", "all", "documents", "matching", "the", "provided", "query", "filters", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/Query.php#L166-L218
train
googleapis/google-cloud-php
Firestore/src/Query.php
Query.select
public function select(array $fieldPaths) { $fields = []; foreach ($fieldPaths as $field) { if (!($field instanceof FieldPath)) { $field = FieldPath::fromString($field); } $fields[] = [ 'fieldPath' => $field->pathString() ]; } if (!$fields) { $fields[] = [ 'fieldPath' => self::DOCUMENT_ID ]; } return $this->newQuery([ 'select' => [ 'fields' => $fields ] ], true); }
php
public function select(array $fieldPaths) { $fields = []; foreach ($fieldPaths as $field) { if (!($field instanceof FieldPath)) { $field = FieldPath::fromString($field); } $fields[] = [ 'fieldPath' => $field->pathString() ]; } if (!$fields) { $fields[] = [ 'fieldPath' => self::DOCUMENT_ID ]; } return $this->newQuery([ 'select' => [ 'fields' => $fields ] ], true); }
[ "public", "function", "select", "(", "array", "$", "fieldPaths", ")", "{", "$", "fields", "=", "[", "]", ";", "foreach", "(", "$", "fieldPaths", "as", "$", "field", ")", "{", "if", "(", "!", "(", "$", "field", "instanceof", "FieldPath", ")", ")", "{", "$", "field", "=", "FieldPath", "::", "fromString", "(", "$", "field", ")", ";", "}", "$", "fields", "[", "]", "=", "[", "'fieldPath'", "=>", "$", "field", "->", "pathString", "(", ")", "]", ";", "}", "if", "(", "!", "$", "fields", ")", "{", "$", "fields", "[", "]", "=", "[", "'fieldPath'", "=>", "self", "::", "DOCUMENT_ID", "]", ";", "}", "return", "$", "this", "->", "newQuery", "(", "[", "'select'", "=>", "[", "'fields'", "=>", "$", "fields", "]", "]", ",", "true", ")", ";", "}" ]
Add a SELECT to the Query. Creates and returns a new Query instance that applies a field mask to the result and returns only the specified subset of fields. You can specify a list of field paths to return, or use an empty list to only return the references of matching documents. Subsequent calls to this method will override previous values. Example: ``` $query = $query->select(['firstName']); ``` @param string[]|FieldPath[] $fieldPaths The projection to return, in the form of an array of field paths. To only return the name of the document, provide an empty array. @return Query A new instance of Query with the given changes applied.
[ "Add", "a", "SELECT", "to", "the", "Query", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/Query.php#L240-L264
train
googleapis/google-cloud-php
Firestore/src/Query.php
Query.where
public function where($fieldPath, $operator, $value) { if ($value instanceof FieldValueInterface) { throw new \InvalidArgumentException(sprintf( 'Value cannot be a `%s` value.', FieldValue::class )); } if (!($fieldPath instanceof FieldPath)) { $fieldPath = FieldPath::fromString($fieldPath); } $escapedPathString = $fieldPath->pathString(); $operator = array_key_exists($operator, $this->shortOperators) ? $this->shortOperators[$operator] : $operator; if (!in_array($operator, $this->allowedOperators)) { throw new \InvalidArgumentException(sprintf( 'Operator %s is not a valid operator', $operator )); } if ((is_float($value) && is_nan($value)) || is_null($value)) { if ($operator !== self::OP_EQUAL) { throw new \InvalidArgumentException('Null and NaN are allowed only with operator EQUALS.'); } $unaryOperator = is_nan($value) ? self::OP_NAN : self::OP_NULL; $filter = [ 'unaryFilter' => [ 'field' => [ 'fieldPath' => $escapedPathString ], 'op' => $unaryOperator ] ]; } else { $filter = [ 'fieldFilter' => [ 'field' => [ 'fieldPath' => $escapedPathString, ], 'op' => $operator, 'value' => $this->valueMapper->encodeValue($value) ] ]; } $query = [ 'where' => [ 'compositeFilter' => [ 'op' => Operator::PBAND, 'filters' => [ $filter ] ] ] ]; return $this->newQuery($query); }
php
public function where($fieldPath, $operator, $value) { if ($value instanceof FieldValueInterface) { throw new \InvalidArgumentException(sprintf( 'Value cannot be a `%s` value.', FieldValue::class )); } if (!($fieldPath instanceof FieldPath)) { $fieldPath = FieldPath::fromString($fieldPath); } $escapedPathString = $fieldPath->pathString(); $operator = array_key_exists($operator, $this->shortOperators) ? $this->shortOperators[$operator] : $operator; if (!in_array($operator, $this->allowedOperators)) { throw new \InvalidArgumentException(sprintf( 'Operator %s is not a valid operator', $operator )); } if ((is_float($value) && is_nan($value)) || is_null($value)) { if ($operator !== self::OP_EQUAL) { throw new \InvalidArgumentException('Null and NaN are allowed only with operator EQUALS.'); } $unaryOperator = is_nan($value) ? self::OP_NAN : self::OP_NULL; $filter = [ 'unaryFilter' => [ 'field' => [ 'fieldPath' => $escapedPathString ], 'op' => $unaryOperator ] ]; } else { $filter = [ 'fieldFilter' => [ 'field' => [ 'fieldPath' => $escapedPathString, ], 'op' => $operator, 'value' => $this->valueMapper->encodeValue($value) ] ]; } $query = [ 'where' => [ 'compositeFilter' => [ 'op' => Operator::PBAND, 'filters' => [ $filter ] ] ] ]; return $this->newQuery($query); }
[ "public", "function", "where", "(", "$", "fieldPath", ",", "$", "operator", ",", "$", "value", ")", "{", "if", "(", "$", "value", "instanceof", "FieldValueInterface", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "sprintf", "(", "'Value cannot be a `%s` value.'", ",", "FieldValue", "::", "class", ")", ")", ";", "}", "if", "(", "!", "(", "$", "fieldPath", "instanceof", "FieldPath", ")", ")", "{", "$", "fieldPath", "=", "FieldPath", "::", "fromString", "(", "$", "fieldPath", ")", ";", "}", "$", "escapedPathString", "=", "$", "fieldPath", "->", "pathString", "(", ")", ";", "$", "operator", "=", "array_key_exists", "(", "$", "operator", ",", "$", "this", "->", "shortOperators", ")", "?", "$", "this", "->", "shortOperators", "[", "$", "operator", "]", ":", "$", "operator", ";", "if", "(", "!", "in_array", "(", "$", "operator", ",", "$", "this", "->", "allowedOperators", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "sprintf", "(", "'Operator %s is not a valid operator'", ",", "$", "operator", ")", ")", ";", "}", "if", "(", "(", "is_float", "(", "$", "value", ")", "&&", "is_nan", "(", "$", "value", ")", ")", "||", "is_null", "(", "$", "value", ")", ")", "{", "if", "(", "$", "operator", "!==", "self", "::", "OP_EQUAL", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Null and NaN are allowed only with operator EQUALS.'", ")", ";", "}", "$", "unaryOperator", "=", "is_nan", "(", "$", "value", ")", "?", "self", "::", "OP_NAN", ":", "self", "::", "OP_NULL", ";", "$", "filter", "=", "[", "'unaryFilter'", "=>", "[", "'field'", "=>", "[", "'fieldPath'", "=>", "$", "escapedPathString", "]", ",", "'op'", "=>", "$", "unaryOperator", "]", "]", ";", "}", "else", "{", "$", "filter", "=", "[", "'fieldFilter'", "=>", "[", "'field'", "=>", "[", "'fieldPath'", "=>", "$", "escapedPathString", ",", "]", ",", "'op'", "=>", "$", "operator", ",", "'value'", "=>", "$", "this", "->", "valueMapper", "->", "encodeValue", "(", "$", "value", ")", "]", "]", ";", "}", "$", "query", "=", "[", "'where'", "=>", "[", "'compositeFilter'", "=>", "[", "'op'", "=>", "Operator", "::", "PBAND", ",", "'filters'", "=>", "[", "$", "filter", "]", "]", "]", "]", ";", "return", "$", "this", "->", "newQuery", "(", "$", "query", ")", ";", "}" ]
Add a WHERE clause to the Query. Example: ``` $query = $query->where('firstName', '=', 'John'); ``` ``` // Filtering against `null` and `NAN` is supported only with the equality operator. $query = $query->where('coolnessPercentage', '=', NAN); ``` ``` // Use `array-contains` to select documents where the array contains given elements. $query = $query->where('friends', 'array-contains', ['Steve', 'Sarah']); ``` @param string|FieldPath $fieldPath The field to filter by. @param string $operator The operator to filter by. @param mixed $value The value to compare to. @return Query A new instance of Query with the given changes applied. @throws \InvalidArgumentException If an invalid operator or value is encountered.
[ "Add", "a", "WHERE", "clause", "to", "the", "Query", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/Query.php#L290-L357
train
googleapis/google-cloud-php
Firestore/src/Query.php
Query.orderBy
public function orderBy($fieldPath, $direction = self::DIR_ASCENDING) { $direction = array_key_exists(strtoupper($direction), $this->shortDirections) ? $this->shortDirections[strtoupper($direction)] : $direction; if (!in_array($direction, $this->allowedDirections)) { throw new \InvalidArgumentException(sprintf( 'Direction %s is not a valid direction', $direction )); } if ($this->queryHas('startAt') || $this->queryHas('endAt')) { throw new \InvalidArgumentException( 'Cannot specify an orderBy constraint after calling any of ' . '`startAt()`, `startAfter()`, `endBefore()` or `endAt`().' ); } if (!($fieldPath instanceof FieldPath)) { $fieldPath = FieldPath::fromString($fieldPath); } return $this->newQuery([ 'orderBy' => [ [ 'field' => [ 'fieldPath' => $fieldPath->pathString() ], 'direction' => $direction ] ] ]); }
php
public function orderBy($fieldPath, $direction = self::DIR_ASCENDING) { $direction = array_key_exists(strtoupper($direction), $this->shortDirections) ? $this->shortDirections[strtoupper($direction)] : $direction; if (!in_array($direction, $this->allowedDirections)) { throw new \InvalidArgumentException(sprintf( 'Direction %s is not a valid direction', $direction )); } if ($this->queryHas('startAt') || $this->queryHas('endAt')) { throw new \InvalidArgumentException( 'Cannot specify an orderBy constraint after calling any of ' . '`startAt()`, `startAfter()`, `endBefore()` or `endAt`().' ); } if (!($fieldPath instanceof FieldPath)) { $fieldPath = FieldPath::fromString($fieldPath); } return $this->newQuery([ 'orderBy' => [ [ 'field' => [ 'fieldPath' => $fieldPath->pathString() ], 'direction' => $direction ] ] ]); }
[ "public", "function", "orderBy", "(", "$", "fieldPath", ",", "$", "direction", "=", "self", "::", "DIR_ASCENDING", ")", "{", "$", "direction", "=", "array_key_exists", "(", "strtoupper", "(", "$", "direction", ")", ",", "$", "this", "->", "shortDirections", ")", "?", "$", "this", "->", "shortDirections", "[", "strtoupper", "(", "$", "direction", ")", "]", ":", "$", "direction", ";", "if", "(", "!", "in_array", "(", "$", "direction", ",", "$", "this", "->", "allowedDirections", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "sprintf", "(", "'Direction %s is not a valid direction'", ",", "$", "direction", ")", ")", ";", "}", "if", "(", "$", "this", "->", "queryHas", "(", "'startAt'", ")", "||", "$", "this", "->", "queryHas", "(", "'endAt'", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Cannot specify an orderBy constraint after calling any of '", ".", "'`startAt()`, `startAfter()`, `endBefore()` or `endAt`().'", ")", ";", "}", "if", "(", "!", "(", "$", "fieldPath", "instanceof", "FieldPath", ")", ")", "{", "$", "fieldPath", "=", "FieldPath", "::", "fromString", "(", "$", "fieldPath", ")", ";", "}", "return", "$", "this", "->", "newQuery", "(", "[", "'orderBy'", "=>", "[", "[", "'field'", "=>", "[", "'fieldPath'", "=>", "$", "fieldPath", "->", "pathString", "(", ")", "]", ",", "'direction'", "=>", "$", "direction", "]", "]", "]", ")", ";", "}" ]
Add an ORDER BY clause to the Query. Example: ``` $query = $query->orderBy('firstName', 'DESC'); ``` @param string|FieldPath $fieldPath The field to order by. @param string $direction The direction to order in. **Defaults to** `ASC`. @return Query A new instance of Query with the given changes applied. @throws \InvalidArgumentException If an invalid direction is given. @throws \InvalidArgumentException If orderBy is called after `startAt()`, `startAfter()`, `endBefore()` or `endAt`().
[ "Add", "an", "ORDER", "BY", "clause", "to", "the", "Query", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/Query.php#L374-L408
train
googleapis/google-cloud-php
Firestore/src/Query.php
Query.snapshotPosition
private function snapshotPosition(DocumentSnapshot $snapshot, array $orderBy) { $appendName = true; foreach ($orderBy as $order) { if ($order['field']['fieldPath'] === self::DOCUMENT_ID) { $appendName = false; break; } } if ($appendName) { // If there is inequality filter (anything other than equals), // append orderBy(the last inequality filter’s path, ascending). if (!$orderBy && $this->queryHas('where')) { $filters = $this->query['where']['compositeFilter']['filters']; $inequality = array_filter($filters, function ($filter) { $type = array_keys($filter)[0]; return !in_array($filter[$type]['op'], [ self::OP_EQUAL, self::OP_ARRAY_CONTAINS ]); }); if ($inequality) { $filter = end($inequality); $type = array_keys($filter)[0]; $orderBy[] = [ 'field' => [ 'fieldPath' => $filter[$type]['field']['fieldPath'], ], 'direction' => self::DIR_ASCENDING ]; } } // If the query has existing orderBy constraints if ($orderBy) { // Append orderBy(__name__, direction of last orderBy clause) $lastOrderDirection = end($orderBy)['direction']; $orderBy[] = [ 'field' => [ 'fieldPath' => self::DOCUMENT_ID ], 'direction' => $lastOrderDirection ]; } else { // no existing orderBy constraints // Otherwise append orderBy(__name__, ‘asc’) $orderBy[] = [ 'field' => [ 'fieldPath' => self::DOCUMENT_ID ], 'direction' => self::DIR_ASCENDING ]; } } $fieldValues = $this->snapshotCursorValues($snapshot, $orderBy); return [ $fieldValues, $orderBy ]; }
php
private function snapshotPosition(DocumentSnapshot $snapshot, array $orderBy) { $appendName = true; foreach ($orderBy as $order) { if ($order['field']['fieldPath'] === self::DOCUMENT_ID) { $appendName = false; break; } } if ($appendName) { // If there is inequality filter (anything other than equals), // append orderBy(the last inequality filter’s path, ascending). if (!$orderBy && $this->queryHas('where')) { $filters = $this->query['where']['compositeFilter']['filters']; $inequality = array_filter($filters, function ($filter) { $type = array_keys($filter)[0]; return !in_array($filter[$type]['op'], [ self::OP_EQUAL, self::OP_ARRAY_CONTAINS ]); }); if ($inequality) { $filter = end($inequality); $type = array_keys($filter)[0]; $orderBy[] = [ 'field' => [ 'fieldPath' => $filter[$type]['field']['fieldPath'], ], 'direction' => self::DIR_ASCENDING ]; } } // If the query has existing orderBy constraints if ($orderBy) { // Append orderBy(__name__, direction of last orderBy clause) $lastOrderDirection = end($orderBy)['direction']; $orderBy[] = [ 'field' => [ 'fieldPath' => self::DOCUMENT_ID ], 'direction' => $lastOrderDirection ]; } else { // no existing orderBy constraints // Otherwise append orderBy(__name__, ‘asc’) $orderBy[] = [ 'field' => [ 'fieldPath' => self::DOCUMENT_ID ], 'direction' => self::DIR_ASCENDING ]; } } $fieldValues = $this->snapshotCursorValues($snapshot, $orderBy); return [ $fieldValues, $orderBy ]; }
[ "private", "function", "snapshotPosition", "(", "DocumentSnapshot", "$", "snapshot", ",", "array", "$", "orderBy", ")", "{", "$", "appendName", "=", "true", ";", "foreach", "(", "$", "orderBy", "as", "$", "order", ")", "{", "if", "(", "$", "order", "[", "'field'", "]", "[", "'fieldPath'", "]", "===", "self", "::", "DOCUMENT_ID", ")", "{", "$", "appendName", "=", "false", ";", "break", ";", "}", "}", "if", "(", "$", "appendName", ")", "{", "// If there is inequality filter (anything other than equals),", "// append orderBy(the last inequality filter’s path, ascending).", "if", "(", "!", "$", "orderBy", "&&", "$", "this", "->", "queryHas", "(", "'where'", ")", ")", "{", "$", "filters", "=", "$", "this", "->", "query", "[", "'where'", "]", "[", "'compositeFilter'", "]", "[", "'filters'", "]", ";", "$", "inequality", "=", "array_filter", "(", "$", "filters", ",", "function", "(", "$", "filter", ")", "{", "$", "type", "=", "array_keys", "(", "$", "filter", ")", "[", "0", "]", ";", "return", "!", "in_array", "(", "$", "filter", "[", "$", "type", "]", "[", "'op'", "]", ",", "[", "self", "::", "OP_EQUAL", ",", "self", "::", "OP_ARRAY_CONTAINS", "]", ")", ";", "}", ")", ";", "if", "(", "$", "inequality", ")", "{", "$", "filter", "=", "end", "(", "$", "inequality", ")", ";", "$", "type", "=", "array_keys", "(", "$", "filter", ")", "[", "0", "]", ";", "$", "orderBy", "[", "]", "=", "[", "'field'", "=>", "[", "'fieldPath'", "=>", "$", "filter", "[", "$", "type", "]", "[", "'field'", "]", "[", "'fieldPath'", "]", ",", "]", ",", "'direction'", "=>", "self", "::", "DIR_ASCENDING", "]", ";", "}", "}", "// If the query has existing orderBy constraints", "if", "(", "$", "orderBy", ")", "{", "// Append orderBy(__name__, direction of last orderBy clause)", "$", "lastOrderDirection", "=", "end", "(", "$", "orderBy", ")", "[", "'direction'", "]", ";", "$", "orderBy", "[", "]", "=", "[", "'field'", "=>", "[", "'fieldPath'", "=>", "self", "::", "DOCUMENT_ID", "]", ",", "'direction'", "=>", "$", "lastOrderDirection", "]", ";", "}", "else", "{", "// no existing orderBy constraints", "// Otherwise append orderBy(__name__, ‘asc’)", "$", "orderBy", "[", "]", "=", "[", "'field'", "=>", "[", "'fieldPath'", "=>", "self", "::", "DOCUMENT_ID", "]", ",", "'direction'", "=>", "self", "::", "DIR_ASCENDING", "]", ";", "}", "}", "$", "fieldValues", "=", "$", "this", "->", "snapshotCursorValues", "(", "$", "snapshot", ",", "$", "orderBy", ")", ";", "return", "[", "$", "fieldValues", ",", "$", "orderBy", "]", ";", "}" ]
Build cursors for document snapshots. @param DocumentSnapshot $snapshot The document snapshot @param array $orderBy A list of orderBy clauses. @return array A list, where position 0 is fieldValues and position 1 is orderBy.
[ "Build", "cursors", "for", "document", "snapshots", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/Query.php#L703-L766
train
googleapis/google-cloud-php
Firestore/src/Query.php
Query.snapshotCursorValues
private function snapshotCursorValues(DocumentSnapshot $snapshot, array $orderBy) { $fieldValues = []; foreach ($orderBy as $order) { $path = $order['field']['fieldPath']; if ($path === self::DOCUMENT_ID) { continue; } $fieldValues[] = $snapshot->get($path); } $fieldValues[] = $snapshot->reference(); return $fieldValues; }
php
private function snapshotCursorValues(DocumentSnapshot $snapshot, array $orderBy) { $fieldValues = []; foreach ($orderBy as $order) { $path = $order['field']['fieldPath']; if ($path === self::DOCUMENT_ID) { continue; } $fieldValues[] = $snapshot->get($path); } $fieldValues[] = $snapshot->reference(); return $fieldValues; }
[ "private", "function", "snapshotCursorValues", "(", "DocumentSnapshot", "$", "snapshot", ",", "array", "$", "orderBy", ")", "{", "$", "fieldValues", "=", "[", "]", ";", "foreach", "(", "$", "orderBy", "as", "$", "order", ")", "{", "$", "path", "=", "$", "order", "[", "'field'", "]", "[", "'fieldPath'", "]", ";", "if", "(", "$", "path", "===", "self", "::", "DOCUMENT_ID", ")", "{", "continue", ";", "}", "$", "fieldValues", "[", "]", "=", "$", "snapshot", "->", "get", "(", "$", "path", ")", ";", "}", "$", "fieldValues", "[", "]", "=", "$", "snapshot", "->", "reference", "(", ")", ";", "return", "$", "fieldValues", ";", "}" ]
Determine field values for Document Snapshot cursors. @param DocumentSnapshot $snapshot @param array $orderBy @return $fieldValues
[ "Determine", "field", "values", "for", "Document", "Snapshot", "cursors", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/Query.php#L775-L789
train
googleapis/google-cloud-php
Firestore/src/Query.php
Query.newQuery
private function newQuery(array $additionalConfig, $overrideTopLevelKeys = false) { $query = $this->query; if ($overrideTopLevelKeys) { $keys = array_keys($additionalConfig); foreach ($keys as $key) { unset($query[$key]); } } $query = $this->arrayMergeRecursive($query, $additionalConfig); return new self( $this->connection, $this->valueMapper, $this->parent, $query ); }
php
private function newQuery(array $additionalConfig, $overrideTopLevelKeys = false) { $query = $this->query; if ($overrideTopLevelKeys) { $keys = array_keys($additionalConfig); foreach ($keys as $key) { unset($query[$key]); } } $query = $this->arrayMergeRecursive($query, $additionalConfig); return new self( $this->connection, $this->valueMapper, $this->parent, $query ); }
[ "private", "function", "newQuery", "(", "array", "$", "additionalConfig", ",", "$", "overrideTopLevelKeys", "=", "false", ")", "{", "$", "query", "=", "$", "this", "->", "query", ";", "if", "(", "$", "overrideTopLevelKeys", ")", "{", "$", "keys", "=", "array_keys", "(", "$", "additionalConfig", ")", ";", "foreach", "(", "$", "keys", "as", "$", "key", ")", "{", "unset", "(", "$", "query", "[", "$", "key", "]", ")", ";", "}", "}", "$", "query", "=", "$", "this", "->", "arrayMergeRecursive", "(", "$", "query", ",", "$", "additionalConfig", ")", ";", "return", "new", "self", "(", "$", "this", "->", "connection", ",", "$", "this", "->", "valueMapper", ",", "$", "this", "->", "parent", ",", "$", "query", ")", ";", "}" ]
Create a new Query instance @param array $additionalConfig @param bool $overrideTopLevelKeys If true, top-level keys will be replaced rather than recursively merged. @return Query A new instance of Query with the given changes applied.
[ "Create", "a", "new", "Query", "instance" ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/Query.php#L799-L818
train
googleapis/google-cloud-php
Firestore/src/Query.php
Query.finalQueryPrepare
private function finalQueryPrepare(array $query) { if (isset($query['where']['compositeFilter']) && count($query['where']['compositeFilter']['filters']) === 1) { $filter = $query['where']['compositeFilter']['filters'][0]; $query['where'] = $filter; } return $query; }
php
private function finalQueryPrepare(array $query) { if (isset($query['where']['compositeFilter']) && count($query['where']['compositeFilter']['filters']) === 1) { $filter = $query['where']['compositeFilter']['filters'][0]; $query['where'] = $filter; } return $query; }
[ "private", "function", "finalQueryPrepare", "(", "array", "$", "query", ")", "{", "if", "(", "isset", "(", "$", "query", "[", "'where'", "]", "[", "'compositeFilter'", "]", ")", "&&", "count", "(", "$", "query", "[", "'where'", "]", "[", "'compositeFilter'", "]", "[", "'filters'", "]", ")", "===", "1", ")", "{", "$", "filter", "=", "$", "query", "[", "'where'", "]", "[", "'compositeFilter'", "]", "[", "'filters'", "]", "[", "0", "]", ";", "$", "query", "[", "'where'", "]", "=", "$", "filter", ";", "}", "return", "$", "query", ";", "}" ]
Clean up the query array before sending. Some optimizations cannot be performed ahead of time and must be done at execution. @param array $query The incoming query @return array The final query data
[ "Clean", "up", "the", "query", "array", "before", "sending", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/Query.php#L829-L837
train
googleapis/google-cloud-php
Datastore/src/V1/CommitResponse.php
CommitResponse.setMutationResults
public function setMutationResults($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Datastore\V1\MutationResult::class); $this->mutation_results = $arr; return $this; }
php
public function setMutationResults($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Datastore\V1\MutationResult::class); $this->mutation_results = $arr; return $this; }
[ "public", "function", "setMutationResults", "(", "$", "var", ")", "{", "$", "arr", "=", "GPBUtil", "::", "checkRepeatedField", "(", "$", "var", ",", "\\", "Google", "\\", "Protobuf", "\\", "Internal", "\\", "GPBType", "::", "MESSAGE", ",", "\\", "Google", "\\", "Cloud", "\\", "Datastore", "\\", "V1", "\\", "MutationResult", "::", "class", ")", ";", "$", "this", "->", "mutation_results", "=", "$", "arr", ";", "return", "$", "this", ";", "}" ]
The result of performing the mutations. The i-th mutation result corresponds to the i-th mutation in the request. Generated from protobuf field <code>repeated .google.datastore.v1.MutationResult mutation_results = 3;</code> @param \Google\Cloud\Datastore\V1\MutationResult[]|\Google\Protobuf\Internal\RepeatedField $var @return $this
[ "The", "result", "of", "performing", "the", "mutations", ".", "The", "i", "-", "th", "mutation", "result", "corresponds", "to", "the", "i", "-", "th", "mutation", "in", "the", "request", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Datastore/src/V1/CommitResponse.php#L72-L78
train
googleapis/google-cloud-php
Redis/src/V1beta1/Gapic/CloudRedisGapicClient.php
CloudRedisGapicClient.instanceName
public static function instanceName($project, $location, $instance) { return self::getInstanceNameTemplate()->render([ 'project' => $project, 'location' => $location, 'instance' => $instance, ]); }
php
public static function instanceName($project, $location, $instance) { return self::getInstanceNameTemplate()->render([ 'project' => $project, 'location' => $location, 'instance' => $instance, ]); }
[ "public", "static", "function", "instanceName", "(", "$", "project", ",", "$", "location", ",", "$", "instance", ")", "{", "return", "self", "::", "getInstanceNameTemplate", "(", ")", "->", "render", "(", "[", "'project'", "=>", "$", "project", ",", "'location'", "=>", "$", "location", ",", "'instance'", "=>", "$", "instance", ",", "]", ")", ";", "}" ]
Formats a string containing the fully-qualified path to represent a instance resource. @param string $project @param string $location @param string $instance @return string The formatted instance resource. @experimental
[ "Formats", "a", "string", "containing", "the", "fully", "-", "qualified", "path", "to", "represent", "a", "instance", "resource", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Redis/src/V1beta1/Gapic/CloudRedisGapicClient.php#L201-L208
train
googleapis/google-cloud-php
Bigtable/src/Admin/V2/BigtableInstanceAdminGrpcClient.php
BigtableInstanceAdminGrpcClient.CreateInstance
public function CreateInstance(\Google\Cloud\Bigtable\Admin\V2\CreateInstanceRequest $argument, $metadata = [], $options = []) { return $this->_simpleRequest('/google.bigtable.admin.v2.BigtableInstanceAdmin/CreateInstance', $argument, ['\Google\LongRunning\Operation', 'decode'], $metadata, $options); }
php
public function CreateInstance(\Google\Cloud\Bigtable\Admin\V2\CreateInstanceRequest $argument, $metadata = [], $options = []) { return $this->_simpleRequest('/google.bigtable.admin.v2.BigtableInstanceAdmin/CreateInstance', $argument, ['\Google\LongRunning\Operation', 'decode'], $metadata, $options); }
[ "public", "function", "CreateInstance", "(", "\\", "Google", "\\", "Cloud", "\\", "Bigtable", "\\", "Admin", "\\", "V2", "\\", "CreateInstanceRequest", "$", "argument", ",", "$", "metadata", "=", "[", "]", ",", "$", "options", "=", "[", "]", ")", "{", "return", "$", "this", "->", "_simpleRequest", "(", "'/google.bigtable.admin.v2.BigtableInstanceAdmin/CreateInstance'", ",", "$", "argument", ",", "[", "'\\Google\\LongRunning\\Operation'", ",", "'decode'", "]", ",", "$", "metadata", ",", "$", "options", ")", ";", "}" ]
Create an instance within a project. @param \Google\Cloud\Bigtable\Admin\V2\CreateInstanceRequest $argument input argument @param array $metadata metadata @param array $options call options
[ "Create", "an", "instance", "within", "a", "project", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Bigtable/src/Admin/V2/BigtableInstanceAdminGrpcClient.php#L44-L50
train
googleapis/google-cloud-php
Speech/src/V1/StreamingRecognizeRequest.php
StreamingRecognizeRequest.setStreamingConfig
public function setStreamingConfig($var) { GPBUtil::checkMessage($var, \Google\Cloud\Speech\V1\StreamingRecognitionConfig::class); $this->writeOneof(1, $var); return $this; }
php
public function setStreamingConfig($var) { GPBUtil::checkMessage($var, \Google\Cloud\Speech\V1\StreamingRecognitionConfig::class); $this->writeOneof(1, $var); return $this; }
[ "public", "function", "setStreamingConfig", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Speech", "\\", "V1", "\\", "StreamingRecognitionConfig", "::", "class", ")", ";", "$", "this", "->", "writeOneof", "(", "1", ",", "$", "var", ")", ";", "return", "$", "this", ";", "}" ]
Provides information to the recognizer that specifies how to process the request. The first `StreamingRecognizeRequest` message must contain a `streaming_config` message. Generated from protobuf field <code>.google.cloud.speech.v1.StreamingRecognitionConfig streaming_config = 1;</code> @param \Google\Cloud\Speech\V1\StreamingRecognitionConfig $var @return $this
[ "Provides", "information", "to", "the", "recognizer", "that", "specifies", "how", "to", "process", "the", "request", ".", "The", "first", "StreamingRecognizeRequest", "message", "must", "contain", "a", "streaming_config", "message", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Speech/src/V1/StreamingRecognizeRequest.php#L72-L78
train
googleapis/google-cloud-php
Vision/src/V1/Image.php
Image.setSource
public function setSource($var) { GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ImageSource::class); $this->source = $var; return $this; }
php
public function setSource($var) { GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ImageSource::class); $this->source = $var; return $this; }
[ "public", "function", "setSource", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Vision", "\\", "V1", "\\", "ImageSource", "::", "class", ")", ";", "$", "this", "->", "source", "=", "$", "var", ";", "return", "$", "this", ";", "}" ]
Google Cloud Storage image location, or publicly-accessible image URL. If both `content` and `source` are provided for an image, `content` takes precedence and is used to perform the image annotation request. Generated from protobuf field <code>.google.cloud.vision.v1.ImageSource source = 2;</code> @param \Google\Cloud\Vision\V1\ImageSource $var @return $this
[ "Google", "Cloud", "Storage", "image", "location", "or", "publicly", "-", "accessible", "image", "URL", ".", "If", "both", "content", "and", "source", "are", "provided", "for", "an", "image", "content", "takes", "precedence", "and", "is", "used", "to", "perform", "the", "image", "annotation", "request", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Vision/src/V1/Image.php#L108-L114
train
googleapis/google-cloud-php
Spanner/src/BatchDmlResult.php
BatchDmlResult.rowCounts
public function rowCounts() { if (!$this->rowCounts) { foreach ($this->data['resultSets'] as $resultSet) { $this->rowCounts[] = $resultSet['stats']['rowCountExact']; } } return $this->rowCounts; }
php
public function rowCounts() { if (!$this->rowCounts) { foreach ($this->data['resultSets'] as $resultSet) { $this->rowCounts[] = $resultSet['stats']['rowCountExact']; } } return $this->rowCounts; }
[ "public", "function", "rowCounts", "(", ")", "{", "if", "(", "!", "$", "this", "->", "rowCounts", ")", "{", "foreach", "(", "$", "this", "->", "data", "[", "'resultSets'", "]", "as", "$", "resultSet", ")", "{", "$", "this", "->", "rowCounts", "[", "]", "=", "$", "resultSet", "[", "'stats'", "]", "[", "'rowCountExact'", "]", ";", "}", "}", "return", "$", "this", "->", "rowCounts", ";", "}" ]
Get a list of integers indicating the number of modified rows for each successful statement. Example: ``` $counts = $batchDmlResult->rowCounts(); ``` @return int[]
[ "Get", "a", "list", "of", "integers", "indicating", "the", "number", "of", "modified", "rows", "for", "each", "successful", "statement", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Spanner/src/BatchDmlResult.php#L87-L96
train
googleapis/google-cloud-php
Firestore/src/DocumentSnapshot.php
DocumentSnapshot.get
public function get($fieldPath) { $res = null; if (is_string($fieldPath)) { $parts = explode('.', $fieldPath); } elseif ($fieldPath instanceof FieldPath) { $parts = $fieldPath->path(); } else { throw new \InvalidArgumentException('Given path was not a string or instance of FieldPath.'); } $len = count($parts); $fields = $this->data; foreach ($parts as $idx => $part) { if ($idx === $len-1 && isset($fields[$part])) { $res = $fields[$part]; break; } else { if (!isset($fields[$part])) { throw new \InvalidArgumentException(sprintf( 'Field path `%s` does not exist.', $fieldPath )); } $fields = $fields[$part]; } } return $res; }
php
public function get($fieldPath) { $res = null; if (is_string($fieldPath)) { $parts = explode('.', $fieldPath); } elseif ($fieldPath instanceof FieldPath) { $parts = $fieldPath->path(); } else { throw new \InvalidArgumentException('Given path was not a string or instance of FieldPath.'); } $len = count($parts); $fields = $this->data; foreach ($parts as $idx => $part) { if ($idx === $len-1 && isset($fields[$part])) { $res = $fields[$part]; break; } else { if (!isset($fields[$part])) { throw new \InvalidArgumentException(sprintf( 'Field path `%s` does not exist.', $fieldPath )); } $fields = $fields[$part]; } } return $res; }
[ "public", "function", "get", "(", "$", "fieldPath", ")", "{", "$", "res", "=", "null", ";", "if", "(", "is_string", "(", "$", "fieldPath", ")", ")", "{", "$", "parts", "=", "explode", "(", "'.'", ",", "$", "fieldPath", ")", ";", "}", "elseif", "(", "$", "fieldPath", "instanceof", "FieldPath", ")", "{", "$", "parts", "=", "$", "fieldPath", "->", "path", "(", ")", ";", "}", "else", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Given path was not a string or instance of FieldPath.'", ")", ";", "}", "$", "len", "=", "count", "(", "$", "parts", ")", ";", "$", "fields", "=", "$", "this", "->", "data", ";", "foreach", "(", "$", "parts", "as", "$", "idx", "=>", "$", "part", ")", "{", "if", "(", "$", "idx", "===", "$", "len", "-", "1", "&&", "isset", "(", "$", "fields", "[", "$", "part", "]", ")", ")", "{", "$", "res", "=", "$", "fields", "[", "$", "part", "]", ";", "break", ";", "}", "else", "{", "if", "(", "!", "isset", "(", "$", "fields", "[", "$", "part", "]", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "sprintf", "(", "'Field path `%s` does not exist.'", ",", "$", "fieldPath", ")", ")", ";", "}", "$", "fields", "=", "$", "fields", "[", "$", "part", "]", ";", "}", "}", "return", "$", "res", ";", "}" ]
Get a field by field path. A field path is a string containing the path to a specific field, at the top level or nested, delimited by `.`. For instance, the value `hello` in the structured field `{ "foo" : { "bar" : "hello" }}` would be accessible using a field path of `foo.bar`. Example: ``` $value = $snapshot->get('wallet.cryptoCurrency.bitcoin'); ``` ``` // Field names containing dots or symbols can be targeted using a FieldPath instance: use Google\Cloud\Firestore\FieldPath; $value = $snapshot->get(new FieldPath(['wallet', 'cryptoCurrency', 'my.coin'])); ``` @param string|FieldPath $fieldPath The field path to return. @return mixed @throws \InvalidArgumentException if the field path does not exist.
[ "Get", "a", "field", "by", "field", "path", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/DocumentSnapshot.php#L276-L308
train
googleapis/google-cloud-php
Dialogflow/src/V2/ListEntityTypesResponse.php
ListEntityTypesResponse.setEntityTypes
public function setEntityTypes($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\V2\EntityType::class); $this->entity_types = $arr; return $this; }
php
public function setEntityTypes($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\V2\EntityType::class); $this->entity_types = $arr; return $this; }
[ "public", "function", "setEntityTypes", "(", "$", "var", ")", "{", "$", "arr", "=", "GPBUtil", "::", "checkRepeatedField", "(", "$", "var", ",", "\\", "Google", "\\", "Protobuf", "\\", "Internal", "\\", "GPBType", "::", "MESSAGE", ",", "\\", "Google", "\\", "Cloud", "\\", "Dialogflow", "\\", "V2", "\\", "EntityType", "::", "class", ")", ";", "$", "this", "->", "entity_types", "=", "$", "arr", ";", "return", "$", "this", ";", "}" ]
The list of agent entity types. There will be a maximum number of items returned based on the page_size field in the request. Generated from protobuf field <code>repeated .google.cloud.dialogflow.v2.EntityType entity_types = 1;</code> @param \Google\Cloud\Dialogflow\V2\EntityType[]|\Google\Protobuf\Internal\RepeatedField $var @return $this
[ "The", "list", "of", "agent", "entity", "types", ".", "There", "will", "be", "a", "maximum", "number", "of", "items", "returned", "based", "on", "the", "page_size", "field", "in", "the", "request", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dialogflow/src/V2/ListEntityTypesResponse.php#L72-L78
train
googleapis/google-cloud-php
BigQueryDataTransfer/src/V1/ScheduleTransferRunsResponse.php
ScheduleTransferRunsResponse.setRuns
public function setRuns($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\BigQuery\DataTransfer\V1\TransferRun::class); $this->runs = $arr; return $this; }
php
public function setRuns($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\BigQuery\DataTransfer\V1\TransferRun::class); $this->runs = $arr; return $this; }
[ "public", "function", "setRuns", "(", "$", "var", ")", "{", "$", "arr", "=", "GPBUtil", "::", "checkRepeatedField", "(", "$", "var", ",", "\\", "Google", "\\", "Protobuf", "\\", "Internal", "\\", "GPBType", "::", "MESSAGE", ",", "\\", "Google", "\\", "Cloud", "\\", "BigQuery", "\\", "DataTransfer", "\\", "V1", "\\", "TransferRun", "::", "class", ")", ";", "$", "this", "->", "runs", "=", "$", "arr", ";", "return", "$", "this", ";", "}" ]
The transfer runs that were scheduled. Generated from protobuf field <code>repeated .google.cloud.bigquery.datatransfer.v1.TransferRun runs = 1;</code> @param \Google\Cloud\BigQuery\DataTransfer\V1\TransferRun[]|\Google\Protobuf\Internal\RepeatedField $var @return $this
[ "The", "transfer", "runs", "that", "were", "scheduled", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/BigQueryDataTransfer/src/V1/ScheduleTransferRunsResponse.php#L58-L64
train
googleapis/google-cloud-php
Talent/src/V4beta1/ProfileEvent.php
ProfileEvent.setType
public function setType($var) { GPBUtil::checkEnum($var, \Google\Cloud\Talent\V4beta1\ProfileEvent_ProfileEventType::class); $this->type = $var; return $this; }
php
public function setType($var) { GPBUtil::checkEnum($var, \Google\Cloud\Talent\V4beta1\ProfileEvent_ProfileEventType::class); $this->type = $var; return $this; }
[ "public", "function", "setType", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkEnum", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Talent", "\\", "V4beta1", "\\", "ProfileEvent_ProfileEventType", "::", "class", ")", ";", "$", "this", "->", "type", "=", "$", "var", ";", "return", "$", "this", ";", "}" ]
Required. Type of event. Generated from protobuf field <code>.google.cloud.talent.v4beta1.ProfileEvent.ProfileEventType type = 1;</code> @param int $var @return $this
[ "Required", ".", "Type", "of", "event", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Talent/src/V4beta1/ProfileEvent.php#L91-L97
train
googleapis/google-cloud-php
Dialogflow/src/V2/CreateContextRequest.php
CreateContextRequest.setContext
public function setContext($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\Context::class); $this->context = $var; return $this; }
php
public function setContext($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\Context::class); $this->context = $var; return $this; }
[ "public", "function", "setContext", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Dialogflow", "\\", "V2", "\\", "Context", "::", "class", ")", ";", "$", "this", "->", "context", "=", "$", "var", ";", "return", "$", "this", ";", "}" ]
Required. The context to create. Generated from protobuf field <code>.google.cloud.dialogflow.v2.Context context = 2;</code> @param \Google\Cloud\Dialogflow\V2\Context $var @return $this
[ "Required", ".", "The", "context", "to", "create", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dialogflow/src/V2/CreateContextRequest.php#L96-L102
train
googleapis/google-cloud-php
Dlp/src/V2/InspectResult.php
InspectResult.setFindings
public function setFindings($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dlp\V2\Finding::class); $this->findings = $arr; return $this; }
php
public function setFindings($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dlp\V2\Finding::class); $this->findings = $arr; return $this; }
[ "public", "function", "setFindings", "(", "$", "var", ")", "{", "$", "arr", "=", "GPBUtil", "::", "checkRepeatedField", "(", "$", "var", ",", "\\", "Google", "\\", "Protobuf", "\\", "Internal", "\\", "GPBType", "::", "MESSAGE", ",", "\\", "Google", "\\", "Cloud", "\\", "Dlp", "\\", "V2", "\\", "Finding", "::", "class", ")", ";", "$", "this", "->", "findings", "=", "$", "arr", ";", "return", "$", "this", ";", "}" ]
List of findings for an item. Generated from protobuf field <code>repeated .google.privacy.dlp.v2.Finding findings = 1;</code> @param \Google\Cloud\Dlp\V2\Finding[]|\Google\Protobuf\Internal\RepeatedField $var @return $this
[ "List", "of", "findings", "for", "an", "item", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/InspectResult.php#L76-L82
train
googleapis/google-cloud-php
Debugger/src/V2/ListDebuggeesResponse.php
ListDebuggeesResponse.setDebuggees
public function setDebuggees($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Debugger\V2\Debuggee::class); $this->debuggees = $arr; return $this; }
php
public function setDebuggees($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Debugger\V2\Debuggee::class); $this->debuggees = $arr; return $this; }
[ "public", "function", "setDebuggees", "(", "$", "var", ")", "{", "$", "arr", "=", "GPBUtil", "::", "checkRepeatedField", "(", "$", "var", ",", "\\", "Google", "\\", "Protobuf", "\\", "Internal", "\\", "GPBType", "::", "MESSAGE", ",", "\\", "Google", "\\", "Cloud", "\\", "Debugger", "\\", "V2", "\\", "Debuggee", "::", "class", ")", ";", "$", "this", "->", "debuggees", "=", "$", "arr", ";", "return", "$", "this", ";", "}" ]
List of debuggees accessible to the calling user. The fields `debuggee.id` and `description` are guaranteed to be set. The `description` field is a human readable field provided by agents and can be displayed to users. Generated from protobuf field <code>repeated .google.devtools.clouddebugger.v2.Debuggee debuggees = 1;</code> @param \Google\Cloud\Debugger\V2\Debuggee[]|\Google\Protobuf\Internal\RepeatedField $var @return $this
[ "List", "of", "debuggees", "accessible", "to", "the", "calling", "user", ".", "The", "fields", "debuggee", ".", "id", "and", "description", "are", "guaranteed", "to", "be", "set", ".", "The", "description", "field", "is", "a", "human", "readable", "field", "provided", "by", "agents", "and", "can", "be", "displayed", "to", "users", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Debugger/src/V2/ListDebuggeesResponse.php#L70-L76
train
googleapis/google-cloud-php
SecurityCenter/src/V1/OrganizationSettings.php
OrganizationSettings.setAssetDiscoveryConfig
public function setAssetDiscoveryConfig($var) { GPBUtil::checkMessage($var, \Google\Cloud\SecurityCenter\V1\OrganizationSettings_AssetDiscoveryConfig::class); $this->asset_discovery_config = $var; return $this; }
php
public function setAssetDiscoveryConfig($var) { GPBUtil::checkMessage($var, \Google\Cloud\SecurityCenter\V1\OrganizationSettings_AssetDiscoveryConfig::class); $this->asset_discovery_config = $var; return $this; }
[ "public", "function", "setAssetDiscoveryConfig", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "SecurityCenter", "\\", "V1", "\\", "OrganizationSettings_AssetDiscoveryConfig", "::", "class", ")", ";", "$", "this", "->", "asset_discovery_config", "=", "$", "var", ";", "return", "$", "this", ";", "}" ]
The configuration used for Asset Discovery runs. Generated from protobuf field <code>.google.cloud.securitycenter.v1.OrganizationSettings.AssetDiscoveryConfig asset_discovery_config = 3;</code> @param \Google\Cloud\SecurityCenter\V1\OrganizationSettings\AssetDiscoveryConfig $var @return $this
[ "The", "configuration", "used", "for", "Asset", "Discovery", "runs", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/SecurityCenter/src/V1/OrganizationSettings.php#L151-L157
train
googleapis/google-cloud-php
Talent/src/V4beta1/Job.php
Job.setJobBenefits
public function setJobBenefits($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\Talent\V4beta1\JobBenefit::class); $this->job_benefits = $arr; return $this; }
php
public function setJobBenefits($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\Talent\V4beta1\JobBenefit::class); $this->job_benefits = $arr; return $this; }
[ "public", "function", "setJobBenefits", "(", "$", "var", ")", "{", "$", "arr", "=", "GPBUtil", "::", "checkRepeatedField", "(", "$", "var", ",", "\\", "Google", "\\", "Protobuf", "\\", "Internal", "\\", "GPBType", "::", "ENUM", ",", "\\", "Google", "\\", "Cloud", "\\", "Talent", "\\", "V4beta1", "\\", "JobBenefit", "::", "class", ")", ";", "$", "this", "->", "job_benefits", "=", "$", "arr", ";", "return", "$", "this", ";", "}" ]
Optional. The benefits included with the job. Generated from protobuf field <code>repeated .google.cloud.talent.v4beta1.JobBenefit job_benefits = 8;</code> @param int[]|\Google\Protobuf\Internal\RepeatedField $var @return $this
[ "Optional", ".", "The", "benefits", "included", "with", "the", "job", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Talent/src/V4beta1/Job.php#L897-L903
train
googleapis/google-cloud-php
Talent/src/V4beta1/Job.php
Job.setDegreeTypes
public function setDegreeTypes($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\Talent\V4beta1\DegreeType::class); $this->degree_types = $arr; return $this; }
php
public function setDegreeTypes($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\Talent\V4beta1\DegreeType::class); $this->degree_types = $arr; return $this; }
[ "public", "function", "setDegreeTypes", "(", "$", "var", ")", "{", "$", "arr", "=", "GPBUtil", "::", "checkRepeatedField", "(", "$", "var", ",", "\\", "Google", "\\", "Protobuf", "\\", "Internal", "\\", "GPBType", "::", "ENUM", ",", "\\", "Google", "\\", "Cloud", "\\", "Talent", "\\", "V4beta1", "\\", "DegreeType", "::", "class", ")", ";", "$", "this", "->", "degree_types", "=", "$", "arr", ";", "return", "$", "this", ";", "}" ]
Optional. The desired education degrees for the job, such as Bachelors, Masters. Generated from protobuf field <code>repeated .google.cloud.talent.v4beta1.DegreeType degree_types = 11;</code> @param int[]|\Google\Protobuf\Internal\RepeatedField $var @return $this
[ "Optional", ".", "The", "desired", "education", "degrees", "for", "the", "job", "such", "as", "Bachelors", "Masters", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Talent/src/V4beta1/Job.php#L1001-L1007
train
googleapis/google-cloud-php
Talent/src/V4beta1/Job.php
Job.setJobLevel
public function setJobLevel($var) { GPBUtil::checkEnum($var, \Google\Cloud\Talent\V4beta1\JobLevel::class); $this->job_level = $var; return $this; }
php
public function setJobLevel($var) { GPBUtil::checkEnum($var, \Google\Cloud\Talent\V4beta1\JobLevel::class); $this->job_level = $var; return $this; }
[ "public", "function", "setJobLevel", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkEnum", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Talent", "\\", "V4beta1", "\\", "JobLevel", "::", "class", ")", ";", "$", "this", "->", "job_level", "=", "$", "var", ";", "return", "$", "this", ";", "}" ]
Optional. The experience level associated with the job, such as "Entry Level". Generated from protobuf field <code>.google.cloud.talent.v4beta1.JobLevel job_level = 16;</code> @param int $var @return $this
[ "Optional", ".", "The", "experience", "level", "associated", "with", "the", "job", "such", "as", "Entry", "Level", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Talent/src/V4beta1/Job.php#L1173-L1179
train
googleapis/google-cloud-php
Talent/src/V4beta1/Job.php
Job.setDerivedInfo
public function setDerivedInfo($var) { GPBUtil::checkMessage($var, \Google\Cloud\Talent\V4beta1\Job_DerivedInfo::class); $this->derived_info = $var; return $this; }
php
public function setDerivedInfo($var) { GPBUtil::checkMessage($var, \Google\Cloud\Talent\V4beta1\Job_DerivedInfo::class); $this->derived_info = $var; return $this; }
[ "public", "function", "setDerivedInfo", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Talent", "\\", "V4beta1", "\\", "Job_DerivedInfo", "::", "class", ")", ";", "$", "this", "->", "derived_info", "=", "$", "var", ";", "return", "$", "this", ";", "}" ]
Output only. Derived details about the job posting. Generated from protobuf field <code>.google.cloud.talent.v4beta1.Job.DerivedInfo derived_info = 29;</code> @param \Google\Cloud\Talent\V4beta1\Job\DerivedInfo $var @return $this
[ "Output", "only", ".", "Derived", "details", "about", "the", "job", "posting", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Talent/src/V4beta1/Job.php#L1647-L1653
train
googleapis/google-cloud-php
Talent/src/V4beta1/Job.php
Job.setProcessingOptions
public function setProcessingOptions($var) { GPBUtil::checkMessage($var, \Google\Cloud\Talent\V4beta1\Job_ProcessingOptions::class); $this->processing_options = $var; return $this; }
php
public function setProcessingOptions($var) { GPBUtil::checkMessage($var, \Google\Cloud\Talent\V4beta1\Job_ProcessingOptions::class); $this->processing_options = $var; return $this; }
[ "public", "function", "setProcessingOptions", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Talent", "\\", "V4beta1", "\\", "Job_ProcessingOptions", "::", "class", ")", ";", "$", "this", "->", "processing_options", "=", "$", "var", ";", "return", "$", "this", ";", "}" ]
Optional. Options for job processing. Generated from protobuf field <code>.google.cloud.talent.v4beta1.Job.ProcessingOptions processing_options = 30;</code> @param \Google\Cloud\Talent\V4beta1\Job\ProcessingOptions $var @return $this
[ "Optional", ".", "Options", "for", "job", "processing", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Talent/src/V4beta1/Job.php#L1675-L1681
train
googleapis/google-cloud-php
Firestore/src/V1beta1/Write.php
Write.setUpdate
public function setUpdate($var) { GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1beta1\Document::class); $this->writeOneof(1, $var); return $this; }
php
public function setUpdate($var) { GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1beta1\Document::class); $this->writeOneof(1, $var); return $this; }
[ "public", "function", "setUpdate", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Firestore", "\\", "V1beta1", "\\", "Document", "::", "class", ")", ";", "$", "this", "->", "writeOneof", "(", "1", ",", "$", "var", ")", ";", "return", "$", "this", ";", "}" ]
A document to write. Generated from protobuf field <code>.google.firestore.v1beta1.Document update = 1;</code> @param \Google\Cloud\Firestore\V1beta1\Document $var @return $this
[ "A", "document", "to", "write", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/V1beta1/Write.php#L95-L101
train
googleapis/google-cloud-php
Firestore/src/V1beta1/Write.php
Write.setTransform
public function setTransform($var) { GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1beta1\DocumentTransform::class); $this->writeOneof(6, $var); return $this; }
php
public function setTransform($var) { GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1beta1\DocumentTransform::class); $this->writeOneof(6, $var); return $this; }
[ "public", "function", "setTransform", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Firestore", "\\", "V1beta1", "\\", "DocumentTransform", "::", "class", ")", ";", "$", "this", "->", "writeOneof", "(", "6", ",", "$", "var", ")", ";", "return", "$", "this", ";", "}" ]
Applies a transformation to a document. At most one `transform` per document is allowed in a given request. An `update` cannot follow a `transform` on the same document in a given request. Generated from protobuf field <code>.google.firestore.v1beta1.DocumentTransform transform = 6;</code> @param \Google\Cloud\Firestore\V1beta1\DocumentTransform $var @return $this
[ "Applies", "a", "transformation", "to", "a", "document", ".", "At", "most", "one", "transform", "per", "document", "is", "allowed", "in", "a", "given", "request", ".", "An", "update", "cannot", "follow", "a", "transform", "on", "the", "same", "document", "in", "a", "given", "request", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/V1beta1/Write.php#L155-L161
train
googleapis/google-cloud-php
Firestore/src/V1beta1/Write.php
Write.setUpdateMask
public function setUpdateMask($var) { GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1beta1\DocumentMask::class); $this->update_mask = $var; return $this; }
php
public function setUpdateMask($var) { GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1beta1\DocumentMask::class); $this->update_mask = $var; return $this; }
[ "public", "function", "setUpdateMask", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Firestore", "\\", "V1beta1", "\\", "DocumentMask", "::", "class", ")", ";", "$", "this", "->", "update_mask", "=", "$", "var", ";", "return", "$", "this", ";", "}" ]
The fields to update in this write. This field can be set only when the operation is `update`. If the mask is not set for an `update` and the document exists, any existing data will be overwritten. If the mask is set and the document on the server has fields not covered by the mask, they are left unchanged. Fields referenced in the mask, but not present in the input document, are deleted from the document on the server. The field paths in this mask must not contain a reserved field name. Generated from protobuf field <code>.google.firestore.v1beta1.DocumentMask update_mask = 3;</code> @param \Google\Cloud\Firestore\V1beta1\DocumentMask $var @return $this
[ "The", "fields", "to", "update", "in", "this", "write", ".", "This", "field", "can", "be", "set", "only", "when", "the", "operation", "is", "update", ".", "If", "the", "mask", "is", "not", "set", "for", "an", "update", "and", "the", "document", "exists", "any", "existing", "data", "will", "be", "overwritten", ".", "If", "the", "mask", "is", "set", "and", "the", "document", "on", "the", "server", "has", "fields", "not", "covered", "by", "the", "mask", "they", "are", "left", "unchanged", ".", "Fields", "referenced", "in", "the", "mask", "but", "not", "present", "in", "the", "input", "document", "are", "deleted", "from", "the", "document", "on", "the", "server", ".", "The", "field", "paths", "in", "this", "mask", "must", "not", "contain", "a", "reserved", "field", "name", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/V1beta1/Write.php#L197-L203
train
googleapis/google-cloud-php
Dlp/src/V2/ReplaceValueConfig.php
ReplaceValueConfig.setNewValue
public function setNewValue($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\Value::class); $this->new_value = $var; return $this; }
php
public function setNewValue($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\Value::class); $this->new_value = $var; return $this; }
[ "public", "function", "setNewValue", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Dlp", "\\", "V2", "\\", "Value", "::", "class", ")", ";", "$", "this", "->", "new_value", "=", "$", "var", ";", "return", "$", "this", ";", "}" ]
Value to replace it with. Generated from protobuf field <code>.google.privacy.dlp.v2.Value new_value = 1;</code> @param \Google\Cloud\Dlp\V2\Value $var @return $this
[ "Value", "to", "replace", "it", "with", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/ReplaceValueConfig.php#L58-L64
train
googleapis/google-cloud-php
dev/src/Split/Command.php
Command.execute
protected function execute(InputInterface $input, OutputInterface $output) { if (PHP_VERSION_ID < 50600) { throw new \RuntimeException('This command is only available in PHP 5.6 and later.'); } $execDir = $this->rootPath . '/' . self::EXEC_DIR; $token = $this->githubToken($input->getOption('token')); $shell = new RunShell; $guzzle = $this->guzzleClient(); $github = $this->githubClient($output, $shell, $guzzle, $token); $split = $this->splitWrapper($output, $shell); @mkdir($execDir); $splitBinaryPath = $this->splitshInstall($output, $shell, $execDir, $input->getOption('splitsh')); $componentId = $input->getOption('component'); $components = $this->componentManager->componentsExtra($componentId); // remove umbrella component. $components = array_filter($components, function ($component, $key) { return $key !== 'google-cloud'; }, ARRAY_FILTER_USE_BOTH); $manifestPath = $this->rootPath . '/docs/manifest.json'; $parentTagSource = sprintf(self::PARENT_TAG_NAME, $input->getArgument('parent')); $errors = []; foreach ($components as $component) { $res = $this->processComponent($output, $github, $split, $component, $splitBinaryPath, $parentTagSource); if (!$res) { $errors[] = $component['id']; } $output->writeln(''); $output->writeln(''); } if ($errors) { $output->writeln('<error>[ERROR]</error>: One or more components reported an error.'); $output->writeln('Please correct errors and try again.'); $output->writeln('Error component(s): ' . implode(', ', $errors)); return 1; } return 0; }
php
protected function execute(InputInterface $input, OutputInterface $output) { if (PHP_VERSION_ID < 50600) { throw new \RuntimeException('This command is only available in PHP 5.6 and later.'); } $execDir = $this->rootPath . '/' . self::EXEC_DIR; $token = $this->githubToken($input->getOption('token')); $shell = new RunShell; $guzzle = $this->guzzleClient(); $github = $this->githubClient($output, $shell, $guzzle, $token); $split = $this->splitWrapper($output, $shell); @mkdir($execDir); $splitBinaryPath = $this->splitshInstall($output, $shell, $execDir, $input->getOption('splitsh')); $componentId = $input->getOption('component'); $components = $this->componentManager->componentsExtra($componentId); // remove umbrella component. $components = array_filter($components, function ($component, $key) { return $key !== 'google-cloud'; }, ARRAY_FILTER_USE_BOTH); $manifestPath = $this->rootPath . '/docs/manifest.json'; $parentTagSource = sprintf(self::PARENT_TAG_NAME, $input->getArgument('parent')); $errors = []; foreach ($components as $component) { $res = $this->processComponent($output, $github, $split, $component, $splitBinaryPath, $parentTagSource); if (!$res) { $errors[] = $component['id']; } $output->writeln(''); $output->writeln(''); } if ($errors) { $output->writeln('<error>[ERROR]</error>: One or more components reported an error.'); $output->writeln('Please correct errors and try again.'); $output->writeln('Error component(s): ' . implode(', ', $errors)); return 1; } return 0; }
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "if", "(", "PHP_VERSION_ID", "<", "50600", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "'This command is only available in PHP 5.6 and later.'", ")", ";", "}", "$", "execDir", "=", "$", "this", "->", "rootPath", ".", "'/'", ".", "self", "::", "EXEC_DIR", ";", "$", "token", "=", "$", "this", "->", "githubToken", "(", "$", "input", "->", "getOption", "(", "'token'", ")", ")", ";", "$", "shell", "=", "new", "RunShell", ";", "$", "guzzle", "=", "$", "this", "->", "guzzleClient", "(", ")", ";", "$", "github", "=", "$", "this", "->", "githubClient", "(", "$", "output", ",", "$", "shell", ",", "$", "guzzle", ",", "$", "token", ")", ";", "$", "split", "=", "$", "this", "->", "splitWrapper", "(", "$", "output", ",", "$", "shell", ")", ";", "@", "mkdir", "(", "$", "execDir", ")", ";", "$", "splitBinaryPath", "=", "$", "this", "->", "splitshInstall", "(", "$", "output", ",", "$", "shell", ",", "$", "execDir", ",", "$", "input", "->", "getOption", "(", "'splitsh'", ")", ")", ";", "$", "componentId", "=", "$", "input", "->", "getOption", "(", "'component'", ")", ";", "$", "components", "=", "$", "this", "->", "componentManager", "->", "componentsExtra", "(", "$", "componentId", ")", ";", "// remove umbrella component.", "$", "components", "=", "array_filter", "(", "$", "components", ",", "function", "(", "$", "component", ",", "$", "key", ")", "{", "return", "$", "key", "!==", "'google-cloud'", ";", "}", ",", "ARRAY_FILTER_USE_BOTH", ")", ";", "$", "manifestPath", "=", "$", "this", "->", "rootPath", ".", "'/docs/manifest.json'", ";", "$", "parentTagSource", "=", "sprintf", "(", "self", "::", "PARENT_TAG_NAME", ",", "$", "input", "->", "getArgument", "(", "'parent'", ")", ")", ";", "$", "errors", "=", "[", "]", ";", "foreach", "(", "$", "components", "as", "$", "component", ")", "{", "$", "res", "=", "$", "this", "->", "processComponent", "(", "$", "output", ",", "$", "github", ",", "$", "split", ",", "$", "component", ",", "$", "splitBinaryPath", ",", "$", "parentTagSource", ")", ";", "if", "(", "!", "$", "res", ")", "{", "$", "errors", "[", "]", "=", "$", "component", "[", "'id'", "]", ";", "}", "$", "output", "->", "writeln", "(", "''", ")", ";", "$", "output", "->", "writeln", "(", "''", ")", ";", "}", "if", "(", "$", "errors", ")", "{", "$", "output", "->", "writeln", "(", "'<error>[ERROR]</error>: One or more components reported an error.'", ")", ";", "$", "output", "->", "writeln", "(", "'Please correct errors and try again.'", ")", ";", "$", "output", "->", "writeln", "(", "'Error component(s): '", ".", "implode", "(", "', '", ",", "$", "errors", ")", ")", ";", "return", "1", ";", "}", "return", "0", ";", "}" ]
Execute Split and Release process. @param InputInterface $input The Symfony input handler. @param OutputInterface $output The Symfony output handler. @return int The exit code.
[ "Execute", "Split", "and", "Release", "process", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/dev/src/Split/Command.php#L100-L150
train
googleapis/google-cloud-php
dev/src/Split/Command.php
Command.processComponent
private function processComponent( OutputInterface $output, GitHub $github, Split $split, array $component, $splitBinaryPath, $parentTagSource ) { $output->writeln(''); $localVersion = current($this->componentManager->componentsVersion($component['id'])); $isAlreadyTagged = $github->doesTagExist($component['target'], $localVersion); $output->writeln(sprintf( '<comment>%s</comment>: Starting on component. Target version <info>%s</info>', $component['id'], $localVersion )); $this->writeDiv($output); if ($isAlreadyTagged) { $output->writeln(sprintf( 'Version <info>%s</info> already exists on target <info>%s</info>', $localVersion, $component['target'] )); $output->writeln('<comment>[info]</comment> Skipping.'); return true; } $output->writeln(sprintf( '<comment>%s</comment>: Running splitsh', $component['id'] )); $splitBranch = $split->execute($splitBinaryPath, $this->rootPath, $component['path']); if ($splitBranch) { $output->writeln(sprintf('Split succeeded, branch <info>%s</info> created.', $splitBranch)); } else { $output->writeln('<error>Split failed!</error>'); return false; } $output->writeln(''); $output->writeln(sprintf( '<comment>%s</comment>: Push to github target %s', $component['id'], $component['target'] )); $res = $github->push($component['target'], $splitBranch); if ($res[0]) { $output->writeln(sprintf('<comment>%s</comment>: Push succeeded.', $component['id'])); } else { $output->writeln(sprintf('<error>%s</error>: Push failed.', $component['id'])); return false; } $output->writeln(''); $output->writeln('<comment>[info]</comment> Creating GitHub tag.'); // @todo once the release builder is refactored, this should generate // actually useful release notes for the component in question. $notes = sprintf( 'For release notes, please see the [associated Google Cloud PHP release](%s).', $parentTagSource ); $res = $github->createRelease( $component['target'], $localVersion, $component['displayName'] . ' ' . $localVersion, $notes ); if ($res) { $output->writeln(sprintf('<comment>%s</comment>: Tag succeeded.', $component['id'])); } else { $output->writeln(sprintf('<error>%s</error>: Tag failed.', $component['id'])); return false; } return true; }
php
private function processComponent( OutputInterface $output, GitHub $github, Split $split, array $component, $splitBinaryPath, $parentTagSource ) { $output->writeln(''); $localVersion = current($this->componentManager->componentsVersion($component['id'])); $isAlreadyTagged = $github->doesTagExist($component['target'], $localVersion); $output->writeln(sprintf( '<comment>%s</comment>: Starting on component. Target version <info>%s</info>', $component['id'], $localVersion )); $this->writeDiv($output); if ($isAlreadyTagged) { $output->writeln(sprintf( 'Version <info>%s</info> already exists on target <info>%s</info>', $localVersion, $component['target'] )); $output->writeln('<comment>[info]</comment> Skipping.'); return true; } $output->writeln(sprintf( '<comment>%s</comment>: Running splitsh', $component['id'] )); $splitBranch = $split->execute($splitBinaryPath, $this->rootPath, $component['path']); if ($splitBranch) { $output->writeln(sprintf('Split succeeded, branch <info>%s</info> created.', $splitBranch)); } else { $output->writeln('<error>Split failed!</error>'); return false; } $output->writeln(''); $output->writeln(sprintf( '<comment>%s</comment>: Push to github target %s', $component['id'], $component['target'] )); $res = $github->push($component['target'], $splitBranch); if ($res[0]) { $output->writeln(sprintf('<comment>%s</comment>: Push succeeded.', $component['id'])); } else { $output->writeln(sprintf('<error>%s</error>: Push failed.', $component['id'])); return false; } $output->writeln(''); $output->writeln('<comment>[info]</comment> Creating GitHub tag.'); // @todo once the release builder is refactored, this should generate // actually useful release notes for the component in question. $notes = sprintf( 'For release notes, please see the [associated Google Cloud PHP release](%s).', $parentTagSource ); $res = $github->createRelease( $component['target'], $localVersion, $component['displayName'] . ' ' . $localVersion, $notes ); if ($res) { $output->writeln(sprintf('<comment>%s</comment>: Tag succeeded.', $component['id'])); } else { $output->writeln(sprintf('<error>%s</error>: Tag failed.', $component['id'])); return false; } return true; }
[ "private", "function", "processComponent", "(", "OutputInterface", "$", "output", ",", "GitHub", "$", "github", ",", "Split", "$", "split", ",", "array", "$", "component", ",", "$", "splitBinaryPath", ",", "$", "parentTagSource", ")", "{", "$", "output", "->", "writeln", "(", "''", ")", ";", "$", "localVersion", "=", "current", "(", "$", "this", "->", "componentManager", "->", "componentsVersion", "(", "$", "component", "[", "'id'", "]", ")", ")", ";", "$", "isAlreadyTagged", "=", "$", "github", "->", "doesTagExist", "(", "$", "component", "[", "'target'", "]", ",", "$", "localVersion", ")", ";", "$", "output", "->", "writeln", "(", "sprintf", "(", "'<comment>%s</comment>: Starting on component. Target version <info>%s</info>'", ",", "$", "component", "[", "'id'", "]", ",", "$", "localVersion", ")", ")", ";", "$", "this", "->", "writeDiv", "(", "$", "output", ")", ";", "if", "(", "$", "isAlreadyTagged", ")", "{", "$", "output", "->", "writeln", "(", "sprintf", "(", "'Version <info>%s</info> already exists on target <info>%s</info>'", ",", "$", "localVersion", ",", "$", "component", "[", "'target'", "]", ")", ")", ";", "$", "output", "->", "writeln", "(", "'<comment>[info]</comment> Skipping.'", ")", ";", "return", "true", ";", "}", "$", "output", "->", "writeln", "(", "sprintf", "(", "'<comment>%s</comment>: Running splitsh'", ",", "$", "component", "[", "'id'", "]", ")", ")", ";", "$", "splitBranch", "=", "$", "split", "->", "execute", "(", "$", "splitBinaryPath", ",", "$", "this", "->", "rootPath", ",", "$", "component", "[", "'path'", "]", ")", ";", "if", "(", "$", "splitBranch", ")", "{", "$", "output", "->", "writeln", "(", "sprintf", "(", "'Split succeeded, branch <info>%s</info> created.'", ",", "$", "splitBranch", ")", ")", ";", "}", "else", "{", "$", "output", "->", "writeln", "(", "'<error>Split failed!</error>'", ")", ";", "return", "false", ";", "}", "$", "output", "->", "writeln", "(", "''", ")", ";", "$", "output", "->", "writeln", "(", "sprintf", "(", "'<comment>%s</comment>: Push to github target %s'", ",", "$", "component", "[", "'id'", "]", ",", "$", "component", "[", "'target'", "]", ")", ")", ";", "$", "res", "=", "$", "github", "->", "push", "(", "$", "component", "[", "'target'", "]", ",", "$", "splitBranch", ")", ";", "if", "(", "$", "res", "[", "0", "]", ")", "{", "$", "output", "->", "writeln", "(", "sprintf", "(", "'<comment>%s</comment>: Push succeeded.'", ",", "$", "component", "[", "'id'", "]", ")", ")", ";", "}", "else", "{", "$", "output", "->", "writeln", "(", "sprintf", "(", "'<error>%s</error>: Push failed.'", ",", "$", "component", "[", "'id'", "]", ")", ")", ";", "return", "false", ";", "}", "$", "output", "->", "writeln", "(", "''", ")", ";", "$", "output", "->", "writeln", "(", "'<comment>[info]</comment> Creating GitHub tag.'", ")", ";", "// @todo once the release builder is refactored, this should generate", "// actually useful release notes for the component in question.", "$", "notes", "=", "sprintf", "(", "'For release notes, please see the [associated Google Cloud PHP release](%s).'", ",", "$", "parentTagSource", ")", ";", "$", "res", "=", "$", "github", "->", "createRelease", "(", "$", "component", "[", "'target'", "]", ",", "$", "localVersion", ",", "$", "component", "[", "'displayName'", "]", ".", "' '", ".", "$", "localVersion", ",", "$", "notes", ")", ";", "if", "(", "$", "res", ")", "{", "$", "output", "->", "writeln", "(", "sprintf", "(", "'<comment>%s</comment>: Tag succeeded.'", ",", "$", "component", "[", "'id'", "]", ")", ")", ";", "}", "else", "{", "$", "output", "->", "writeln", "(", "sprintf", "(", "'<error>%s</error>: Tag failed.'", ",", "$", "component", "[", "'id'", "]", ")", ")", ";", "return", "false", ";", "}", "return", "true", ";", "}" ]
Process release for a given component. Checks if the tag exists on the remote target, splits the component, pushes to the remote target and creates a github release. @param OutputInterface $output Allows writing to cli. @param GitHub A GitHub API wrapper. @param Split A Splitsh wrapper. @param array $component The component data. @param string $splitBinaryPath The path to the splitsh binary. @param string $parentTagSource The URI to the parent tag. @return bool
[ "Process", "release", "for", "a", "given", "component", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/dev/src/Split/Command.php#L166-L254
train
googleapis/google-cloud-php
dev/src/Split/Command.php
Command.githubToken
protected function githubToken($userToken) { $token = $userToken ?: getenv(self::TOKEN_ENV); if (!$token) { throw new \RuntimeException(sprintf( 'Could not find GitHub auth token. Please set the environment ' . 'variable `%s` or pass token as console argument.', self::TOKEN_ENV )); } return $token; }
php
protected function githubToken($userToken) { $token = $userToken ?: getenv(self::TOKEN_ENV); if (!$token) { throw new \RuntimeException(sprintf( 'Could not find GitHub auth token. Please set the environment ' . 'variable `%s` or pass token as console argument.', self::TOKEN_ENV )); } return $token; }
[ "protected", "function", "githubToken", "(", "$", "userToken", ")", "{", "$", "token", "=", "$", "userToken", "?", ":", "getenv", "(", "self", "::", "TOKEN_ENV", ")", ";", "if", "(", "!", "$", "token", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "sprintf", "(", "'Could not find GitHub auth token. Please set the environment '", ".", "'variable `%s` or pass token as console argument.'", ",", "self", "::", "TOKEN_ENV", ")", ")", ";", "}", "return", "$", "token", ";", "}" ]
Fetch the GitHub auth token from the user or environment. @param string|null $userToken The user token, if provided, else `null`. @return string @throws \RuntimeException If no user token was given and the environment variable is not set.
[ "Fetch", "the", "GitHub", "auth", "token", "from", "the", "user", "or", "environment", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/dev/src/Split/Command.php#L264-L277
train
googleapis/google-cloud-php
dev/src/Split/Command.php
Command.githubClient
protected function githubClient(OutputInterface $output, RunShell $shell, Client $guzzle, $token) { $output->writeln('<comment>[info]</comment> Instantiating GitHub API Wrapper.'); return new GitHub($shell, $guzzle, $token); }
php
protected function githubClient(OutputInterface $output, RunShell $shell, Client $guzzle, $token) { $output->writeln('<comment>[info]</comment> Instantiating GitHub API Wrapper.'); return new GitHub($shell, $guzzle, $token); }
[ "protected", "function", "githubClient", "(", "OutputInterface", "$", "output", ",", "RunShell", "$", "shell", ",", "Client", "$", "guzzle", ",", "$", "token", ")", "{", "$", "output", "->", "writeln", "(", "'<comment>[info]</comment> Instantiating GitHub API Wrapper.'", ")", ";", "return", "new", "GitHub", "(", "$", "shell", ",", "$", "guzzle", ",", "$", "token", ")", ";", "}" ]
Initialize the Github client. You can override this method in unit tests. @param OutputInterface $output Allows writing to cli. @param RunShell $shell A wrapper for executing shell commands. @param Client $guzzle A guzzle client for executing HTTP requests. @param string $token A Github auth token. @return GitHub
[ "Initialize", "the", "Github", "client", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/dev/src/Split/Command.php#L306-L311
train
googleapis/google-cloud-php
dev/src/Split/Command.php
Command.splitshInstall
protected function splitshInstall(OutputInterface $output, RunShell $shell, $execDir, $binaryPath) { if ($binaryPath) { $output->writeln('<comment>[info]</comment> Using User-Provided Splitsh binary.'); return $binaryPath; } $output->writeln('<comment>[info]</comment> Compiling Splitsh'); $this->writeDiv($output); $install = new SplitInstall($shell, $execDir); $res = $install->installFromSource($this->rootPath); $output->writeln(sprintf( '<comment>[info]</comment> Splitsh Installer says <info>%s</info>', $res[0] )); return $res[1]; }
php
protected function splitshInstall(OutputInterface $output, RunShell $shell, $execDir, $binaryPath) { if ($binaryPath) { $output->writeln('<comment>[info]</comment> Using User-Provided Splitsh binary.'); return $binaryPath; } $output->writeln('<comment>[info]</comment> Compiling Splitsh'); $this->writeDiv($output); $install = new SplitInstall($shell, $execDir); $res = $install->installFromSource($this->rootPath); $output->writeln(sprintf( '<comment>[info]</comment> Splitsh Installer says <info>%s</info>', $res[0] )); return $res[1]; }
[ "protected", "function", "splitshInstall", "(", "OutputInterface", "$", "output", ",", "RunShell", "$", "shell", ",", "$", "execDir", ",", "$", "binaryPath", ")", "{", "if", "(", "$", "binaryPath", ")", "{", "$", "output", "->", "writeln", "(", "'<comment>[info]</comment> Using User-Provided Splitsh binary.'", ")", ";", "return", "$", "binaryPath", ";", "}", "$", "output", "->", "writeln", "(", "'<comment>[info]</comment> Compiling Splitsh'", ")", ";", "$", "this", "->", "writeDiv", "(", "$", "output", ")", ";", "$", "install", "=", "new", "SplitInstall", "(", "$", "shell", ",", "$", "execDir", ")", ";", "$", "res", "=", "$", "install", "->", "installFromSource", "(", "$", "this", "->", "rootPath", ")", ";", "$", "output", "->", "writeln", "(", "sprintf", "(", "'<comment>[info]</comment> Splitsh Installer says <info>%s</info>'", ",", "$", "res", "[", "0", "]", ")", ")", ";", "return", "$", "res", "[", "1", "]", ";", "}" ]
Install the Splitsh program. You can override this method in unit tests. @param OutputInterface $output Allows writing to cli. @param RunShell $shell A wrapper for executing shell commands. @param string $execDir The path to a working directory. @param string|null The path to an existing splitsh binary, or null if install from source is desired. @return string
[ "Install", "the", "Splitsh", "program", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/dev/src/Split/Command.php#L337-L357
train
googleapis/google-cloud-php
Bigtable/src/Table.php
Table.mutateRows
public function mutateRows(array $rowMutations, array $options = []) { if (!$this->isAssoc($rowMutations)) { throw new \InvalidArgumentException( 'Expected rowMutations to be of type associative array, instead got list.' ); } $entries = []; foreach ($rowMutations as $rowKey => $mutations) { $entries[] = $this->toEntry($rowKey, $mutations); } $this->mutateRowsWithEntries($entries, $options); }
php
public function mutateRows(array $rowMutations, array $options = []) { if (!$this->isAssoc($rowMutations)) { throw new \InvalidArgumentException( 'Expected rowMutations to be of type associative array, instead got list.' ); } $entries = []; foreach ($rowMutations as $rowKey => $mutations) { $entries[] = $this->toEntry($rowKey, $mutations); } $this->mutateRowsWithEntries($entries, $options); }
[ "public", "function", "mutateRows", "(", "array", "$", "rowMutations", ",", "array", "$", "options", "=", "[", "]", ")", "{", "if", "(", "!", "$", "this", "->", "isAssoc", "(", "$", "rowMutations", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Expected rowMutations to be of type associative array, instead got list.'", ")", ";", "}", "$", "entries", "=", "[", "]", ";", "foreach", "(", "$", "rowMutations", "as", "$", "rowKey", "=>", "$", "mutations", ")", "{", "$", "entries", "[", "]", "=", "$", "this", "->", "toEntry", "(", "$", "rowKey", ",", "$", "mutations", ")", ";", "}", "$", "this", "->", "mutateRowsWithEntries", "(", "$", "entries", ",", "$", "options", ")", ";", "}" ]
Mutates rows in a table. Example: ``` use Google\Cloud\Bigtable\Mutations; $mutations = (new Mutations) ->upsert('cf1', 'cq1', 'value1', 1534183334215000); $table->mutateRows(['r1' => $mutations]); ``` @param array $rowMutations An associative array with the key being the row key and the value being the {@see Google\Cloud\Bigtable\Mutations} to perform. @param array $options [optional] Configuration options. @return void @throws ApiException|BigtableDataOperationException If the remote call fails or operation fails. @throws InvalidArgumentException If rowMutations is a list instead of associative array indexed by row key.
[ "Mutates", "rows", "in", "a", "table", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Bigtable/src/Table.php#L120-L132
train
googleapis/google-cloud-php
Bigtable/src/Table.php
Table.mutateRow
public function mutateRow($rowKey, Mutations $mutations, array $options = []) { $this->gapicClient->mutateRow( $this->tableName, $rowKey, $mutations->toProto(), $options + $this->options ); }
php
public function mutateRow($rowKey, Mutations $mutations, array $options = []) { $this->gapicClient->mutateRow( $this->tableName, $rowKey, $mutations->toProto(), $options + $this->options ); }
[ "public", "function", "mutateRow", "(", "$", "rowKey", ",", "Mutations", "$", "mutations", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "this", "->", "gapicClient", "->", "mutateRow", "(", "$", "this", "->", "tableName", ",", "$", "rowKey", ",", "$", "mutations", "->", "toProto", "(", ")", ",", "$", "options", "+", "$", "this", "->", "options", ")", ";", "}" ]
Mutates a row atomically. Cells already present in the row are left unchanged unless explicitly changed by `mutations`. Example: ``` use Google\Cloud\Bigtable\Mutations; $mutations = (new Mutations) ->upsert('cf1', 'cq1', 'value1', 1534183334215000); $table->mutateRow('r1', $mutations); ``` @param string $rowKey The row key of the row to mutate. @param Mutations $mutations Mutations to apply on row. @param array $options [optional] { Configuration options. @type int $retries Number of times to retry. **Defaults to** `3`. } @return void @throws ApiException If the remote call fails.
[ "Mutates", "a", "row", "atomically", ".", "Cells", "already", "present", "in", "the", "row", "are", "left", "unchanged", "unless", "explicitly", "changed", "by", "mutations", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Bigtable/src/Table.php#L158-L166
train
googleapis/google-cloud-php
Bigtable/src/Table.php
Table.readRows
public function readRows(array $options = []) { $rowKeys = $this->pluck('rowKeys', $options, false) ?: []; $ranges = $this->pluck('rowRanges', $options, false) ?: []; $filter = $this->pluck('filter', $options, false) ?: null; array_walk($ranges, function (&$range) { $range = $this->serializer->decodeMessage( new RowRange(), $range ); }); if (!is_array($rowKeys)) { throw new \InvalidArgumentException( sprintf( 'Expected rowKeys to be of type array, instead got \'%s\'.', gettype($rowKeys) ) ); } if ($ranges || $rowKeys) { $options['rows'] = $this->serializer->decodeMessage( new RowSet, [ 'rowKeys' => $rowKeys, 'rowRanges' => $ranges ] ); } if ($filter !== null) { if (!$filter instanceof FilterInterface) { throw new \InvalidArgumentException( sprintf( 'Expected filter to be of type \'%s\', instead got \'%s\'.', FilterInterface::class, gettype($filter) ) ); } $options['filter'] = $filter->toProto(); } return new ChunkFormatter( [$this->gapicClient, 'readRows'], $this->tableName, $options + $this->options ); }
php
public function readRows(array $options = []) { $rowKeys = $this->pluck('rowKeys', $options, false) ?: []; $ranges = $this->pluck('rowRanges', $options, false) ?: []; $filter = $this->pluck('filter', $options, false) ?: null; array_walk($ranges, function (&$range) { $range = $this->serializer->decodeMessage( new RowRange(), $range ); }); if (!is_array($rowKeys)) { throw new \InvalidArgumentException( sprintf( 'Expected rowKeys to be of type array, instead got \'%s\'.', gettype($rowKeys) ) ); } if ($ranges || $rowKeys) { $options['rows'] = $this->serializer->decodeMessage( new RowSet, [ 'rowKeys' => $rowKeys, 'rowRanges' => $ranges ] ); } if ($filter !== null) { if (!$filter instanceof FilterInterface) { throw new \InvalidArgumentException( sprintf( 'Expected filter to be of type \'%s\', instead got \'%s\'.', FilterInterface::class, gettype($filter) ) ); } $options['filter'] = $filter->toProto(); } return new ChunkFormatter( [$this->gapicClient, 'readRows'], $this->tableName, $options + $this->options ); }
[ "public", "function", "readRows", "(", "array", "$", "options", "=", "[", "]", ")", "{", "$", "rowKeys", "=", "$", "this", "->", "pluck", "(", "'rowKeys'", ",", "$", "options", ",", "false", ")", "?", ":", "[", "]", ";", "$", "ranges", "=", "$", "this", "->", "pluck", "(", "'rowRanges'", ",", "$", "options", ",", "false", ")", "?", ":", "[", "]", ";", "$", "filter", "=", "$", "this", "->", "pluck", "(", "'filter'", ",", "$", "options", ",", "false", ")", "?", ":", "null", ";", "array_walk", "(", "$", "ranges", ",", "function", "(", "&", "$", "range", ")", "{", "$", "range", "=", "$", "this", "->", "serializer", "->", "decodeMessage", "(", "new", "RowRange", "(", ")", ",", "$", "range", ")", ";", "}", ")", ";", "if", "(", "!", "is_array", "(", "$", "rowKeys", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "sprintf", "(", "'Expected rowKeys to be of type array, instead got \\'%s\\'.'", ",", "gettype", "(", "$", "rowKeys", ")", ")", ")", ";", "}", "if", "(", "$", "ranges", "||", "$", "rowKeys", ")", "{", "$", "options", "[", "'rows'", "]", "=", "$", "this", "->", "serializer", "->", "decodeMessage", "(", "new", "RowSet", ",", "[", "'rowKeys'", "=>", "$", "rowKeys", ",", "'rowRanges'", "=>", "$", "ranges", "]", ")", ";", "}", "if", "(", "$", "filter", "!==", "null", ")", "{", "if", "(", "!", "$", "filter", "instanceof", "FilterInterface", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "sprintf", "(", "'Expected filter to be of type \\'%s\\', instead got \\'%s\\'.'", ",", "FilterInterface", "::", "class", ",", "gettype", "(", "$", "filter", ")", ")", ")", ";", "}", "$", "options", "[", "'filter'", "]", "=", "$", "filter", "->", "toProto", "(", ")", ";", "}", "return", "new", "ChunkFormatter", "(", "[", "$", "this", "->", "gapicClient", ",", "'readRows'", "]", ",", "$", "this", "->", "tableName", ",", "$", "options", "+", "$", "this", "->", "options", ")", ";", "}" ]
Read rows from the table. Example: ``` $rows = $table->readRows(); foreach ($rows as $row) { print_r($row) . PHP_EOL; } ``` ``` // Specify a set of row ranges. $rows = $table->readRows([ 'rowRanges' => [ [ 'startKeyOpen' => 'jefferson', 'endKeyOpen' => 'lincoln' ] ] ]); foreach ($rows as $row) { print_r($row) . PHP_EOL; } ``` @param array $options [optional] { Configuration options. @type string[] $rowKeys A set of row keys to read. @type array $rowRanges A set of row ranges. Each row range is an associative array which may contain a start key (`startKeyClosed` or `startKeyOpen`) and/or an end key (`endKeyOpen` or `endKeyClosed`). @type FilterInterface $filter A filter used to take an input row and produce an alternate view of the row based on the specified rules. To learn more please see {@see Google\Cloud\Bigtable\Filter} which provides static factory methods for the various filter types. @type int $rowsLimit The number of rows to scan. @type int $retries Number of times to retry. **Defaults to** `3`. } @return ChunkFormatter
[ "Read", "rows", "from", "the", "table", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Bigtable/src/Table.php#L263-L309
train
googleapis/google-cloud-php
Bigtable/src/Table.php
Table.readRow
public function readRow($rowKey, array $options = []) { return $this->readRows( ['rowKeys' => [$rowKey]] + $options + $this->options ) ->readAll() ->current(); }
php
public function readRow($rowKey, array $options = []) { return $this->readRows( ['rowKeys' => [$rowKey]] + $options + $this->options ) ->readAll() ->current(); }
[ "public", "function", "readRow", "(", "$", "rowKey", ",", "array", "$", "options", "=", "[", "]", ")", "{", "return", "$", "this", "->", "readRows", "(", "[", "'rowKeys'", "=>", "[", "$", "rowKey", "]", "]", "+", "$", "options", "+", "$", "this", "->", "options", ")", "->", "readAll", "(", ")", "->", "current", "(", ")", ";", "}" ]
Read a single row from the table. Example: ``` $row = $table->readRow('jefferson'); print_r($row); ``` @param string $rowKey The row key to read. @param array $options [optional] Configuration options. @return array|null
[ "Read", "a", "single", "row", "from", "the", "table", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Bigtable/src/Table.php#L325-L332
train
googleapis/google-cloud-php
Bigtable/src/Table.php
Table.checkAndMutateRow
public function checkAndMutateRow($rowKey, array $options = []) { $hasSetMutations = false; if (isset($options['predicateFilter'])) { $this->convertToProto($options, 'predicateFilter', FilterInterface::class); } if (isset($options['trueMutations'])) { $this->convertToProto($options, 'trueMutations', Mutations::class); $hasSetMutations = true; } if (isset($options['falseMutations'])) { $this->convertToProto($options, 'falseMutations', Mutations::class); $hasSetMutations = true; } if (!$hasSetMutations) { throw new \InvalidArgumentException('checkAndMutateRow must have either trueMutations or falseMutations.'); } return $this->gapicClient ->checkAndMutateRow( $this->tableName, $rowKey, $options + $this->options ) ->getPredicateMatched(); }
php
public function checkAndMutateRow($rowKey, array $options = []) { $hasSetMutations = false; if (isset($options['predicateFilter'])) { $this->convertToProto($options, 'predicateFilter', FilterInterface::class); } if (isset($options['trueMutations'])) { $this->convertToProto($options, 'trueMutations', Mutations::class); $hasSetMutations = true; } if (isset($options['falseMutations'])) { $this->convertToProto($options, 'falseMutations', Mutations::class); $hasSetMutations = true; } if (!$hasSetMutations) { throw new \InvalidArgumentException('checkAndMutateRow must have either trueMutations or falseMutations.'); } return $this->gapicClient ->checkAndMutateRow( $this->tableName, $rowKey, $options + $this->options ) ->getPredicateMatched(); }
[ "public", "function", "checkAndMutateRow", "(", "$", "rowKey", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "hasSetMutations", "=", "false", ";", "if", "(", "isset", "(", "$", "options", "[", "'predicateFilter'", "]", ")", ")", "{", "$", "this", "->", "convertToProto", "(", "$", "options", ",", "'predicateFilter'", ",", "FilterInterface", "::", "class", ")", ";", "}", "if", "(", "isset", "(", "$", "options", "[", "'trueMutations'", "]", ")", ")", "{", "$", "this", "->", "convertToProto", "(", "$", "options", ",", "'trueMutations'", ",", "Mutations", "::", "class", ")", ";", "$", "hasSetMutations", "=", "true", ";", "}", "if", "(", "isset", "(", "$", "options", "[", "'falseMutations'", "]", ")", ")", "{", "$", "this", "->", "convertToProto", "(", "$", "options", ",", "'falseMutations'", ",", "Mutations", "::", "class", ")", ";", "$", "hasSetMutations", "=", "true", ";", "}", "if", "(", "!", "$", "hasSetMutations", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'checkAndMutateRow must have either trueMutations or falseMutations.'", ")", ";", "}", "return", "$", "this", "->", "gapicClient", "->", "checkAndMutateRow", "(", "$", "this", "->", "tableName", ",", "$", "rowKey", ",", "$", "options", "+", "$", "this", "->", "options", ")", "->", "getPredicateMatched", "(", ")", ";", "}" ]
Mutates the specified row atomically based on output of the filter. Example: ``` use Google\Cloud\Bigtable\Mutations; $mutations = (new Mutations)->upsert('family', 'qualifier', 'value'); $result = $table->checkAndMutateRow('rk1', ['trueMutations' => $mutations]); ``` ``` // With predicate filter use Google\Cloud\Bigtable\Filter; use Google\Cloud\Bigtable\Mutations; $mutations = (new Mutations)->upsert('family', 'qualifier', 'value'); $predicateFilter = Filter::qualifier()->exactMatch('cq'); $options = ['predicateFilter' => $predicateFilter, 'trueMutations' => $mutations]; $result = $table->checkAndMutateRow('rk1', $options); ``` @param string $rowKey The row key to mutate row conditionally. @param array $options [optional] { Configuration options. @type FilterInterface $predicateFilter The filter to be applied to the specified row. Depending on whether or not any results are yielded, either the trueMutations or falseMutations will be executed. If unset, checks that the row contains any values at all. Only a single condition can be set, however that filter can be {@see Google\Cloud\Bigtable\Filter::chain()} or {@see Google\Cloud\Bigtable\Filter::interleave()} which can wrap multiple other filters. WARNING: {@see Google\Cloud\Bigtable\Filter::condition()} is not supported. @type Mutations $trueMutations Mutations to be atomically applied when the predicate filter's condition yields at least one cell when applied to the row. Please note either `trueMutations` or `falseMutations` must be provided. @type Mutations $falseMutations Mutations to be atomically applied when the predicate filter's condition does not yield any cells when applied to the row. Please note either `trueMutations` or `falseMutations` must be provided. } @return bool Returns true if predicate filter yielded any output, false otherwise. @throws ApiException If the remote call fails or operation fails @throws \InvalidArgumentException If neither of $trueMutations or $falseMutations is set. If $predicateFilter is not instance of {@see Google\Cloud\Bigtable\Filter\FilterInterface}. If $trueMutations is set and is not instance of {@see Google\Cloud\Bigtable\Mutations}. If $falseMutations is set and is not instance of {@see Google\Cloud\Bigtable\Mutations}.
[ "Mutates", "the", "specified", "row", "atomically", "based", "on", "output", "of", "the", "filter", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Bigtable/src/Table.php#L469-L495
train
googleapis/google-cloud-php
Logging/src/V2/LogMetric.php
LogMetric.setLabelExtractors
public function setLabelExtractors($var) { $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); $this->label_extractors = $arr; return $this; }
php
public function setLabelExtractors($var) { $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); $this->label_extractors = $arr; return $this; }
[ "public", "function", "setLabelExtractors", "(", "$", "var", ")", "{", "$", "arr", "=", "GPBUtil", "::", "checkMapField", "(", "$", "var", ",", "\\", "Google", "\\", "Protobuf", "\\", "Internal", "\\", "GPBType", "::", "STRING", ",", "\\", "Google", "\\", "Protobuf", "\\", "Internal", "\\", "GPBType", "::", "STRING", ")", ";", "$", "this", "->", "label_extractors", "=", "$", "arr", ";", "return", "$", "this", ";", "}" ]
Optional. A map from a label key string to an extractor expression which is used to extract data from a log entry field and assign as the label value. Each label key specified in the LabelDescriptor must have an associated extractor expression in this map. The syntax of the extractor expression is the same as for the `value_extractor` field. The extracted value is converted to the type defined in the label descriptor. If the either the extraction or the type conversion fails, the label will have a default value. The default value for a string label is an empty string, for an integer label its 0, and for a boolean label its `false`. Note that there are upper bounds on the maximum number of labels and the number of active time series that are allowed in a project. Generated from protobuf field <code>map<string, string> label_extractors = 7;</code> @param array|\Google\Protobuf\Internal\MapField $var @return $this
[ "Optional", ".", "A", "map", "from", "a", "label", "key", "string", "to", "an", "extractor", "expression", "which", "is", "used", "to", "extract", "data", "from", "a", "log", "entry", "field", "and", "assign", "as", "the", "label", "value", ".", "Each", "label", "key", "specified", "in", "the", "LabelDescriptor", "must", "have", "an", "associated", "extractor", "expression", "in", "this", "map", ".", "The", "syntax", "of", "the", "extractor", "expression", "is", "the", "same", "as", "for", "the", "value_extractor", "field", ".", "The", "extracted", "value", "is", "converted", "to", "the", "type", "defined", "in", "the", "label", "descriptor", ".", "If", "the", "either", "the", "extraction", "or", "the", "type", "conversion", "fails", "the", "label", "will", "have", "a", "default", "value", ".", "The", "default", "value", "for", "a", "string", "label", "is", "an", "empty", "string", "for", "an", "integer", "label", "its", "0", "and", "for", "a", "boolean", "label", "its", "false", ".", "Note", "that", "there", "are", "upper", "bounds", "on", "the", "maximum", "number", "of", "labels", "and", "the", "number", "of", "active", "time", "series", "that", "are", "allowed", "in", "a", "project", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Logging/src/V2/LogMetric.php#L491-L497
train
googleapis/google-cloud-php
Logging/src/V2/LogMetric.php
LogMetric.setVersion
public function setVersion($var) { GPBUtil::checkEnum($var, \Google\Cloud\Logging\V2\LogMetric_ApiVersion::class); $this->version = $var; return $this; }
php
public function setVersion($var) { GPBUtil::checkEnum($var, \Google\Cloud\Logging\V2\LogMetric_ApiVersion::class); $this->version = $var; return $this; }
[ "public", "function", "setVersion", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkEnum", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Logging", "\\", "V2", "\\", "LogMetric_ApiVersion", "::", "class", ")", ";", "$", "this", "->", "version", "=", "$", "var", ";", "return", "$", "this", ";", "}" ]
Deprecated. The API version that created or updated this metric. The v2 format is used by default and cannot be changed. Generated from protobuf field <code>.google.logging.v2.LogMetric.ApiVersion version = 4 [deprecated = true];</code> @param int $var @return $this
[ "Deprecated", ".", "The", "API", "version", "that", "created", "or", "updated", "this", "metric", ".", "The", "v2", "format", "is", "used", "by", "default", "and", "cannot", "be", "changed", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Logging/src/V2/LogMetric.php#L549-L555
train
googleapis/google-cloud-php
Trace/src/V2/BatchWriteSpansRequest.php
BatchWriteSpansRequest.setSpans
public function setSpans($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Trace\V2\Span::class); $this->spans = $arr; return $this; }
php
public function setSpans($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Trace\V2\Span::class); $this->spans = $arr; return $this; }
[ "public", "function", "setSpans", "(", "$", "var", ")", "{", "$", "arr", "=", "GPBUtil", "::", "checkRepeatedField", "(", "$", "var", ",", "\\", "Google", "\\", "Protobuf", "\\", "Internal", "\\", "GPBType", "::", "MESSAGE", ",", "\\", "Google", "\\", "Cloud", "\\", "Trace", "\\", "V2", "\\", "Span", "::", "class", ")", ";", "$", "this", "->", "spans", "=", "$", "arr", ";", "return", "$", "this", ";", "}" ]
A list of new spans. The span names must not match existing spans, or the results are undefined. Generated from protobuf field <code>repeated .google.devtools.cloudtrace.v2.Span spans = 2;</code> @param \Google\Cloud\Trace\V2\Span[]|\Google\Protobuf\Internal\RepeatedField $var @return $this
[ "A", "list", "of", "new", "spans", ".", "The", "span", "names", "must", "not", "match", "existing", "spans", "or", "the", "results", "are", "undefined", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Trace/src/V2/BatchWriteSpansRequest.php#L100-L106
train
googleapis/google-cloud-php
Dlp/src/V2/DeidentifyConfig.php
DeidentifyConfig.setInfoTypeTransformations
public function setInfoTypeTransformations($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\InfoTypeTransformations::class); $this->writeOneof(1, $var); return $this; }
php
public function setInfoTypeTransformations($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\InfoTypeTransformations::class); $this->writeOneof(1, $var); return $this; }
[ "public", "function", "setInfoTypeTransformations", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Dlp", "\\", "V2", "\\", "InfoTypeTransformations", "::", "class", ")", ";", "$", "this", "->", "writeOneof", "(", "1", ",", "$", "var", ")", ";", "return", "$", "this", ";", "}" ]
Treat the dataset as free-form text and apply the same free text transformation everywhere. Generated from protobuf field <code>.google.privacy.dlp.v2.InfoTypeTransformations info_type_transformations = 1;</code> @param \Google\Cloud\Dlp\V2\InfoTypeTransformations $var @return $this
[ "Treat", "the", "dataset", "as", "free", "-", "form", "text", "and", "apply", "the", "same", "free", "text", "transformation", "everywhere", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/DeidentifyConfig.php#L60-L66
train
googleapis/google-cloud-php
Dlp/src/V2/DeidentifyConfig.php
DeidentifyConfig.setRecordTransformations
public function setRecordTransformations($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\RecordTransformations::class); $this->writeOneof(2, $var); return $this; }
php
public function setRecordTransformations($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\RecordTransformations::class); $this->writeOneof(2, $var); return $this; }
[ "public", "function", "setRecordTransformations", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Dlp", "\\", "V2", "\\", "RecordTransformations", "::", "class", ")", ";", "$", "this", "->", "writeOneof", "(", "2", ",", "$", "var", ")", ";", "return", "$", "this", ";", "}" ]
Treat the dataset as structured. Transformations can be applied to specific locations within structured datasets, such as transforming a column within a table. Generated from protobuf field <code>.google.privacy.dlp.v2.RecordTransformations record_transformations = 2;</code> @param \Google\Cloud\Dlp\V2\RecordTransformations $var @return $this
[ "Treat", "the", "dataset", "as", "structured", ".", "Transformations", "can", "be", "applied", "to", "specific", "locations", "within", "structured", "datasets", "such", "as", "transforming", "a", "column", "within", "a", "table", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/DeidentifyConfig.php#L90-L96
train
googleapis/google-cloud-php
Tasks/src/V2beta2/Task.php
Task.setStatus
public function setStatus($var) { GPBUtil::checkMessage($var, \Google\Cloud\Tasks\V2beta2\TaskStatus::class); $this->status = $var; return $this; }
php
public function setStatus($var) { GPBUtil::checkMessage($var, \Google\Cloud\Tasks\V2beta2\TaskStatus::class); $this->status = $var; return $this; }
[ "public", "function", "setStatus", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Tasks", "\\", "V2beta2", "\\", "TaskStatus", "::", "class", ")", ";", "$", "this", "->", "status", "=", "$", "var", ";", "return", "$", "this", ";", "}" ]
Output only. The task status. Generated from protobuf field <code>.google.cloud.tasks.v2beta2.TaskStatus status = 7;</code> @param \Google\Cloud\Tasks\V2beta2\TaskStatus $var @return $this
[ "Output", "only", ".", "The", "task", "status", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Tasks/src/V2beta2/Task.php#L360-L366
train
googleapis/google-cloud-php
Dlp/src/V2/ByteContentItem.php
ByteContentItem.setType
public function setType($var) { GPBUtil::checkEnum($var, \Google\Cloud\Dlp\V2\ByteContentItem_BytesType::class); $this->type = $var; return $this; }
php
public function setType($var) { GPBUtil::checkEnum($var, \Google\Cloud\Dlp\V2\ByteContentItem_BytesType::class); $this->type = $var; return $this; }
[ "public", "function", "setType", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkEnum", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Dlp", "\\", "V2", "\\", "ByteContentItem_BytesType", "::", "class", ")", ";", "$", "this", "->", "type", "=", "$", "var", ";", "return", "$", "this", ";", "}" ]
The type of data stored in the bytes string. Default will be TEXT_UTF8. Generated from protobuf field <code>.google.privacy.dlp.v2.ByteContentItem.BytesType type = 1;</code> @param int $var @return $this
[ "The", "type", "of", "data", "stored", "in", "the", "bytes", "string", ".", "Default", "will", "be", "TEXT_UTF8", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Dlp/src/V2/ByteContentItem.php#L66-L72
train
googleapis/google-cloud-php
Scheduler/src/V1beta1/Gapic/CloudSchedulerGapicClient.php
CloudSchedulerGapicClient.jobName
public static function jobName($project, $location, $job) { return self::getJobNameTemplate()->render([ 'project' => $project, 'location' => $location, 'job' => $job, ]); }
php
public static function jobName($project, $location, $job) { return self::getJobNameTemplate()->render([ 'project' => $project, 'location' => $location, 'job' => $job, ]); }
[ "public", "static", "function", "jobName", "(", "$", "project", ",", "$", "location", ",", "$", "job", ")", "{", "return", "self", "::", "getJobNameTemplate", "(", ")", "->", "render", "(", "[", "'project'", "=>", "$", "project", ",", "'location'", "=>", "$", "location", ",", "'job'", "=>", "$", "job", ",", "]", ")", ";", "}" ]
Formats a string containing the fully-qualified path to represent a job resource. @param string $project @param string $location @param string $job @return string The formatted job resource. @experimental
[ "Formats", "a", "string", "containing", "the", "fully", "-", "qualified", "path", "to", "represent", "a", "job", "resource", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Scheduler/src/V1beta1/Gapic/CloudSchedulerGapicClient.php#L229-L236
train
googleapis/google-cloud-php
Scheduler/src/V1beta1/Gapic/CloudSchedulerGapicClient.php
CloudSchedulerGapicClient.deleteJob
public function deleteJob($name, array $optionalArgs = []) { $request = new DeleteJobRequest(); $request->setName($name); $requestParams = new RequestParamsHeaderDescriptor([ 'name' => $request->getName(), ]); $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); return $this->startCall( 'DeleteJob', GPBEmpty::class, $optionalArgs, $request )->wait(); }
php
public function deleteJob($name, array $optionalArgs = []) { $request = new DeleteJobRequest(); $request->setName($name); $requestParams = new RequestParamsHeaderDescriptor([ 'name' => $request->getName(), ]); $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); return $this->startCall( 'DeleteJob', GPBEmpty::class, $optionalArgs, $request )->wait(); }
[ "public", "function", "deleteJob", "(", "$", "name", ",", "array", "$", "optionalArgs", "=", "[", "]", ")", "{", "$", "request", "=", "new", "DeleteJobRequest", "(", ")", ";", "$", "request", "->", "setName", "(", "$", "name", ")", ";", "$", "requestParams", "=", "new", "RequestParamsHeaderDescriptor", "(", "[", "'name'", "=>", "$", "request", "->", "getName", "(", ")", ",", "]", ")", ";", "$", "optionalArgs", "[", "'headers'", "]", "=", "isset", "(", "$", "optionalArgs", "[", "'headers'", "]", ")", "?", "array_merge", "(", "$", "requestParams", "->", "getHeader", "(", ")", ",", "$", "optionalArgs", "[", "'headers'", "]", ")", ":", "$", "requestParams", "->", "getHeader", "(", ")", ";", "return", "$", "this", "->", "startCall", "(", "'DeleteJob'", ",", "GPBEmpty", "::", "class", ",", "$", "optionalArgs", ",", "$", "request", ")", "->", "wait", "(", ")", ";", "}" ]
Deletes a job. Sample code: ``` $cloudSchedulerClient = new CloudSchedulerClient(); try { $formattedName = $cloudSchedulerClient->jobName('[PROJECT]', '[LOCATION]', '[JOB]'); $cloudSchedulerClient->deleteJob($formattedName); } finally { $cloudSchedulerClient->close(); } ``` @param string $name Required. The job name. For example: `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. @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. } @throws ApiException if the remote call fails @experimental
[ "Deletes", "a", "job", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Scheduler/src/V1beta1/Gapic/CloudSchedulerGapicClient.php#L636-L654
train
googleapis/google-cloud-php
CommonProtos/src/DevTools/Source/V1/RepoId.php
RepoId.setProjectRepoId
public function setProjectRepoId($var) { GPBUtil::checkMessage($var, \Google\Cloud\DevTools\Source\V1\ProjectRepoId::class); $this->writeOneof(1, $var); return $this; }
php
public function setProjectRepoId($var) { GPBUtil::checkMessage($var, \Google\Cloud\DevTools\Source\V1\ProjectRepoId::class); $this->writeOneof(1, $var); return $this; }
[ "public", "function", "setProjectRepoId", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "DevTools", "\\", "Source", "\\", "V1", "\\", "ProjectRepoId", "::", "class", ")", ";", "$", "this", "->", "writeOneof", "(", "1", ",", "$", "var", ")", ";", "return", "$", "this", ";", "}" ]
A combination of a project ID and a repo name. Generated from protobuf field <code>.google.devtools.source.v1.ProjectRepoId project_repo_id = 1;</code> @param \Google\Cloud\DevTools\Source\V1\ProjectRepoId $var @return $this
[ "A", "combination", "of", "a", "project", "ID", "and", "a", "repo", "name", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/CommonProtos/src/DevTools/Source/V1/RepoId.php#L55-L61
train
googleapis/google-cloud-php
Container/src/V1/Operation.php
Operation.setOperationType
public function setOperationType($var) { GPBUtil::checkEnum($var, \Google\Cloud\Container\V1\Operation_Type::class); $this->operation_type = $var; return $this; }
php
public function setOperationType($var) { GPBUtil::checkEnum($var, \Google\Cloud\Container\V1\Operation_Type::class); $this->operation_type = $var; return $this; }
[ "public", "function", "setOperationType", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkEnum", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Container", "\\", "V1", "\\", "Operation_Type", "::", "class", ")", ";", "$", "this", "->", "operation_type", "=", "$", "var", ";", "return", "$", "this", ";", "}" ]
The operation type. Generated from protobuf field <code>.google.container.v1.Operation.Type operation_type = 3;</code> @param int $var @return $this
[ "The", "operation", "type", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Container/src/V1/Operation.php#L213-L219
train
googleapis/google-cloud-php
Logging/src/V2/LogEntry.php
LogEntry.setSeverity
public function setSeverity($var) { GPBUtil::checkEnum($var, \Google\Cloud\Logging\Type\LogSeverity::class); $this->severity = $var; return $this; }
php
public function setSeverity($var) { GPBUtil::checkEnum($var, \Google\Cloud\Logging\Type\LogSeverity::class); $this->severity = $var; return $this; }
[ "public", "function", "setSeverity", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkEnum", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Logging", "\\", "Type", "\\", "LogSeverity", "::", "class", ")", ";", "$", "this", "->", "severity", "=", "$", "var", ";", "return", "$", "this", ";", "}" ]
Optional. The severity of the log entry. The default value is `LogSeverity.DEFAULT`. Generated from protobuf field <code>.google.logging.type.LogSeverity severity = 10;</code> @param int $var @return $this
[ "Optional", ".", "The", "severity", "of", "the", "log", "entry", ".", "The", "default", "value", "is", "LogSeverity", ".", "DEFAULT", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Logging/src/V2/LogEntry.php#L532-L538
train
googleapis/google-cloud-php
Logging/src/V2/LogEntry.php
LogEntry.setHttpRequest
public function setHttpRequest($var) { GPBUtil::checkMessage($var, \Google\Cloud\Logging\Type\HttpRequest::class); $this->http_request = $var; return $this; }
php
public function setHttpRequest($var) { GPBUtil::checkMessage($var, \Google\Cloud\Logging\Type\HttpRequest::class); $this->http_request = $var; return $this; }
[ "public", "function", "setHttpRequest", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Logging", "\\", "Type", "\\", "HttpRequest", "::", "class", ")", ";", "$", "this", "->", "http_request", "=", "$", "var", ";", "return", "$", "this", ";", "}" ]
Optional. Information about the HTTP request associated with this log entry, if applicable. Generated from protobuf field <code>.google.logging.type.HttpRequest http_request = 7;</code> @param \Google\Cloud\Logging\Type\HttpRequest $var @return $this
[ "Optional", ".", "Information", "about", "the", "HTTP", "request", "associated", "with", "this", "log", "entry", "if", "applicable", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Logging/src/V2/LogEntry.php#L596-L602
train
googleapis/google-cloud-php
Logging/src/V2/LogEntry.php
LogEntry.setOperation
public function setOperation($var) { GPBUtil::checkMessage($var, \Google\Cloud\Logging\V2\LogEntryOperation::class); $this->operation = $var; return $this; }
php
public function setOperation($var) { GPBUtil::checkMessage($var, \Google\Cloud\Logging\V2\LogEntryOperation::class); $this->operation = $var; return $this; }
[ "public", "function", "setOperation", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Logging", "\\", "V2", "\\", "LogEntryOperation", "::", "class", ")", ";", "$", "this", "->", "operation", "=", "$", "var", ";", "return", "$", "this", ";", "}" ]
Optional. Information about an operation associated with the log entry, if applicable. Generated from protobuf field <code>.google.logging.v2.LogEntryOperation operation = 15;</code> @param \Google\Cloud\Logging\V2\LogEntryOperation $var @return $this
[ "Optional", ".", "Information", "about", "an", "operation", "associated", "with", "the", "log", "entry", "if", "applicable", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Logging/src/V2/LogEntry.php#L682-L688
train
googleapis/google-cloud-php
Logging/src/V2/LogEntry.php
LogEntry.setSourceLocation
public function setSourceLocation($var) { GPBUtil::checkMessage($var, \Google\Cloud\Logging\V2\LogEntrySourceLocation::class); $this->source_location = $var; return $this; }
php
public function setSourceLocation($var) { GPBUtil::checkMessage($var, \Google\Cloud\Logging\V2\LogEntrySourceLocation::class); $this->source_location = $var; return $this; }
[ "public", "function", "setSourceLocation", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Logging", "\\", "V2", "\\", "LogEntrySourceLocation", "::", "class", ")", ";", "$", "this", "->", "source_location", "=", "$", "var", ";", "return", "$", "this", ";", "}" ]
Optional. Source code location information associated with the log entry, if any. Generated from protobuf field <code>.google.logging.v2.LogEntrySourceLocation source_location = 23;</code> @param \Google\Cloud\Logging\V2\LogEntrySourceLocation $var @return $this
[ "Optional", ".", "Source", "code", "location", "information", "associated", "with", "the", "log", "entry", "if", "any", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Logging/src/V2/LogEntry.php#L810-L816
train
googleapis/google-cloud-php
Iot/src/V1/ListDevicesRequest.php
ListDevicesRequest.setGatewayListOptions
public function setGatewayListOptions($var) { GPBUtil::checkMessage($var, \Google\Cloud\Iot\V1\GatewayListOptions::class); $this->gateway_list_options = $var; return $this; }
php
public function setGatewayListOptions($var) { GPBUtil::checkMessage($var, \Google\Cloud\Iot\V1\GatewayListOptions::class); $this->gateway_list_options = $var; return $this; }
[ "public", "function", "setGatewayListOptions", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Iot", "\\", "V1", "\\", "GatewayListOptions", "::", "class", ")", ";", "$", "this", "->", "gateway_list_options", "=", "$", "var", ";", "return", "$", "this", ";", "}" ]
Options related to gateways. Generated from protobuf field <code>.google.cloud.iot.v1.GatewayListOptions gateway_list_options = 6;</code> @param \Google\Cloud\Iot\V1\GatewayListOptions $var @return $this
[ "Options", "related", "to", "gateways", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Iot/src/V1/ListDevicesRequest.php#L240-L246
train
googleapis/google-cloud-php
BigQueryDataTransfer/src/V1/UpdateTransferConfigRequest.php
UpdateTransferConfigRequest.setTransferConfig
public function setTransferConfig($var) { GPBUtil::checkMessage($var, \Google\Cloud\BigQuery\DataTransfer\V1\TransferConfig::class); $this->transfer_config = $var; return $this; }
php
public function setTransferConfig($var) { GPBUtil::checkMessage($var, \Google\Cloud\BigQuery\DataTransfer\V1\TransferConfig::class); $this->transfer_config = $var; return $this; }
[ "public", "function", "setTransferConfig", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "BigQuery", "\\", "DataTransfer", "\\", "V1", "\\", "TransferConfig", "::", "class", ")", ";", "$", "this", "->", "transfer_config", "=", "$", "var", ";", "return", "$", "this", ";", "}" ]
Data transfer configuration to create. Generated from protobuf field <code>.google.cloud.bigquery.datatransfer.v1.TransferConfig transfer_config = 1;</code> @param \Google\Cloud\BigQuery\DataTransfer\V1\TransferConfig $var @return $this
[ "Data", "transfer", "configuration", "to", "create", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/BigQueryDataTransfer/src/V1/UpdateTransferConfigRequest.php#L103-L109
train
googleapis/google-cloud-php
Firestore/src/Admin/V1/ListIndexesResponse.php
ListIndexesResponse.setIndexes
public function setIndexes($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Firestore\Admin\V1\Index::class); $this->indexes = $arr; return $this; }
php
public function setIndexes($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Firestore\Admin\V1\Index::class); $this->indexes = $arr; return $this; }
[ "public", "function", "setIndexes", "(", "$", "var", ")", "{", "$", "arr", "=", "GPBUtil", "::", "checkRepeatedField", "(", "$", "var", ",", "\\", "Google", "\\", "Protobuf", "\\", "Internal", "\\", "GPBType", "::", "MESSAGE", ",", "\\", "Google", "\\", "Cloud", "\\", "Firestore", "\\", "Admin", "\\", "V1", "\\", "Index", "::", "class", ")", ";", "$", "this", "->", "indexes", "=", "$", "arr", ";", "return", "$", "this", ";", "}" ]
The requested indexes. Generated from protobuf field <code>repeated .google.firestore.admin.v1.Index indexes = 1;</code> @param \Google\Cloud\Firestore\Admin\V1\Index[]|\Google\Protobuf\Internal\RepeatedField $var @return $this
[ "The", "requested", "indexes", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Firestore/src/Admin/V1/ListIndexesResponse.php#L68-L74
train
googleapis/google-cloud-php
Core/src/Lock/LockTrait.php
LockTrait.synchronize
public function synchronize(callable $func, array $options = []) { $result = null; $exception = null; if ($this->acquire($options)) { try { $result = $func(); } catch (\Exception $ex) { $exception = $ex; } $this->release(); } if ($exception) { throw $exception; } return $result; }
php
public function synchronize(callable $func, array $options = []) { $result = null; $exception = null; if ($this->acquire($options)) { try { $result = $func(); } catch (\Exception $ex) { $exception = $ex; } $this->release(); } if ($exception) { throw $exception; } return $result; }
[ "public", "function", "synchronize", "(", "callable", "$", "func", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "result", "=", "null", ";", "$", "exception", "=", "null", ";", "if", "(", "$", "this", "->", "acquire", "(", "$", "options", ")", ")", "{", "try", "{", "$", "result", "=", "$", "func", "(", ")", ";", "}", "catch", "(", "\\", "Exception", "$", "ex", ")", "{", "$", "exception", "=", "$", "ex", ";", "}", "$", "this", "->", "release", "(", ")", ";", "}", "if", "(", "$", "exception", ")", "{", "throw", "$", "exception", ";", "}", "return", "$", "result", ";", "}" ]
Execute a callable within a lock. If an exception is caught during execution of the callable the lock will first be released before throwing it. @param callable $func The callable to execute. @param array $options [optional] { Configuration options. @type bool $blocking Whether the process should block while waiting to acquire the lock. **Defaults to** true. } @return mixed
[ "Execute", "a", "callable", "within", "a", "lock", ".", "If", "an", "exception", "is", "caught", "during", "execution", "of", "the", "callable", "the", "lock", "will", "first", "be", "released", "before", "throwing", "it", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Core/src/Lock/LockTrait.php#L60-L79
train
googleapis/google-cloud-php
Bigtable/src/Admin/V2/ModifyColumnFamiliesRequest/Modification.php
Modification.setCreate
public function setCreate($var) { GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\Admin\V2\ColumnFamily::class); $this->writeOneof(2, $var); return $this; }
php
public function setCreate($var) { GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\Admin\V2\ColumnFamily::class); $this->writeOneof(2, $var); return $this; }
[ "public", "function", "setCreate", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Bigtable", "\\", "Admin", "\\", "V2", "\\", "ColumnFamily", "::", "class", ")", ";", "$", "this", "->", "writeOneof", "(", "2", ",", "$", "var", ")", ";", "return", "$", "this", ";", "}" ]
Create a new column family with the specified schema, or fail if one already exists with the given ID. Generated from protobuf field <code>.google.bigtable.admin.v2.ColumnFamily create = 2;</code> @param \Google\Cloud\Bigtable\Admin\V2\ColumnFamily $var @return $this
[ "Create", "a", "new", "column", "family", "with", "the", "specified", "schema", "or", "fail", "if", "one", "already", "exists", "with", "the", "given", "ID", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Bigtable/src/Admin/V2/ModifyColumnFamiliesRequest/Modification.php#L96-L102
train
googleapis/google-cloud-php
Monitoring/src/V3/NotificationChannelDescriptor.php
NotificationChannelDescriptor.setLabels
public function setLabels($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\LabelDescriptor::class); $this->labels = $arr; return $this; }
php
public function setLabels($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\LabelDescriptor::class); $this->labels = $arr; return $this; }
[ "public", "function", "setLabels", "(", "$", "var", ")", "{", "$", "arr", "=", "GPBUtil", "::", "checkRepeatedField", "(", "$", "var", ",", "\\", "Google", "\\", "Protobuf", "\\", "Internal", "\\", "GPBType", "::", "MESSAGE", ",", "\\", "Google", "\\", "Api", "\\", "LabelDescriptor", "::", "class", ")", ";", "$", "this", "->", "labels", "=", "$", "arr", ";", "return", "$", "this", ";", "}" ]
The set of labels that must be defined to identify a particular channel of the corresponding type. Each label includes a description for how that field should be populated. Generated from protobuf field <code>repeated .google.api.LabelDescriptor labels = 4;</code> @param \Google\Api\LabelDescriptor[]|\Google\Protobuf\Internal\RepeatedField $var @return $this
[ "The", "set", "of", "labels", "that", "must", "be", "defined", "to", "identify", "a", "particular", "channel", "of", "the", "corresponding", "type", ".", "Each", "label", "includes", "a", "description", "for", "how", "that", "field", "should", "be", "populated", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Monitoring/src/V3/NotificationChannelDescriptor.php#L238-L244
train
googleapis/google-cloud-php
Monitoring/src/V3/NotificationChannelDescriptor.php
NotificationChannelDescriptor.setSupportedTiers
public function setSupportedTiers($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\Monitoring\V3\ServiceTier::class); $this->supported_tiers = $arr; return $this; }
php
public function setSupportedTiers($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\Monitoring\V3\ServiceTier::class); $this->supported_tiers = $arr; return $this; }
[ "public", "function", "setSupportedTiers", "(", "$", "var", ")", "{", "$", "arr", "=", "GPBUtil", "::", "checkRepeatedField", "(", "$", "var", ",", "\\", "Google", "\\", "Protobuf", "\\", "Internal", "\\", "GPBType", "::", "ENUM", ",", "\\", "Google", "\\", "Cloud", "\\", "Monitoring", "\\", "V3", "\\", "ServiceTier", "::", "class", ")", ";", "$", "this", "->", "supported_tiers", "=", "$", "arr", ";", "return", "$", "this", ";", "}" ]
The tiers that support this notification channel; the project service tier must be one of the supported_tiers. Generated from protobuf field <code>repeated .google.monitoring.v3.ServiceTier supported_tiers = 5 [deprecated = true];</code> @param int[]|\Google\Protobuf\Internal\RepeatedField $var @return $this
[ "The", "tiers", "that", "support", "this", "notification", "channel", ";", "the", "project", "service", "tier", "must", "be", "one", "of", "the", "supported_tiers", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Monitoring/src/V3/NotificationChannelDescriptor.php#L266-L272
train
googleapis/google-cloud-php
Container/src/V1/Gapic/ClusterManagerGapicClient.php
ClusterManagerGapicClient.listClusters
public function listClusters($projectId, $zone, array $optionalArgs = []) { $request = new ListClustersRequest(); $request->setProjectId($projectId); $request->setZone($zone); if (isset($optionalArgs['parent'])) { $request->setParent($optionalArgs['parent']); } $requestParams = new RequestParamsHeaderDescriptor([ 'parent' => $request->getParent(), ]); $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); return $this->startCall( 'ListClusters', ListClustersResponse::class, $optionalArgs, $request )->wait(); }
php
public function listClusters($projectId, $zone, array $optionalArgs = []) { $request = new ListClustersRequest(); $request->setProjectId($projectId); $request->setZone($zone); if (isset($optionalArgs['parent'])) { $request->setParent($optionalArgs['parent']); } $requestParams = new RequestParamsHeaderDescriptor([ 'parent' => $request->getParent(), ]); $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); return $this->startCall( 'ListClusters', ListClustersResponse::class, $optionalArgs, $request )->wait(); }
[ "public", "function", "listClusters", "(", "$", "projectId", ",", "$", "zone", ",", "array", "$", "optionalArgs", "=", "[", "]", ")", "{", "$", "request", "=", "new", "ListClustersRequest", "(", ")", ";", "$", "request", "->", "setProjectId", "(", "$", "projectId", ")", ";", "$", "request", "->", "setZone", "(", "$", "zone", ")", ";", "if", "(", "isset", "(", "$", "optionalArgs", "[", "'parent'", "]", ")", ")", "{", "$", "request", "->", "setParent", "(", "$", "optionalArgs", "[", "'parent'", "]", ")", ";", "}", "$", "requestParams", "=", "new", "RequestParamsHeaderDescriptor", "(", "[", "'parent'", "=>", "$", "request", "->", "getParent", "(", ")", ",", "]", ")", ";", "$", "optionalArgs", "[", "'headers'", "]", "=", "isset", "(", "$", "optionalArgs", "[", "'headers'", "]", ")", "?", "array_merge", "(", "$", "requestParams", "->", "getHeader", "(", ")", ",", "$", "optionalArgs", "[", "'headers'", "]", ")", ":", "$", "requestParams", "->", "getHeader", "(", ")", ";", "return", "$", "this", "->", "startCall", "(", "'ListClusters'", ",", "ListClustersResponse", "::", "class", ",", "$", "optionalArgs", ",", "$", "request", ")", "->", "wait", "(", ")", ";", "}" ]
Lists all clusters owned by a project in either the specified zone or all zones. Sample code: ``` $clusterManagerClient = new ClusterManagerClient(); try { $projectId = ''; $zone = ''; $response = $clusterManagerClient->listClusters($projectId, $zone); } finally { $clusterManagerClient->close(); } ``` @param string $projectId Deprecated. The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840). This field has been deprecated and replaced by the parent field. @param string $zone Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides, or "-" for all zones. This field has been deprecated and replaced by the parent field. @param array $optionalArgs { Optional. @type string $parent The parent (project and location) where the clusters will be listed. Specified in the format 'projects/&#42;/locations/*'. Location "-" matches all zones and all regions. @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\Container\V1\ListClustersResponse @throws ApiException if the remote call fails @experimental
[ "Lists", "all", "clusters", "owned", "by", "a", "project", "in", "either", "the", "specified", "zone", "or", "all", "zones", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Container/src/V1/Gapic/ClusterManagerGapicClient.php#L253-L275
train
googleapis/google-cloud-php
Container/src/V1/Gapic/ClusterManagerGapicClient.php
ClusterManagerGapicClient.getCluster
public function getCluster($projectId, $zone, $clusterId, array $optionalArgs = []) { $request = new GetClusterRequest(); $request->setProjectId($projectId); $request->setZone($zone); $request->setClusterId($clusterId); if (isset($optionalArgs['name'])) { $request->setName($optionalArgs['name']); } $requestParams = new RequestParamsHeaderDescriptor([ 'name' => $request->getName(), ]); $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); return $this->startCall( 'GetCluster', Cluster::class, $optionalArgs, $request )->wait(); }
php
public function getCluster($projectId, $zone, $clusterId, array $optionalArgs = []) { $request = new GetClusterRequest(); $request->setProjectId($projectId); $request->setZone($zone); $request->setClusterId($clusterId); if (isset($optionalArgs['name'])) { $request->setName($optionalArgs['name']); } $requestParams = new RequestParamsHeaderDescriptor([ 'name' => $request->getName(), ]); $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); return $this->startCall( 'GetCluster', Cluster::class, $optionalArgs, $request )->wait(); }
[ "public", "function", "getCluster", "(", "$", "projectId", ",", "$", "zone", ",", "$", "clusterId", ",", "array", "$", "optionalArgs", "=", "[", "]", ")", "{", "$", "request", "=", "new", "GetClusterRequest", "(", ")", ";", "$", "request", "->", "setProjectId", "(", "$", "projectId", ")", ";", "$", "request", "->", "setZone", "(", "$", "zone", ")", ";", "$", "request", "->", "setClusterId", "(", "$", "clusterId", ")", ";", "if", "(", "isset", "(", "$", "optionalArgs", "[", "'name'", "]", ")", ")", "{", "$", "request", "->", "setName", "(", "$", "optionalArgs", "[", "'name'", "]", ")", ";", "}", "$", "requestParams", "=", "new", "RequestParamsHeaderDescriptor", "(", "[", "'name'", "=>", "$", "request", "->", "getName", "(", ")", ",", "]", ")", ";", "$", "optionalArgs", "[", "'headers'", "]", "=", "isset", "(", "$", "optionalArgs", "[", "'headers'", "]", ")", "?", "array_merge", "(", "$", "requestParams", "->", "getHeader", "(", ")", ",", "$", "optionalArgs", "[", "'headers'", "]", ")", ":", "$", "requestParams", "->", "getHeader", "(", ")", ";", "return", "$", "this", "->", "startCall", "(", "'GetCluster'", ",", "Cluster", "::", "class", ",", "$", "optionalArgs", ",", "$", "request", ")", "->", "wait", "(", ")", ";", "}" ]
Gets the details of a specific cluster. Sample code: ``` $clusterManagerClient = new ClusterManagerClient(); try { $projectId = ''; $zone = ''; $clusterId = ''; $response = $clusterManagerClient->getCluster($projectId, $zone, $clusterId); } finally { $clusterManagerClient->close(); } ``` @param string $projectId Deprecated. The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840). This field has been deprecated and replaced by the name field. @param string $zone Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field. @param string $clusterId Deprecated. The name of the cluster to retrieve. This field has been deprecated and replaced by the name field. @param array $optionalArgs { Optional. @type string $name The name (project, location, cluster) of the cluster to retrieve. Specified in the format 'projects/&#42;/locations/&#42;/clusters/*'. @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\Container\V1\Cluster @throws ApiException if the remote call fails @experimental
[ "Gets", "the", "details", "of", "a", "specific", "cluster", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Container/src/V1/Gapic/ClusterManagerGapicClient.php#L320-L343
train
googleapis/google-cloud-php
Debugger/src/V2/ListBreakpointsRequest.php
ListBreakpointsRequest.setAction
public function setAction($var) { GPBUtil::checkMessage($var, \Google\Cloud\Debugger\V2\ListBreakpointsRequest_BreakpointActionValue::class); $this->action = $var; return $this; }
php
public function setAction($var) { GPBUtil::checkMessage($var, \Google\Cloud\Debugger\V2\ListBreakpointsRequest_BreakpointActionValue::class); $this->action = $var; return $this; }
[ "public", "function", "setAction", "(", "$", "var", ")", "{", "GPBUtil", "::", "checkMessage", "(", "$", "var", ",", "\\", "Google", "\\", "Cloud", "\\", "Debugger", "\\", "V2", "\\", "ListBreakpointsRequest_BreakpointActionValue", "::", "class", ")", ";", "$", "this", "->", "action", "=", "$", "var", ";", "return", "$", "this", ";", "}" ]
When set, the response includes only breakpoints with the specified action. Generated from protobuf field <code>.google.devtools.clouddebugger.v2.ListBreakpointsRequest.BreakpointActionValue action = 4;</code> @param \Google\Cloud\Debugger\V2\ListBreakpointsRequest\BreakpointActionValue $var @return $this
[ "When", "set", "the", "response", "includes", "only", "breakpoints", "with", "the", "specified", "action", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Debugger/src/V2/ListBreakpointsRequest.php#L204-L210
train
googleapis/google-cloud-php
Vision/src/V1/AsyncBatchAnnotateFilesResponse.php
AsyncBatchAnnotateFilesResponse.setResponses
public function setResponses($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\AsyncAnnotateFileResponse::class); $this->responses = $arr; return $this; }
php
public function setResponses($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\AsyncAnnotateFileResponse::class); $this->responses = $arr; return $this; }
[ "public", "function", "setResponses", "(", "$", "var", ")", "{", "$", "arr", "=", "GPBUtil", "::", "checkRepeatedField", "(", "$", "var", ",", "\\", "Google", "\\", "Protobuf", "\\", "Internal", "\\", "GPBType", "::", "MESSAGE", ",", "\\", "Google", "\\", "Cloud", "\\", "Vision", "\\", "V1", "\\", "AsyncAnnotateFileResponse", "::", "class", ")", ";", "$", "this", "->", "responses", "=", "$", "arr", ";", "return", "$", "this", ";", "}" ]
The list of file annotation responses, one for each request in AsyncBatchAnnotateFilesRequest. Generated from protobuf field <code>repeated .google.cloud.vision.v1.AsyncAnnotateFileResponse responses = 1;</code> @param \Google\Cloud\Vision\V1\AsyncAnnotateFileResponse[]|\Google\Protobuf\Internal\RepeatedField $var @return $this
[ "The", "list", "of", "file", "annotation", "responses", "one", "for", "each", "request", "in", "AsyncBatchAnnotateFilesRequest", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Vision/src/V1/AsyncBatchAnnotateFilesResponse.php#L62-L68
train
googleapis/google-cloud-php
VideoIntelligence/src/V1/AnnotateVideoRequest.php
AnnotateVideoRequest.setFeatures
public function setFeatures($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\VideoIntelligence\V1\Feature::class); $this->features = $arr; return $this; }
php
public function setFeatures($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\VideoIntelligence\V1\Feature::class); $this->features = $arr; return $this; }
[ "public", "function", "setFeatures", "(", "$", "var", ")", "{", "$", "arr", "=", "GPBUtil", "::", "checkRepeatedField", "(", "$", "var", ",", "\\", "Google", "\\", "Protobuf", "\\", "Internal", "\\", "GPBType", "::", "ENUM", ",", "\\", "Google", "\\", "Cloud", "\\", "VideoIntelligence", "\\", "V1", "\\", "Feature", "::", "class", ")", ";", "$", "this", "->", "features", "=", "$", "arr", ";", "return", "$", "this", ";", "}" ]
Requested video annotation features. Generated from protobuf field <code>repeated .google.cloud.videointelligence.v1.Feature features = 2;</code> @param int[]|\Google\Protobuf\Internal\RepeatedField $var @return $this
[ "Requested", "video", "annotation", "features", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/VideoIntelligence/src/V1/AnnotateVideoRequest.php#L208-L214
train
googleapis/google-cloud-php
Core/src/RequestWrapperTrait.php
RequestWrapperTrait.setCommonDefaults
public function setCommonDefaults(array $config) { $config += [ 'authCache' => new MemoryCacheItemPool(), 'authCacheOptions' => [], 'credentialsFetcher' => null, 'keyFile' => null, 'requestTimeout' => null, 'retries' => 3, 'scopes' => null ]; if ($config['credentialsFetcher'] && !$config['credentialsFetcher'] instanceof FetchAuthTokenInterface) { throw new \InvalidArgumentException('credentialsFetcher must implement FetchAuthTokenInterface.'); } if (!$config['authCache'] instanceof CacheItemPoolInterface) { throw new \InvalidArgumentException('authCache must implement CacheItemPoolInterface.'); } $this->authCache = $config['authCache']; $this->authCacheOptions = $config['authCacheOptions']; $this->credentialsFetcher = $config['credentialsFetcher']; $this->retries = $config['retries']; $this->scopes = $config['scopes']; $this->keyFile = $config['keyFile']; $this->requestTimeout = $config['requestTimeout']; }
php
public function setCommonDefaults(array $config) { $config += [ 'authCache' => new MemoryCacheItemPool(), 'authCacheOptions' => [], 'credentialsFetcher' => null, 'keyFile' => null, 'requestTimeout' => null, 'retries' => 3, 'scopes' => null ]; if ($config['credentialsFetcher'] && !$config['credentialsFetcher'] instanceof FetchAuthTokenInterface) { throw new \InvalidArgumentException('credentialsFetcher must implement FetchAuthTokenInterface.'); } if (!$config['authCache'] instanceof CacheItemPoolInterface) { throw new \InvalidArgumentException('authCache must implement CacheItemPoolInterface.'); } $this->authCache = $config['authCache']; $this->authCacheOptions = $config['authCacheOptions']; $this->credentialsFetcher = $config['credentialsFetcher']; $this->retries = $config['retries']; $this->scopes = $config['scopes']; $this->keyFile = $config['keyFile']; $this->requestTimeout = $config['requestTimeout']; }
[ "public", "function", "setCommonDefaults", "(", "array", "$", "config", ")", "{", "$", "config", "+=", "[", "'authCache'", "=>", "new", "MemoryCacheItemPool", "(", ")", ",", "'authCacheOptions'", "=>", "[", "]", ",", "'credentialsFetcher'", "=>", "null", ",", "'keyFile'", "=>", "null", ",", "'requestTimeout'", "=>", "null", ",", "'retries'", "=>", "3", ",", "'scopes'", "=>", "null", "]", ";", "if", "(", "$", "config", "[", "'credentialsFetcher'", "]", "&&", "!", "$", "config", "[", "'credentialsFetcher'", "]", "instanceof", "FetchAuthTokenInterface", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'credentialsFetcher must implement FetchAuthTokenInterface.'", ")", ";", "}", "if", "(", "!", "$", "config", "[", "'authCache'", "]", "instanceof", "CacheItemPoolInterface", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'authCache must implement CacheItemPoolInterface.'", ")", ";", "}", "$", "this", "->", "authCache", "=", "$", "config", "[", "'authCache'", "]", ";", "$", "this", "->", "authCacheOptions", "=", "$", "config", "[", "'authCacheOptions'", "]", ";", "$", "this", "->", "credentialsFetcher", "=", "$", "config", "[", "'credentialsFetcher'", "]", ";", "$", "this", "->", "retries", "=", "$", "config", "[", "'retries'", "]", ";", "$", "this", "->", "scopes", "=", "$", "config", "[", "'scopes'", "]", ";", "$", "this", "->", "keyFile", "=", "$", "config", "[", "'keyFile'", "]", ";", "$", "this", "->", "requestTimeout", "=", "$", "config", "[", "'requestTimeout'", "]", ";", "}" ]
Sets common defaults between request wrappers. @param array $config { Configuration options. @type CacheItemPoolInterface $authCache A cache for storing access tokens. **Defaults to** a simple in memory implementation. @type array $authCacheOptions Cache configuration options. @type FetchAuthTokenInterface $credentialsFetcher A credentials fetcher instance. @type array $keyFile The contents of the service account credentials .json file retrieved from the Google Developer's Console. Ex: `json_decode(file_get_contents($path), true)`. @type float $requestTimeout Seconds to wait before timing out the request. **Defaults to** `0` with REST and `60` with gRPC. @type int $retries Number of retries for a failed request. **Defaults to** `3`. @type array $scopes Scopes to be used for the request. } @throws \InvalidArgumentException
[ "Sets", "common", "defaults", "between", "request", "wrappers", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Core/src/RequestWrapperTrait.php#L91-L118
train
googleapis/google-cloud-php
Vision/src/V1/CropHintsAnnotation.php
CropHintsAnnotation.setCropHints
public function setCropHints($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\CropHint::class); $this->crop_hints = $arr; return $this; }
php
public function setCropHints($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\CropHint::class); $this->crop_hints = $arr; return $this; }
[ "public", "function", "setCropHints", "(", "$", "var", ")", "{", "$", "arr", "=", "GPBUtil", "::", "checkRepeatedField", "(", "$", "var", ",", "\\", "Google", "\\", "Protobuf", "\\", "Internal", "\\", "GPBType", "::", "MESSAGE", ",", "\\", "Google", "\\", "Cloud", "\\", "Vision", "\\", "V1", "\\", "CropHint", "::", "class", ")", ";", "$", "this", "->", "crop_hints", "=", "$", "arr", ";", "return", "$", "this", ";", "}" ]
Crop hint results. Generated from protobuf field <code>repeated .google.cloud.vision.v1.CropHint crop_hints = 1;</code> @param \Google\Cloud\Vision\V1\CropHint[]|\Google\Protobuf\Internal\RepeatedField $var @return $this
[ "Crop", "hint", "results", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Vision/src/V1/CropHintsAnnotation.php#L58-L64
train
googleapis/google-cloud-php
Datastore/src/V1/Gapic/DatastoreGapicClient.php
DatastoreGapicClient.beginTransaction
public function beginTransaction($projectId, array $optionalArgs = []) { $request = new BeginTransactionRequest(); $request->setProjectId($projectId); if (isset($optionalArgs['transactionOptions'])) { $request->setTransactionOptions($optionalArgs['transactionOptions']); } $requestParams = new RequestParamsHeaderDescriptor([ 'project_id' => $request->getProjectId(), ]); $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); return $this->startCall( 'BeginTransaction', BeginTransactionResponse::class, $optionalArgs, $request )->wait(); }
php
public function beginTransaction($projectId, array $optionalArgs = []) { $request = new BeginTransactionRequest(); $request->setProjectId($projectId); if (isset($optionalArgs['transactionOptions'])) { $request->setTransactionOptions($optionalArgs['transactionOptions']); } $requestParams = new RequestParamsHeaderDescriptor([ 'project_id' => $request->getProjectId(), ]); $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); return $this->startCall( 'BeginTransaction', BeginTransactionResponse::class, $optionalArgs, $request )->wait(); }
[ "public", "function", "beginTransaction", "(", "$", "projectId", ",", "array", "$", "optionalArgs", "=", "[", "]", ")", "{", "$", "request", "=", "new", "BeginTransactionRequest", "(", ")", ";", "$", "request", "->", "setProjectId", "(", "$", "projectId", ")", ";", "if", "(", "isset", "(", "$", "optionalArgs", "[", "'transactionOptions'", "]", ")", ")", "{", "$", "request", "->", "setTransactionOptions", "(", "$", "optionalArgs", "[", "'transactionOptions'", "]", ")", ";", "}", "$", "requestParams", "=", "new", "RequestParamsHeaderDescriptor", "(", "[", "'project_id'", "=>", "$", "request", "->", "getProjectId", "(", ")", ",", "]", ")", ";", "$", "optionalArgs", "[", "'headers'", "]", "=", "isset", "(", "$", "optionalArgs", "[", "'headers'", "]", ")", "?", "array_merge", "(", "$", "requestParams", "->", "getHeader", "(", ")", ",", "$", "optionalArgs", "[", "'headers'", "]", ")", ":", "$", "requestParams", "->", "getHeader", "(", ")", ";", "return", "$", "this", "->", "startCall", "(", "'BeginTransaction'", ",", "BeginTransactionResponse", "::", "class", ",", "$", "optionalArgs", ",", "$", "request", ")", "->", "wait", "(", ")", ";", "}" ]
Begins a new transaction. Sample code: ``` $datastoreClient = new DatastoreClient(); try { $projectId = ''; $response = $datastoreClient->beginTransaction($projectId); } finally { $datastoreClient->close(); } ``` @param string $projectId The ID of the project against which to make the request. @param array $optionalArgs { Optional. @type TransactionOptions $transactionOptions Options for a new transaction. @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\Datastore\V1\BeginTransactionResponse @throws ApiException if the remote call fails @experimental
[ "Begins", "a", "new", "transaction", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Datastore/src/V1/Gapic/DatastoreGapicClient.php#L354-L375
train
googleapis/google-cloud-php
Datastore/src/V1/Gapic/DatastoreGapicClient.php
DatastoreGapicClient.commit
public function commit($projectId, $mode, $mutations, array $optionalArgs = []) { $request = new CommitRequest(); $request->setProjectId($projectId); $request->setMode($mode); $request->setMutations($mutations); if (isset($optionalArgs['transaction'])) { $request->setTransaction($optionalArgs['transaction']); } $requestParams = new RequestParamsHeaderDescriptor([ 'project_id' => $request->getProjectId(), ]); $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); return $this->startCall( 'Commit', CommitResponse::class, $optionalArgs, $request )->wait(); }
php
public function commit($projectId, $mode, $mutations, array $optionalArgs = []) { $request = new CommitRequest(); $request->setProjectId($projectId); $request->setMode($mode); $request->setMutations($mutations); if (isset($optionalArgs['transaction'])) { $request->setTransaction($optionalArgs['transaction']); } $requestParams = new RequestParamsHeaderDescriptor([ 'project_id' => $request->getProjectId(), ]); $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); return $this->startCall( 'Commit', CommitResponse::class, $optionalArgs, $request )->wait(); }
[ "public", "function", "commit", "(", "$", "projectId", ",", "$", "mode", ",", "$", "mutations", ",", "array", "$", "optionalArgs", "=", "[", "]", ")", "{", "$", "request", "=", "new", "CommitRequest", "(", ")", ";", "$", "request", "->", "setProjectId", "(", "$", "projectId", ")", ";", "$", "request", "->", "setMode", "(", "$", "mode", ")", ";", "$", "request", "->", "setMutations", "(", "$", "mutations", ")", ";", "if", "(", "isset", "(", "$", "optionalArgs", "[", "'transaction'", "]", ")", ")", "{", "$", "request", "->", "setTransaction", "(", "$", "optionalArgs", "[", "'transaction'", "]", ")", ";", "}", "$", "requestParams", "=", "new", "RequestParamsHeaderDescriptor", "(", "[", "'project_id'", "=>", "$", "request", "->", "getProjectId", "(", ")", ",", "]", ")", ";", "$", "optionalArgs", "[", "'headers'", "]", "=", "isset", "(", "$", "optionalArgs", "[", "'headers'", "]", ")", "?", "array_merge", "(", "$", "requestParams", "->", "getHeader", "(", ")", ",", "$", "optionalArgs", "[", "'headers'", "]", ")", ":", "$", "requestParams", "->", "getHeader", "(", ")", ";", "return", "$", "this", "->", "startCall", "(", "'Commit'", ",", "CommitResponse", "::", "class", ",", "$", "optionalArgs", ",", "$", "request", ")", "->", "wait", "(", ")", ";", "}" ]
Commits a transaction, optionally creating, deleting or modifying some entities. Sample code: ``` $datastoreClient = new DatastoreClient(); try { $projectId = ''; $mode = CommitRequest\Mode::MODE_UNSPECIFIED; $mutations = []; $response = $datastoreClient->commit($projectId, $mode, $mutations); } finally { $datastoreClient->close(); } ``` @param string $projectId The ID of the project against which to make the request. @param int $mode The type of commit to perform. Defaults to `TRANSACTIONAL`. For allowed values, use constants defined on {@see \Google\Cloud\Datastore\V1\CommitRequest\Mode} @param Mutation[] $mutations The mutations to perform. When mode is `TRANSACTIONAL`, mutations affecting a single entity are applied in order. The following sequences of mutations affecting a single entity are not permitted in a single `Commit` request: - `insert` followed by `insert` - `update` followed by `insert` - `upsert` followed by `insert` - `delete` followed by `update` When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single entity. @param array $optionalArgs { Optional. @type string $transaction The identifier of the transaction associated with the commit. A transaction identifier is returned by a call to [Datastore.BeginTransaction][google.datastore.v1.Datastore.BeginTransaction]. @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\Datastore\V1\CommitResponse @throws ApiException if the remote call fails @experimental
[ "Commits", "a", "transaction", "optionally", "creating", "deleting", "or", "modifying", "some", "entities", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Datastore/src/V1/Gapic/DatastoreGapicClient.php#L429-L452
train
googleapis/google-cloud-php
Logging/src/PsrLogger.php
PsrLogger.log
public function log($level, $message, array $context = []) { $this->validateLogLevel($level); $options = []; if (isset($context['exception']) && ($context['exception'] instanceof \Exception || $context['exception'] instanceof \Throwable)) { $context['exception'] = (string) $context['exception']; } if (isset($context['stackdriverOptions'])) { $options = $context['stackdriverOptions']; unset($context['stackdriverOptions']); } $formatter = new NormalizerFormatter(); $processor = new PsrLogMessageProcessor(); $processedData = $processor([ 'message' => (string) $message, 'context' => $formatter->format($context) ]); $jsonPayload = [$this->messageKey => $processedData['message']]; // Adding labels for log request correlation. $labels = $this->getLabels(); if (!empty($labels)) { $options['labels'] = (isset($options['labels']) ? $options['labels'] : []) + $labels; // Copy over the value for 'appengine.googleapis.com/trace_id' to // `trace` option too. if (isset($labels['appengine.googleapis.com/trace_id'])) { $options['trace'] = $labels['appengine.googleapis.com/trace_id']; } } // Adding MonitoredResource $resource = $this->metadataProvider->monitoredResource(); if (!empty($resource)) { $options['resource'] = (isset($options['resource']) ? $options['resource'] : []) + $resource; } $entry = $this->logger->entry( $jsonPayload + $processedData['context'], $options + [ 'severity' => $level ] ); $this->sendEntry($entry); }
php
public function log($level, $message, array $context = []) { $this->validateLogLevel($level); $options = []; if (isset($context['exception']) && ($context['exception'] instanceof \Exception || $context['exception'] instanceof \Throwable)) { $context['exception'] = (string) $context['exception']; } if (isset($context['stackdriverOptions'])) { $options = $context['stackdriverOptions']; unset($context['stackdriverOptions']); } $formatter = new NormalizerFormatter(); $processor = new PsrLogMessageProcessor(); $processedData = $processor([ 'message' => (string) $message, 'context' => $formatter->format($context) ]); $jsonPayload = [$this->messageKey => $processedData['message']]; // Adding labels for log request correlation. $labels = $this->getLabels(); if (!empty($labels)) { $options['labels'] = (isset($options['labels']) ? $options['labels'] : []) + $labels; // Copy over the value for 'appengine.googleapis.com/trace_id' to // `trace` option too. if (isset($labels['appengine.googleapis.com/trace_id'])) { $options['trace'] = $labels['appengine.googleapis.com/trace_id']; } } // Adding MonitoredResource $resource = $this->metadataProvider->monitoredResource(); if (!empty($resource)) { $options['resource'] = (isset($options['resource']) ? $options['resource'] : []) + $resource; } $entry = $this->logger->entry( $jsonPayload + $processedData['context'], $options + [ 'severity' => $level ] ); $this->sendEntry($entry); }
[ "public", "function", "log", "(", "$", "level", ",", "$", "message", ",", "array", "$", "context", "=", "[", "]", ")", "{", "$", "this", "->", "validateLogLevel", "(", "$", "level", ")", ";", "$", "options", "=", "[", "]", ";", "if", "(", "isset", "(", "$", "context", "[", "'exception'", "]", ")", "&&", "(", "$", "context", "[", "'exception'", "]", "instanceof", "\\", "Exception", "||", "$", "context", "[", "'exception'", "]", "instanceof", "\\", "Throwable", ")", ")", "{", "$", "context", "[", "'exception'", "]", "=", "(", "string", ")", "$", "context", "[", "'exception'", "]", ";", "}", "if", "(", "isset", "(", "$", "context", "[", "'stackdriverOptions'", "]", ")", ")", "{", "$", "options", "=", "$", "context", "[", "'stackdriverOptions'", "]", ";", "unset", "(", "$", "context", "[", "'stackdriverOptions'", "]", ")", ";", "}", "$", "formatter", "=", "new", "NormalizerFormatter", "(", ")", ";", "$", "processor", "=", "new", "PsrLogMessageProcessor", "(", ")", ";", "$", "processedData", "=", "$", "processor", "(", "[", "'message'", "=>", "(", "string", ")", "$", "message", ",", "'context'", "=>", "$", "formatter", "->", "format", "(", "$", "context", ")", "]", ")", ";", "$", "jsonPayload", "=", "[", "$", "this", "->", "messageKey", "=>", "$", "processedData", "[", "'message'", "]", "]", ";", "// Adding labels for log request correlation.", "$", "labels", "=", "$", "this", "->", "getLabels", "(", ")", ";", "if", "(", "!", "empty", "(", "$", "labels", ")", ")", "{", "$", "options", "[", "'labels'", "]", "=", "(", "isset", "(", "$", "options", "[", "'labels'", "]", ")", "?", "$", "options", "[", "'labels'", "]", ":", "[", "]", ")", "+", "$", "labels", ";", "// Copy over the value for 'appengine.googleapis.com/trace_id' to", "// `trace` option too.", "if", "(", "isset", "(", "$", "labels", "[", "'appengine.googleapis.com/trace_id'", "]", ")", ")", "{", "$", "options", "[", "'trace'", "]", "=", "$", "labels", "[", "'appengine.googleapis.com/trace_id'", "]", ";", "}", "}", "// Adding MonitoredResource", "$", "resource", "=", "$", "this", "->", "metadataProvider", "->", "monitoredResource", "(", ")", ";", "if", "(", "!", "empty", "(", "$", "resource", ")", ")", "{", "$", "options", "[", "'resource'", "]", "=", "(", "isset", "(", "$", "options", "[", "'resource'", "]", ")", "?", "$", "options", "[", "'resource'", "]", ":", "[", "]", ")", "+", "$", "resource", ";", "}", "$", "entry", "=", "$", "this", "->", "logger", "->", "entry", "(", "$", "jsonPayload", "+", "$", "processedData", "[", "'context'", "]", ",", "$", "options", "+", "[", "'severity'", "=>", "$", "level", "]", ")", ";", "$", "this", "->", "sendEntry", "(", "$", "entry", ")", ";", "}" ]
Write a log entry. Example: ``` use Google\Cloud\Logging\Logger; $psrLogger->log(Logger::ALERT, 'alert message'); ``` ``` // Write a log entry using the context array with placeholders. use Google\Cloud\Logging\Logger; $psrLogger->log(Logger::ALERT, 'alert: {message}', [ 'message' => 'my alert message' ]); ``` ``` // Log information regarding an HTTP request use Google\Cloud\Logging\Logger; $psrLogger->log(Logger::ALERT, 'alert message', [ 'stackdriverOptions' => [ 'httpRequest' => [ 'requestMethod' => 'GET' ] ] ]); ``` @param string|int $level The severity of the log entry. @param string $message The message to log. @param array $context { Context is an associative array which can include placeholders to be used in the `$message`. Placeholders must be delimited with a single opening brace `{` and a single closing brace `}`. The context will be added as additional information on the `jsonPayload`. Please note that the key `stackdriverOptions` is reserved for logging Google Stackdriver specific data. @type array $stackdriverOptions['resource'] The [monitored resource](https://cloud.google.com/logging/docs/api/reference/rest/v2/MonitoredResource) to associate this log entry with. **Defaults to** type global. @type array $stackdriverOptions['httpRequest'] Information about the HTTP request associated with this log entry, if applicable. Please see [the API docs](https://cloud.google.com/logging/docs/api/reference/rest/v2/LogEntry#httprequest) for more information. @type array $stackdriverOptions['labels'] A set of user-defined (key, value) data that provides additional information about the log entry. @type array $stackdriverOptions['operation'] Additional information about a potentially long-running operation with which a log entry is associated. Please see [the API docs](https://cloud.google.com/logging/docs/api/reference/rest/v2/LogEntry#logentryoperation) for more information. @type string $stackdriverOptions['insertId'] A unique identifier for the log entry. @type \DateTimeInterface|Timestamp|string|null $stackdriverOptions['timestamp'] The timestamp associated with this entry. If providing a string it must be in RFC3339 UTC "Zulu" format. Example: "2014-10-02T15:01:23.045123456Z". If explicitly set to `null` the timestamp will be generated by the server at the moment the entry is received (with nanosecond precision). **Defaults to** the current time, generated by the client with microsecond precision. } @throws InvalidArgumentException
[ "Write", "a", "log", "entry", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Logging/src/PsrLogger.php#L362-L414
train
googleapis/google-cloud-php
Logging/src/PsrLogger.php
PsrLogger.serialize
public function serialize() { $debugOutputResource = null; if (is_resource($this->debugOutputResource)) { $metadata = stream_get_meta_data($this->debugOutputResource); $debugOutputResource = [ 'uri' => $metadata['uri'], 'mode' => $metadata['mode'] ]; } return serialize([ $this->messageKey, $this->batchEnabled, $this->metadataProvider, $this->debugOutput, $this->clientConfig, $this->batchMethod, $this->logName, $debugOutputResource ]); }
php
public function serialize() { $debugOutputResource = null; if (is_resource($this->debugOutputResource)) { $metadata = stream_get_meta_data($this->debugOutputResource); $debugOutputResource = [ 'uri' => $metadata['uri'], 'mode' => $metadata['mode'] ]; } return serialize([ $this->messageKey, $this->batchEnabled, $this->metadataProvider, $this->debugOutput, $this->clientConfig, $this->batchMethod, $this->logName, $debugOutputResource ]); }
[ "public", "function", "serialize", "(", ")", "{", "$", "debugOutputResource", "=", "null", ";", "if", "(", "is_resource", "(", "$", "this", "->", "debugOutputResource", ")", ")", "{", "$", "metadata", "=", "stream_get_meta_data", "(", "$", "this", "->", "debugOutputResource", ")", ";", "$", "debugOutputResource", "=", "[", "'uri'", "=>", "$", "metadata", "[", "'uri'", "]", ",", "'mode'", "=>", "$", "metadata", "[", "'mode'", "]", "]", ";", "}", "return", "serialize", "(", "[", "$", "this", "->", "messageKey", ",", "$", "this", "->", "batchEnabled", ",", "$", "this", "->", "metadataProvider", ",", "$", "this", "->", "debugOutput", ",", "$", "this", "->", "clientConfig", ",", "$", "this", "->", "batchMethod", ",", "$", "this", "->", "logName", ",", "$", "debugOutputResource", "]", ")", ";", "}" ]
Serializes data. @return string @access private
[ "Serializes", "data", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Logging/src/PsrLogger.php#L432-L453
train
googleapis/google-cloud-php
Logging/src/PsrLogger.php
PsrLogger.unserialize
public function unserialize($data) { list( $this->messageKey, $this->batchEnabled, $this->metadataProvider, $this->debugOutput, $this->clientConfig, $this->batchMethod, $this->logName, $debugOutputResource ) = unserialize($data); if (is_array($debugOutputResource)) { $this->debugOutputResource = fopen( $debugOutputResource['uri'], $debugOutputResource['mode'] ); } }
php
public function unserialize($data) { list( $this->messageKey, $this->batchEnabled, $this->metadataProvider, $this->debugOutput, $this->clientConfig, $this->batchMethod, $this->logName, $debugOutputResource ) = unserialize($data); if (is_array($debugOutputResource)) { $this->debugOutputResource = fopen( $debugOutputResource['uri'], $debugOutputResource['mode'] ); } }
[ "public", "function", "unserialize", "(", "$", "data", ")", "{", "list", "(", "$", "this", "->", "messageKey", ",", "$", "this", "->", "batchEnabled", ",", "$", "this", "->", "metadataProvider", ",", "$", "this", "->", "debugOutput", ",", "$", "this", "->", "clientConfig", ",", "$", "this", "->", "batchMethod", ",", "$", "this", "->", "logName", ",", "$", "debugOutputResource", ")", "=", "unserialize", "(", "$", "data", ")", ";", "if", "(", "is_array", "(", "$", "debugOutputResource", ")", ")", "{", "$", "this", "->", "debugOutputResource", "=", "fopen", "(", "$", "debugOutputResource", "[", "'uri'", "]", ",", "$", "debugOutputResource", "[", "'mode'", "]", ")", ";", "}", "}" ]
Unserializes data. @param string @access private
[ "Unserializes", "data", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Logging/src/PsrLogger.php#L461-L480
train
googleapis/google-cloud-php
Logging/src/PsrLogger.php
PsrLogger.validateLogLevel
private function validateLogLevel($level) { $map = Logger::getLogLevelMap(); $level = (string) $level; if (isset($map[$level]) || isset(array_flip($map)[strtoupper($level)])) { return true; } throw new InvalidArgumentException("Severity level '$level' is not defined."); }
php
private function validateLogLevel($level) { $map = Logger::getLogLevelMap(); $level = (string) $level; if (isset($map[$level]) || isset(array_flip($map)[strtoupper($level)])) { return true; } throw new InvalidArgumentException("Severity level '$level' is not defined."); }
[ "private", "function", "validateLogLevel", "(", "$", "level", ")", "{", "$", "map", "=", "Logger", "::", "getLogLevelMap", "(", ")", ";", "$", "level", "=", "(", "string", ")", "$", "level", ";", "if", "(", "isset", "(", "$", "map", "[", "$", "level", "]", ")", "||", "isset", "(", "array_flip", "(", "$", "map", ")", "[", "strtoupper", "(", "$", "level", ")", "]", ")", ")", "{", "return", "true", ";", "}", "throw", "new", "InvalidArgumentException", "(", "\"Severity level '$level' is not defined.\"", ")", ";", "}" ]
Validates whether or not the provided log level exists. @param string|int $level The severity of the log entry. @return bool @throws InvalidArgumentException
[ "Validates", "whether", "or", "not", "the", "provided", "log", "level", "exists", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Logging/src/PsrLogger.php#L504-L514
train
googleapis/google-cloud-php
Logging/src/PsrLogger.php
PsrLogger.sendEntry
private function sendEntry(Entry $entry) { if ($this->batchEnabled) { $this->batchRunner->submitItem($this->identifier, $entry); return; } $this->logger->write($entry); }
php
private function sendEntry(Entry $entry) { if ($this->batchEnabled) { $this->batchRunner->submitItem($this->identifier, $entry); return; } $this->logger->write($entry); }
[ "private", "function", "sendEntry", "(", "Entry", "$", "entry", ")", "{", "if", "(", "$", "this", "->", "batchEnabled", ")", "{", "$", "this", "->", "batchRunner", "->", "submitItem", "(", "$", "this", "->", "identifier", ",", "$", "entry", ")", ";", "return", ";", "}", "$", "this", "->", "logger", "->", "write", "(", "$", "entry", ")", ";", "}" ]
Send the given entry. @param Entry $entry
[ "Send", "the", "given", "entry", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Logging/src/PsrLogger.php#L521-L529
train
googleapis/google-cloud-php
PubSub/src/Snapshot.php
Snapshot.create
public function create(array $options = []) { if (!$this->info['subscription']) { throw new \BadMethodCallException('A subscription is required to create a snapshot.'); } return $this->info = $this->connection->createSnapshot([ 'project' => $this->formatName('project', $this->projectId), 'name' => $this->name, 'subscription' => $this->info['subscription'] ]); }
php
public function create(array $options = []) { if (!$this->info['subscription']) { throw new \BadMethodCallException('A subscription is required to create a snapshot.'); } return $this->info = $this->connection->createSnapshot([ 'project' => $this->formatName('project', $this->projectId), 'name' => $this->name, 'subscription' => $this->info['subscription'] ]); }
[ "public", "function", "create", "(", "array", "$", "options", "=", "[", "]", ")", "{", "if", "(", "!", "$", "this", "->", "info", "[", "'subscription'", "]", ")", "{", "throw", "new", "\\", "BadMethodCallException", "(", "'A subscription is required to create a snapshot.'", ")", ";", "}", "return", "$", "this", "->", "info", "=", "$", "this", "->", "connection", "->", "createSnapshot", "(", "[", "'project'", "=>", "$", "this", "->", "formatName", "(", "'project'", ",", "$", "this", "->", "projectId", ")", ",", "'name'", "=>", "$", "this", "->", "name", ",", "'subscription'", "=>", "$", "this", "->", "info", "[", "'subscription'", "]", "]", ")", ";", "}" ]
Create a new Snapshot. When creating a snapshot, a subscription name must be supplied at instantiation. Please note that this method may not yet be available in your project. Example: ``` $info = $snapshot->create(); ``` @param array $options [optional] Configuration options. @return array @throws \BadMethodCallException If a subscription name cannot be found.
[ "Create", "a", "new", "Snapshot", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/PubSub/src/Snapshot.php#L159-L170
train
googleapis/google-cloud-php
PubSub/src/Snapshot.php
Snapshot.topic
public function topic() { if ($this->info['topic']) { return new Topic( $this->connection, $this->projectId, $this->info['topic'], $this->encode, [], $this->clientConfig ); } return null; }
php
public function topic() { if ($this->info['topic']) { return new Topic( $this->connection, $this->projectId, $this->info['topic'], $this->encode, [], $this->clientConfig ); } return null; }
[ "public", "function", "topic", "(", ")", "{", "if", "(", "$", "this", "->", "info", "[", "'topic'", "]", ")", "{", "return", "new", "Topic", "(", "$", "this", "->", "connection", ",", "$", "this", "->", "projectId", ",", "$", "this", "->", "info", "[", "'topic'", "]", ",", "$", "this", "->", "encode", ",", "[", "]", ",", "$", "this", "->", "clientConfig", ")", ";", "}", "return", "null", ";", "}" ]
Get the Topic attached to the snapshot, if one exists. Example: ``` $topic = $snapshot->topic(); ``` @return Topic|null
[ "Get", "the", "Topic", "attached", "to", "the", "snapshot", "if", "one", "exists", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/PubSub/src/Snapshot.php#L202-L216
train
googleapis/google-cloud-php
PubSub/src/Snapshot.php
Snapshot.subscription
public function subscription() { return $this->info['subscription'] ? new Subscription($this->connection, $this->projectId, $this->info['subscription'], null, $this->encode) : null; }
php
public function subscription() { return $this->info['subscription'] ? new Subscription($this->connection, $this->projectId, $this->info['subscription'], null, $this->encode) : null; }
[ "public", "function", "subscription", "(", ")", "{", "return", "$", "this", "->", "info", "[", "'subscription'", "]", "?", "new", "Subscription", "(", "$", "this", "->", "connection", ",", "$", "this", "->", "projectId", ",", "$", "this", "->", "info", "[", "'subscription'", "]", ",", "null", ",", "$", "this", "->", "encode", ")", ":", "null", ";", "}" ]
Get the Subscription attached to the snapshot, if one exists. Example: ``` $subscription = $snapshot->subscription(); ``` @return Subscription|null
[ "Get", "the", "Subscription", "attached", "to", "the", "snapshot", "if", "one", "exists", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/PubSub/src/Snapshot.php#L228-L233
train
googleapis/google-cloud-php
Trace/src/MessageEvent.php
MessageEvent.info
public function info() { $data = [ 'id' => $this->id, 'type' => $this->type ]; if ($this->uncompressedSizeBytes) { $data['uncompressedSizeBytes'] = $this->uncompressedSizeBytes; } if ($this->compressedSizeBytes) { $data['compressedSizeBytes'] = $this->compressedSizeBytes; } return [ 'time' => $this->time, 'messageEvent' => $data ]; }
php
public function info() { $data = [ 'id' => $this->id, 'type' => $this->type ]; if ($this->uncompressedSizeBytes) { $data['uncompressedSizeBytes'] = $this->uncompressedSizeBytes; } if ($this->compressedSizeBytes) { $data['compressedSizeBytes'] = $this->compressedSizeBytes; } return [ 'time' => $this->time, 'messageEvent' => $data ]; }
[ "public", "function", "info", "(", ")", "{", "$", "data", "=", "[", "'id'", "=>", "$", "this", "->", "id", ",", "'type'", "=>", "$", "this", "->", "type", "]", ";", "if", "(", "$", "this", "->", "uncompressedSizeBytes", ")", "{", "$", "data", "[", "'uncompressedSizeBytes'", "]", "=", "$", "this", "->", "uncompressedSizeBytes", ";", "}", "if", "(", "$", "this", "->", "compressedSizeBytes", ")", "{", "$", "data", "[", "'compressedSizeBytes'", "]", "=", "$", "this", "->", "compressedSizeBytes", ";", "}", "return", "[", "'time'", "=>", "$", "this", "->", "time", ",", "'messageEvent'", "=>", "$", "data", "]", ";", "}" ]
Returns a serializable array representing this MessageEvent. @access private @return array
[ "Returns", "a", "serializable", "array", "representing", "this", "MessageEvent", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Trace/src/MessageEvent.php#L107-L125
train
googleapis/google-cloud-php
Talent/src/V4beta1/Profile.php
Profile.setPersonNames
public function setPersonNames($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Talent\V4beta1\PersonName::class); $this->person_names = $arr; return $this; }
php
public function setPersonNames($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Talent\V4beta1\PersonName::class); $this->person_names = $arr; return $this; }
[ "public", "function", "setPersonNames", "(", "$", "var", ")", "{", "$", "arr", "=", "GPBUtil", "::", "checkRepeatedField", "(", "$", "var", ",", "\\", "Google", "\\", "Protobuf", "\\", "Internal", "\\", "GPBType", "::", "MESSAGE", ",", "\\", "Google", "\\", "Cloud", "\\", "Talent", "\\", "V4beta1", "\\", "PersonName", "::", "class", ")", ";", "$", "this", "->", "person_names", "=", "$", "arr", ";", "return", "$", "this", ";", "}" ]
Optional. The names of the candidate this profile references. Currently only one person name is supported. Generated from protobuf field <code>repeated .google.cloud.talent.v4beta1.PersonName person_names = 11;</code> @param \Google\Cloud\Talent\V4beta1\PersonName[]|\Google\Protobuf\Internal\RepeatedField $var @return $this
[ "Optional", ".", "The", "names", "of", "the", "candidate", "this", "profile", "references", ".", "Currently", "only", "one", "person", "name", "is", "supported", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Talent/src/V4beta1/Profile.php#L856-L862
train
googleapis/google-cloud-php
Talent/src/V4beta1/Profile.php
Profile.setAddresses
public function setAddresses($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Talent\V4beta1\Address::class); $this->addresses = $arr; return $this; }
php
public function setAddresses($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Talent\V4beta1\Address::class); $this->addresses = $arr; return $this; }
[ "public", "function", "setAddresses", "(", "$", "var", ")", "{", "$", "arr", "=", "GPBUtil", "::", "checkRepeatedField", "(", "$", "var", ",", "\\", "Google", "\\", "Protobuf", "\\", "Internal", "\\", "GPBType", "::", "MESSAGE", ",", "\\", "Google", "\\", "Cloud", "\\", "Talent", "\\", "V4beta1", "\\", "Address", "::", "class", ")", ";", "$", "this", "->", "addresses", "=", "$", "arr", ";", "return", "$", "this", ";", "}" ]
Optional. The candidate's postal addresses. Generated from protobuf field <code>repeated .google.cloud.talent.v4beta1.Address addresses = 12;</code> @param \Google\Cloud\Talent\V4beta1\Address[]|\Google\Protobuf\Internal\RepeatedField $var @return $this
[ "Optional", ".", "The", "candidate", "s", "postal", "addresses", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Talent/src/V4beta1/Profile.php#L884-L890
train
googleapis/google-cloud-php
Talent/src/V4beta1/Profile.php
Profile.setEmailAddresses
public function setEmailAddresses($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Talent\V4beta1\Email::class); $this->email_addresses = $arr; return $this; }
php
public function setEmailAddresses($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Talent\V4beta1\Email::class); $this->email_addresses = $arr; return $this; }
[ "public", "function", "setEmailAddresses", "(", "$", "var", ")", "{", "$", "arr", "=", "GPBUtil", "::", "checkRepeatedField", "(", "$", "var", ",", "\\", "Google", "\\", "Protobuf", "\\", "Internal", "\\", "GPBType", "::", "MESSAGE", ",", "\\", "Google", "\\", "Cloud", "\\", "Talent", "\\", "V4beta1", "\\", "Email", "::", "class", ")", ";", "$", "this", "->", "email_addresses", "=", "$", "arr", ";", "return", "$", "this", ";", "}" ]
Optional. The candidate's email addresses. Generated from protobuf field <code>repeated .google.cloud.talent.v4beta1.Email email_addresses = 13;</code> @param \Google\Cloud\Talent\V4beta1\Email[]|\Google\Protobuf\Internal\RepeatedField $var @return $this
[ "Optional", ".", "The", "candidate", "s", "email", "addresses", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Talent/src/V4beta1/Profile.php#L912-L918
train
googleapis/google-cloud-php
Talent/src/V4beta1/Profile.php
Profile.setPersonalUris
public function setPersonalUris($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Talent\V4beta1\PersonalUri::class); $this->personal_uris = $arr; return $this; }
php
public function setPersonalUris($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Talent\V4beta1\PersonalUri::class); $this->personal_uris = $arr; return $this; }
[ "public", "function", "setPersonalUris", "(", "$", "var", ")", "{", "$", "arr", "=", "GPBUtil", "::", "checkRepeatedField", "(", "$", "var", ",", "\\", "Google", "\\", "Protobuf", "\\", "Internal", "\\", "GPBType", "::", "MESSAGE", ",", "\\", "Google", "\\", "Cloud", "\\", "Talent", "\\", "V4beta1", "\\", "PersonalUri", "::", "class", ")", ";", "$", "this", "->", "personal_uris", "=", "$", "arr", ";", "return", "$", "this", ";", "}" ]
Optional. The candidate's personal URIs. Generated from protobuf field <code>repeated .google.cloud.talent.v4beta1.PersonalUri personal_uris = 15;</code> @param \Google\Cloud\Talent\V4beta1\PersonalUri[]|\Google\Protobuf\Internal\RepeatedField $var @return $this
[ "Optional", ".", "The", "candidate", "s", "personal", "URIs", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Talent/src/V4beta1/Profile.php#L968-L974
train
googleapis/google-cloud-php
Talent/src/V4beta1/Profile.php
Profile.setSkills
public function setSkills($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Talent\V4beta1\Skill::class); $this->skills = $arr; return $this; }
php
public function setSkills($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Talent\V4beta1\Skill::class); $this->skills = $arr; return $this; }
[ "public", "function", "setSkills", "(", "$", "var", ")", "{", "$", "arr", "=", "GPBUtil", "::", "checkRepeatedField", "(", "$", "var", ",", "\\", "Google", "\\", "Protobuf", "\\", "Internal", "\\", "GPBType", "::", "MESSAGE", ",", "\\", "Google", "\\", "Cloud", "\\", "Talent", "\\", "V4beta1", "\\", "Skill", "::", "class", ")", ";", "$", "this", "->", "skills", "=", "$", "arr", ";", "return", "$", "this", ";", "}" ]
Optional. The skill set of the candidate. It's highly recommended to provide as much information as possible to help improve the search quality. Generated from protobuf field <code>repeated .google.cloud.talent.v4beta1.Skill skills = 19;</code> @param \Google\Cloud\Talent\V4beta1\Skill[]|\Google\Protobuf\Internal\RepeatedField $var @return $this
[ "Optional", ".", "The", "skill", "set", "of", "the", "candidate", ".", "It", "s", "highly", "recommended", "to", "provide", "as", "much", "information", "as", "possible", "to", "help", "improve", "the", "search", "quality", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Talent/src/V4beta1/Profile.php#L1134-L1140
train
googleapis/google-cloud-php
Talent/src/V4beta1/Profile.php
Profile.setPublications
public function setPublications($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Talent\V4beta1\Publication::class); $this->publications = $arr; return $this; }
php
public function setPublications($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Talent\V4beta1\Publication::class); $this->publications = $arr; return $this; }
[ "public", "function", "setPublications", "(", "$", "var", ")", "{", "$", "arr", "=", "GPBUtil", "::", "checkRepeatedField", "(", "$", "var", ",", "\\", "Google", "\\", "Protobuf", "\\", "Internal", "\\", "GPBType", "::", "MESSAGE", ",", "\\", "Google", "\\", "Cloud", "\\", "Talent", "\\", "V4beta1", "\\", "Publication", "::", "class", ")", ";", "$", "this", "->", "publications", "=", "$", "arr", ";", "return", "$", "this", ";", "}" ]
Optional. The publications published by the candidate. Generated from protobuf field <code>repeated .google.cloud.talent.v4beta1.Publication publications = 21;</code> @param \Google\Cloud\Talent\V4beta1\Publication[]|\Google\Protobuf\Internal\RepeatedField $var @return $this
[ "Optional", ".", "The", "publications", "published", "by", "the", "candidate", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Talent/src/V4beta1/Profile.php#L1196-L1202
train
googleapis/google-cloud-php
Talent/src/V4beta1/Profile.php
Profile.setPatents
public function setPatents($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Talent\V4beta1\Patent::class); $this->patents = $arr; return $this; }
php
public function setPatents($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Talent\V4beta1\Patent::class); $this->patents = $arr; return $this; }
[ "public", "function", "setPatents", "(", "$", "var", ")", "{", "$", "arr", "=", "GPBUtil", "::", "checkRepeatedField", "(", "$", "var", ",", "\\", "Google", "\\", "Protobuf", "\\", "Internal", "\\", "GPBType", "::", "MESSAGE", ",", "\\", "Google", "\\", "Cloud", "\\", "Talent", "\\", "V4beta1", "\\", "Patent", "::", "class", ")", ";", "$", "this", "->", "patents", "=", "$", "arr", ";", "return", "$", "this", ";", "}" ]
Optional. The patents acquired by the candidate. Generated from protobuf field <code>repeated .google.cloud.talent.v4beta1.Patent patents = 22;</code> @param \Google\Cloud\Talent\V4beta1\Patent[]|\Google\Protobuf\Internal\RepeatedField $var @return $this
[ "Optional", ".", "The", "patents", "acquired", "by", "the", "candidate", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Talent/src/V4beta1/Profile.php#L1224-L1230
train
googleapis/google-cloud-php
Talent/src/V4beta1/Profile.php
Profile.setCertifications
public function setCertifications($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Talent\V4beta1\Certification::class); $this->certifications = $arr; return $this; }
php
public function setCertifications($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Talent\V4beta1\Certification::class); $this->certifications = $arr; return $this; }
[ "public", "function", "setCertifications", "(", "$", "var", ")", "{", "$", "arr", "=", "GPBUtil", "::", "checkRepeatedField", "(", "$", "var", ",", "\\", "Google", "\\", "Protobuf", "\\", "Internal", "\\", "GPBType", "::", "MESSAGE", ",", "\\", "Google", "\\", "Cloud", "\\", "Talent", "\\", "V4beta1", "\\", "Certification", "::", "class", ")", ";", "$", "this", "->", "certifications", "=", "$", "arr", ";", "return", "$", "this", ";", "}" ]
Optional. The certifications acquired by the candidate. Generated from protobuf field <code>repeated .google.cloud.talent.v4beta1.Certification certifications = 23;</code> @param \Google\Cloud\Talent\V4beta1\Certification[]|\Google\Protobuf\Internal\RepeatedField $var @return $this
[ "Optional", ".", "The", "certifications", "acquired", "by", "the", "candidate", "." ]
ff5030ffa1f12904565509a7bc24ecc0bd794a3e
https://github.com/googleapis/google-cloud-php/blob/ff5030ffa1f12904565509a7bc24ecc0bd794a3e/Talent/src/V4beta1/Profile.php#L1252-L1258
train