_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q15300 | Asset.setIamPolicy | train | public function setIamPolicy($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\SecurityCenter\V1\Asset_IamPolicy::class);
$this->iam_policy = $var;
return $this;
} | php | {
"resource": ""
} |
q15301 | ListenResponse.setFilter | train | public function setFilter($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1beta1\ExistenceFilter::class);
$this->writeOneof(5, $var);
return $this;
} | php | {
"resource": ""
} |
q15302 | TransformationOverview.setTransformationSummaries | train | public function setTransformationSummaries($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dlp\V2\TransformationSummary::class);
$this->transformation_summaries = $arr;
return $this;
} | php | {
"resource": ""
} |
q15303 | ListJobTriggersResponse.setJobTriggers | train | public function setJobTriggers($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dlp\V2\JobTrigger::class);
$this->job_triggers = $arr;
return $this;
} | php | {
"resource": ""
} |
q15304 | TemplateParameter.setValidation | train | public function setValidation($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dataproc\V1beta2\ParameterValidation::class);
$this->validation = $var;
return $this;
} | php | {
"resource": ""
} |
q15305 | NodeConfig.setTags | train | public function setTags($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->tags = $arr;
return $this;
} | php | {
"resource": ""
} |
q15306 | ValueMapper.encodeValues | train | public function encodeValues(array $fields)
{
$output = [];
foreach ($fields as $key => $val) {
$output[$key] = $this->encodeValue($val);
}
return $output;
} | php | {
"resource": ""
} |
q15307 | ValueMapper.encodeValue | train | public function encodeValue($value)
{
$type = gettype($value);
switch ($type) {
case 'boolean':
return ['booleanValue' => $value];
break;
case 'integer':
return ['integerValue' => $value];
break;
case 'double':
return ['doubleValue' => $value];
break;
case 'string':
return ['stringValue' => $value];
break;
case 'resource':
return ['bytesValue' => stream_get_contents($value)];
break;
case 'object':
return $this->encodeObjectValue($value);
break;
case 'array':
if (!empty($value) && $this->isAssoc($value)) {
return $this->encodeAssociativeArrayValue($value);
}
return ['arrayValue' => $this->encodeArrayValue($value)];
break;
case 'NULL':
// @todo encode this in a way such that is compatible with a potential future REST transport.
return ['nullValue' => NullValue::NULL_VALUE];
break;
// @codeCoverageIgnoreStart
default:
throw new \RuntimeException(sprintf(
'Invalid value type %s',
$type
));
break;
// @codeCoverageIgnoreEnd
}
} | php | {
"resource": ""
} |
q15308 | ValueMapper.encodeObjectValue | train | private function encodeObjectValue($value)
{
if ($value instanceof \stdClass) {
return $this->encodeAssociativeArrayValue((array) $value);
}
if ($value instanceof Blob) {
return ['bytesValue' => (string) $value];
}
if ($value instanceof \DateTimeInterface) {
return [
'timestampValue' => [
'seconds' => $value->format('U'),
'nanos' => (int)($value->format('u') * 1000)
]
];
}
if ($value instanceof Timestamp) {
return [
'timestampValue' => [
'seconds' => $value->get()->format('U'),
'nanos' => $value->nanoSeconds()
]
];
}
if ($value instanceof GeoPoint) {
return ['geoPointValue' => $value->point()];
}
if ($value instanceof DocumentReference || $value instanceof DocumentSnapshot) {
return ['referenceValue' => $value->name()];
}
throw new \RuntimeException(sprintf(
'Object of type %s cannot be encoded to a Firestore value type.',
get_class($value)
));
} | php | {
"resource": ""
} |
q15309 | ValueMapper.encodeAssociativeArrayValue | train | private function encodeAssociativeArrayValue(array $value)
{
$out = [];
foreach ($value as $key => $item) {
$out[$key] = $this->encodeValue($item);
}
return ['mapValue' => ['fields' => $out]];
} | php | {
"resource": ""
} |
q15310 | CreateDeviceRequest.setDevice | train | public function setDevice($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Iot\V1\Device::class);
$this->device = $var;
return $this;
} | php | {
"resource": ""
} |
q15311 | WebhookResponse.setFollowupEventInput | train | public function setFollowupEventInput($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\EventInput::class);
$this->followup_event_input = $var;
return $this;
} | php | {
"resource": ""
} |
q15312 | CreateClusterRequest.setCluster | train | public function setCluster($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\Admin\V2\Cluster::class);
$this->cluster = $var;
return $this;
} | php | {
"resource": ""
} |
q15313 | KeySet.keySetObject | train | public function keySetObject()
{
$ranges = [];
foreach ($this->ranges as $range) {
$ranges[] = $range->keyRangeObject();
}
$set = [];
if ($this->all) {
$set['all'] = true;
}
if ($this->keys) {
$set['keys'] = $this->keys;
}
if ($ranges) {
$set['ranges'] = $ranges;
}
return $set;
} | php | {
"resource": ""
} |
q15314 | Transaction.insertBatch | train | public function insertBatch($table, array $dataSet)
{
$this->enqueue(Operation::OP_INSERT, $table, $dataSet);
return $this;
} | php | {
"resource": ""
} |
q15315 | Transaction.updateBatch | train | public function updateBatch($table, array $dataSet)
{
$this->enqueue(Operation::OP_UPDATE, $table, $dataSet);
return $this;
} | php | {
"resource": ""
} |
q15316 | Transaction.insertOrUpdateBatch | train | public function insertOrUpdateBatch($table, array $dataSet)
{
$this->enqueue(Operation::OP_INSERT_OR_UPDATE, $table, $dataSet);
return $this;
} | php | {
"resource": ""
} |
q15317 | Transaction.replaceBatch | train | public function replaceBatch($table, array $dataSet)
{
$this->enqueue(Operation::OP_REPLACE, $table, $dataSet);
return $this;
} | php | {
"resource": ""
} |
q15318 | Transaction.delete | train | public function delete($table, KeySet $keySet)
{
$this->enqueue(Operation::OP_DELETE, $table, [$keySet]);
return $this;
} | php | {
"resource": ""
} |
q15319 | Transaction.executeUpdate | train | public function executeUpdate($sql, array $options = [])
{
$options['seqno'] = $this->seqno;
$this->seqno++;
return $this->operation
->executeUpdate($this->session, $this, $sql, $options);
} | php | {
"resource": ""
} |
q15320 | Transaction.commit | train | public function commit(array $options = [])
{
if ($this->state !== self::STATE_ACTIVE) {
throw new \BadMethodCallException('The transaction cannot be committed because it is not active');
}
if (!$this->singleUseState()) {
$this->state = self::STATE_COMMITTED;
}
$options += [
'mutations' => []
];
$options['mutations'] += $this->mutations;
$options['transactionId'] = $this->transactionId;
$t = $this->transactionOptions($options);
$options[$t[1]] = $t[0];
return $this->operation->commit($this->session, $this->pluck('mutations', $options), $options);
} | php | {
"resource": ""
} |
q15321 | Transaction.enqueue | train | private function enqueue($op, $table, array $dataSet)
{
foreach ($dataSet as $data) {
if ($op === Operation::OP_DELETE) {
$this->mutations[] = $this->operation->deleteMutation($table, $data);
} else {
$this->mutations[] = $this->operation->mutation($op, $table, $data);
}
}
} | php | {
"resource": ""
} |
q15322 | ListWorkflowTemplatesResponse.setTemplates | train | public function setTemplates($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dataproc\V1\WorkflowTemplate::class);
$this->templates = $arr;
return $this;
} | php | {
"resource": ""
} |
q15323 | GerritSourceContext.setAliasContext | train | public function setAliasContext($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\DevTools\Source\V1\AliasContext::class);
$this->writeOneof(5, $var);
return $this;
} | php | {
"resource": ""
} |
q15324 | DocumentReference.create | train | public function create(array $fields = [], array $options = [])
{
return $this->writeResult(
$this->batchFactory()
->create($this->name, $fields, $options)
->commit($options)
);
} | php | {
"resource": ""
} |
q15325 | DocumentReference.set | train | public function set(array $fields, array $options = [])
{
return $this->writeResult(
$this->batchFactory()
->set($this->name, $fields, $options)
->commit($options)
);
} | php | {
"resource": ""
} |
q15326 | DocumentReference.update | train | public function update(array $data, array $options = [])
{
return $this->writeResult(
$this->batchFactory()
->update($this->name, $data, $options)
->commit($options)
);
} | php | {
"resource": ""
} |
q15327 | DocumentReference.snapshot | train | public function snapshot(array $options = [])
{
return $this->createSnapshot($this->connection, $this->valueMapper, $this, $options);
} | php | {
"resource": ""
} |
q15328 | DocumentReference.collection | train | public function collection($collectionId)
{
return new CollectionReference(
$this->connection,
$this->valueMapper,
$this->childPath($this->name, $collectionId)
);
} | php | {
"resource": ""
} |
q15329 | DocumentReference.collections | train | public function collections(array $options = [])
{
$resultLimit = $this->pluck('resultLimit', $options, false);
return new ItemIterator(
new PageIterator(
function ($collectionId) {
return new CollectionReference(
$this->connection,
$this->valueMapper,
$this->childPath($this->name, $collectionId)
);
},
[$this->connection, 'listCollectionIds'],
$options + ['parent' => $this->name],
[
'itemsKey' => 'collectionIds',
'resultLimit' => $resultLimit
]
)
);
} | php | {
"resource": ""
} |
q15330 | DocumentReference.batchFactory | train | protected function batchFactory()
{
return new WriteBatch(
$this->connection,
$this->valueMapper,
$this->databaseFromName($this->name)
);
} | php | {
"resource": ""
} |
q15331 | Cluster.setConfig | train | public function setConfig($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dataproc\V1beta2\ClusterConfig::class);
$this->config = $var;
return $this;
} | php | {
"resource": ""
} |
q15332 | UnaryFilter.setField | train | public function setField($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1beta1\StructuredQuery_FieldReference::class);
$this->writeOneof(2, $var);
return $this;
} | php | {
"resource": ""
} |
q15333 | InputConfig.setGcsSource | train | public function setGcsSource($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Redis\V1\GcsSource::class);
$this->writeOneof(1, $var);
return $this;
} | php | {
"resource": ""
} |
q15334 | CompensationEntry.setRange | train | public function setRange($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Talent\V4beta1\CompensationInfo_CompensationRange::class);
$this->writeOneof(4, $var);
return $this;
} | php | {
"resource": ""
} |
q15335 | DeviceRegistry.setMqttConfig | train | public function setMqttConfig($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Iot\V1\MqttConfig::class);
$this->mqtt_config = $var;
return $this;
} | php | {
"resource": ""
} |
q15336 | CreateProductSetRequest.setProductSet | train | public function setProductSet($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ProductSet::class);
$this->product_set = $var;
return $this;
} | php | {
"resource": ""
} |
q15337 | Table.update | train | public function update(array $metadata, array $options = [])
{
$options = $this->applyEtagHeader(
$options
+ $metadata
+ $this->identity
);
if (!isset($options['etag']) && !isset($options['retries'])) {
$options['retries'] = 0;
}
return $this->info = $this->connection->patchTable($options);
} | php | {
"resource": ""
} |
q15338 | Table.runJob | train | public function runJob(JobConfigurationInterface $config, array $options = [])
{
$maxRetries = $this->pluck('maxRetries', $options, false);
$job = $this->startJob($config, $options);
$job->waitUntilComplete(['maxRetries' => $maxRetries]);
return $job;
} | php | {
"resource": ""
} |
q15339 | Table.startJob | train | public function startJob(JobConfigurationInterface $config, array $options = [])
{
$response = null;
$config = $config->toArray() + $options;
if (isset($config['data'])) {
$response = $this->connection->insertJobUpload($config)->upload();
} else {
$response = $this->connection->insertJob($config);
}
return new Job(
$this->connection,
$config['jobReference']['jobId'],
$this->identity['projectId'],
$this->mapper,
$response
);
} | php | {
"resource": ""
} |
q15340 | Table.insertRow | train | public function insertRow(array $row, array $options = [])
{
$row = ['data' => $row];
if (isset($options['insertId'])) {
$row['insertId'] = $options['insertId'];
unset($options['insertId']);
}
return $this->insertRows([$row], $options);
} | php | {
"resource": ""
} |
q15341 | Table.insertRows | train | public function insertRows(array $rows, array $options = [])
{
if (count($rows) === 0) {
throw new \InvalidArgumentException('Must provide at least a single row.');
}
foreach ($rows as $row) {
if (!isset($row['data'])) {
throw new \InvalidArgumentException('A row must have a data key.');
}
if (!isset($options['retries']) && !isset($row['insertId'])) {
$options['retries'] = 0;
}
foreach ($row['data'] as $key => $item) {
$row['data'][$key] = $this->mapper->toBigQuery($item);
}
$row['json'] = $row['data'];
unset($row['data']);
$options['rows'][] = $row;
}
return new InsertResponse(
$this->handleInsert($options),
$options['rows']
);
} | php | {
"resource": ""
} |
q15342 | Table.reload | train | public function reload(array $options = [])
{
return $this->info = $this->connection->getTable($options + $this->identity);
} | php | {
"resource": ""
} |
q15343 | Table.handleInsert | train | private function handleInsert(array $options)
{
$attempt = 0;
$metadata = $this->pluck('tableMetadata', $options, false) ?: [];
$autoCreate = $this->pluck('autoCreate', $options, false) ?: false;
$maxRetries = $this->pluck('maxRetries', $options, false) ?: self::MAX_RETRIES;
while (true) {
try {
return $this->connection->insertAllTableData(
$this->identity + $options
);
} catch (NotFoundException $ex) {
if ($autoCreate === true && $attempt <= $maxRetries) {
if (!isset($metadata['schema'])) {
throw new \InvalidArgumentException(
'A schema is required when creating a table.'
);
}
$this->usleep(mt_rand(1, self::INSERT_CREATE_MAX_DELAY_MICROSECONDS));
try {
$this->connection->insertTable($metadata + [
'projectId' => $this->identity['projectId'],
'datasetId' => $this->identity['datasetId'],
'tableReference' => $this->identity,
'retries' => 0
]);
} catch (ConflictException $ex) {
} catch (\Exception $ex) {
$retryFunction = $this->getRetryFunction();
if (!$retryFunction($ex)) {
throw $ex;
}
}
$this->usleep(self::INSERT_CREATE_MAX_DELAY_MICROSECONDS);
$attempt++;
} else {
throw $ex;
}
}
}
} | php | {
"resource": ""
} |
q15344 | ListGroupMembersResponse.setMembers | train | public function setMembers($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\MonitoredResource::class);
$this->members = $arr;
return $this;
} | php | {
"resource": ""
} |
q15345 | DataSourceParameter.setType | train | public function setType($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\BigQuery\DataTransfer\V1\DataSourceParameter_Type::class);
$this->type = $var;
return $this;
} | php | {
"resource": ""
} |
q15346 | DataSourceParameter.setAllowedValues | train | public function setAllowedValues($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->allowed_values = $arr;
return $this;
} | php | {
"resource": ""
} |
q15347 | DataSourceParameter.setFields | train | public function setFields($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\BigQuery\DataTransfer\V1\DataSourceParameter::class);
$this->fields = $arr;
return $this;
} | php | {
"resource": ""
} |
q15348 | DebuggerClient.debuggees | train | public function debuggees(array $extras = [])
{
$res = $this->connection->listDebuggees(['project' => $this->projectId] + $extras);
if (is_array($res) && array_key_exists('debuggees', $res)) {
return array_map(function ($info) {
return new Debuggee($this->connection, $info);
}, $res['debuggees']);
}
return [];
} | php | {
"resource": ""
} |
q15349 | Projection.setProperty | train | public function setProperty($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Datastore\V1\PropertyReference::class);
$this->property = $var;
return $this;
} | php | {
"resource": ""
} |
q15350 | CommitResponse.setWriteResults | train | public function setWriteResults($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Firestore\V1beta1\WriteResult::class);
$this->write_results = $arr;
return $this;
} | php | {
"resource": ""
} |
q15351 | Agent.handleSnapshot | train | public function handleSnapshot(array $snapshot)
{
if (array_key_exists($snapshot['id'], $this->breakpointsById)) {
$breakpoint = $this->breakpointsById[$snapshot['id']];
$evaluatedExpressions = $snapshot['evaluatedExpressions'];
$stackframes = $snapshot['stackframes'];
$breakpoint->evaluate($evaluatedExpressions, $stackframes, $this->evaluationOptions);
$this->batchRunner->submitItem($this->identifier, [$this->debuggeeId, $breakpoint]);
}
} | php | {
"resource": ""
} |
q15352 | Agent.reportBreakpoints | train | public function reportBreakpoints(array $breakpointsInfo)
{
$client = $this->defaultClient();
foreach ($breakpointsInfo as $breakpointInfo) {
list($debuggeeId, $breakpoint) = $breakpointInfo;
$debuggee = $client->debuggee($debuggeeId);
$backoff = new ExponentialBackoff();
try {
$backoff->execute(function () use ($breakpoint, $debuggee) {
$debuggee->updateBreakpoint($breakpoint);
});
} catch (ServiceException $e) {
// Ignore this error for now
}
}
} | php | {
"resource": ""
} |
q15353 | QuickReplies.setQuickReplies | train | public function setQuickReplies($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->quick_replies = $arr;
return $this;
} | php | {
"resource": ""
} |
q15354 | TraceClient.insertBatch | train | public function insertBatch(array $traces, array $options = [])
{
$spans = [];
foreach ($traces as $trace) {
foreach ($trace->spans() as $span) {
$spans[] = $this->transformSpan($span);
}
}
// throws ServiceException on failure
$this->connection->traceBatchWrite([
'projectsId' => $this->projectId,
'spans' => $spans
] + $options);
return true;
} | php | {
"resource": ""
} |
q15355 | ClusterConfig.setGceClusterConfig | train | public function setGceClusterConfig($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dataproc\V1\GceClusterConfig::class);
$this->gce_cluster_config = $var;
return $this;
} | php | {
"resource": ""
} |
q15356 | ClusterConfig.setMasterConfig | train | public function setMasterConfig($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dataproc\V1\InstanceGroupConfig::class);
$this->master_config = $var;
return $this;
} | php | {
"resource": ""
} |
q15357 | ClusterConfig.setWorkerConfig | train | public function setWorkerConfig($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dataproc\V1\InstanceGroupConfig::class);
$this->worker_config = $var;
return $this;
} | php | {
"resource": ""
} |
q15358 | UpdateJobTriggerRequest.setJobTrigger | train | public function setJobTrigger($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\JobTrigger::class);
$this->job_trigger = $var;
return $this;
} | php | {
"resource": ""
} |
q15359 | LookupResponse.setFound | train | public function setFound($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Datastore\V1\EntityResult::class);
$this->found = $arr;
return $this;
} | php | {
"resource": ""
} |
q15360 | LookupResponse.setMissing | train | public function setMissing($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Datastore\V1\EntityResult::class);
$this->missing = $arr;
return $this;
} | php | {
"resource": ""
} |
q15361 | LookupResponse.setDeferred | train | public function setDeferred($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Datastore\V1\Key::class);
$this->deferred = $arr;
return $this;
} | php | {
"resource": ""
} |
q15362 | CreateReferenceImageRequest.setReferenceImage | train | public function setReferenceImage($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ReferenceImage::class);
$this->reference_image = $var;
return $this;
} | php | {
"resource": ""
} |
q15363 | BatchGetDocumentsResponse.setFound | train | public function setFound($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\Document::class);
$this->writeOneof(1, $var);
return $this;
} | php | {
"resource": ""
} |
q15364 | ExportAssetsRequest.setOutputConfig | train | public function setOutputConfig($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Asset\V1beta1\OutputConfig::class);
$this->output_config = $var;
return $this;
} | php | {
"resource": ""
} |
q15365 | CreateIntentRequest.setIntentView | train | public function setIntentView($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\V2\IntentView::class);
$this->intent_view = $var;
return $this;
} | php | {
"resource": ""
} |
q15366 | DataUtil.isSystemLittleEndian | train | public static function isSystemLittleEndian()
{
if (self::$isLittleEndian === null) {
self::$isLittleEndian = (pack("P", 2) === pack("Q", 2));
}
return self::$isLittleEndian;
} | php | {
"resource": ""
} |
q15367 | DataUtil.intToByteString | train | public static function intToByteString($intValue)
{
if (!self::isSupported()) {
throw new \RuntimeException('This utility is only supported on 64 bit machines with PHP version > 5.5.');
}
if (!is_int($intValue)) {
throw new \InvalidArgumentException(
sprintf(
'Expected argument to be of type int, instead got \'%s\'.',
gettype($intValue)
)
);
}
$bytes = pack("J", $intValue);
return $bytes;
} | php | {
"resource": ""
} |
q15368 | DataUtil.byteStringToInt | train | public static function byteStringToInt($bytes)
{
if (!self::isSupported()) {
throw new \RuntimeException('This utility is only supported on 64 bit machines with PHP version > 5.5.');
}
if (self::isSystemLittleEndian()) {
$bytes = strrev($bytes);
}
return unpack("q", $bytes)[1];
} | php | {
"resource": ""
} |
q15369 | MutateRowRequest.setMutations | train | public function setMutations($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Bigtable\V2\Mutation::class);
$this->mutations = $arr;
return $this;
} | php | {
"resource": ""
} |
q15370 | RequestBuilder.build | train | public function build($resource, $method, array $options = [])
{
$root = $this->resourceRoot;
array_push($root, 'resources');
$root = array_merge($root, explode('.', $resource));
array_push($root, 'methods', $method);
$action = $this->service;
foreach ($root as $rootItem) {
if (!isset($action[$rootItem])) {
throw new \InvalidArgumentException('Provided path item ' . $rootItem . ' does not exist.');
}
$action = $action[$rootItem];
}
$path = [];
$query = [];
$body = [];
if (isset($action['parameters'])) {
foreach ($action['parameters'] as $parameter => $parameterOptions) {
if ($parameterOptions['location'] === 'path' && array_key_exists($parameter, $options)) {
$path[$parameter] = $options[$parameter];
unset($options[$parameter]);
}
if ($parameterOptions['location'] === 'query' && array_key_exists($parameter, $options)) {
$query[$parameter] = $options[$parameter];
}
}
}
if (isset($this->service['parameters'])) {
foreach ($this->service['parameters'] as $parameter => $parameterOptions) {
if ($parameterOptions['location'] === 'query' && array_key_exists($parameter, $options)) {
$query[$parameter] = $options[$parameter];
}
}
}
if (isset($action['request'])) {
$schema = $action['request']['$ref'];
foreach ($this->service['schemas'][$schema]['properties'] as $property => $propertyOptions) {
if (array_key_exists($property, $options)) {
$body[$property] = $options[$property];
}
}
}
$uri = $this->buildUriWithQuery(
$this->expandUri($this->baseUri . $action['path'], $path),
$query
);
return new Request(
$action['httpMethod'],
$uri,
['Content-Type' => 'application/json'],
$body ? $this->jsonEncode($body) : null
);
} | php | {
"resource": ""
} |
q15371 | ListTransferConfigsResponse.setTransferConfigs | train | public function setTransferConfigs($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\BigQuery\DataTransfer\V1\TransferConfig::class);
$this->transfer_configs = $arr;
return $this;
} | php | {
"resource": ""
} |
q15372 | Breakpoint.evaluate | train | public function evaluate(array $evaluatedExpressions, array $stackframes, array $options = [])
{
$this->variableTable->setOptions($options);
$this->addEvaluatedExpressions($evaluatedExpressions);
$this->addStackFrames($stackframes);
$this->finalize();
} | php | {
"resource": ""
} |
q15373 | Breakpoint.finalize | train | public function finalize()
{
list($usec, $sec) = explode(' ', microtime());
$micro = sprintf("%06d", $usec * 1000000);
$when = new \DateTime(date('Y-m-d H:i:s.' . $micro));
$when->setTimezone(new \DateTimeZone('UTC'));
$this->finalTime = $when->format('Y-m-d\TH:i:s.u\Z');
$this->isFinalState = true;
} | php | {
"resource": ""
} |
q15374 | Breakpoint.addStackFrame | train | public function addStackFrame($stackFrameData)
{
$stackFrameData += [
'function' => '',
'locals' => []
];
$sf = new StackFrame(
$stackFrameData['function'],
new SourceLocation($stackFrameData['filename'], $stackFrameData['line'])
);
foreach ($stackFrameData['locals'] as $local) {
if ($this->variableTable->isFull()) {
break;
}
$value = isset($local['value']) ? $local['value'] : null;
$hash = isset($local['id']) ? $local['id'] : null;
try {
$variable = $this->addVariable($local['name'], $value, $hash);
} catch (BufferFullException $e) {
$sf->addLocal($this->variableTable->bufferFullVariable());
break;
}
$sf->addLocal($variable);
}
array_push($this->stackFrames, $sf);
} | php | {
"resource": ""
} |
q15375 | Breakpoint.addEvaluatedExpressions | train | public function addEvaluatedExpressions(array $expressions)
{
foreach ($expressions as $expression => $result) {
try {
$this->evaluatedExpressions[] = $this->addVariable($expression, $result);
} catch (BufferFullException $e) {
$this->evaluatedExpressions[] = $this->variableTable->bufferFullVariable();
}
}
} | php | {
"resource": ""
} |
q15376 | ExamplePayload.setImage | train | public function setImage($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\AutoMl\V1beta1\Image::class);
$this->writeOneof(1, $var);
return $this;
} | php | {
"resource": ""
} |
q15377 | ExamplePayload.setTextSnippet | train | public function setTextSnippet($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\AutoMl\V1beta1\TextSnippet::class);
$this->writeOneof(2, $var);
return $this;
} | php | {
"resource": ""
} |
q15378 | BigtableGapicClient.tableName | train | public static function tableName($project, $instance, $table)
{
return self::getTableNameTemplate()->render([
'project' => $project,
'instance' => $instance,
'table' => $table,
]);
} | php | {
"resource": ""
} |
q15379 | PredictionServiceGapicClient.modelName | train | public static function modelName($project, $location, $model)
{
return self::getModelNameTemplate()->render([
'project' => $project,
'location' => $location,
'model' => $model,
]);
} | php | {
"resource": ""
} |
q15380 | FieldTransform.setSetToServerValue | train | public function setSetToServerValue($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Firestore\V1beta1\DocumentTransform_FieldTransform_ServerValue::class);
$this->writeOneof(2, $var);
return $this;
} | php | {
"resource": ""
} |
q15381 | Timestamp.nanoSeconds | train | public function nanoSeconds()
{
return $this->nanoSeconds === null
? (int) $this->value->format('u') * 1000
: $this->nanoSeconds;
} | php | {
"resource": ""
} |
q15382 | Application.setState | train | public function setState($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Talent\V4beta1\Application_ApplicationState::class);
$this->state = $var;
return $this;
} | php | {
"resource": ""
} |
q15383 | Application.setOutcome | train | public function setOutcome($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Talent\V4beta1\Outcome::class);
$this->outcome = $var;
return $this;
} | php | {
"resource": ""
} |
q15384 | DeviceManagerGapicClient.deviceName | train | public static function deviceName($project, $location, $registry, $device)
{
return self::getDeviceNameTemplate()->render([
'project' => $project,
'location' => $location,
'registry' => $registry,
'device' => $device,
]);
} | php | {
"resource": ""
} |
q15385 | DeviceManagerGapicClient.registryName | train | public static function registryName($project, $location, $registry)
{
return self::getRegistryNameTemplate()->render([
'project' => $project,
'location' => $location,
'registry' => $registry,
]);
} | php | {
"resource": ""
} |
q15386 | RecordCondition.setExpressions | train | public function setExpressions($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\RecordCondition_Expressions::class);
$this->expressions = $var;
return $this;
} | php | {
"resource": ""
} |
q15387 | QueryParameters.setContexts | train | public function setContexts($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\V2\Context::class);
$this->contexts = $arr;
return $this;
} | php | {
"resource": ""
} |
q15388 | QueryParameters.setSessionEntityTypes | train | public function setSessionEntityTypes($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\V2\SessionEntityType::class);
$this->session_entity_types = $arr;
return $this;
} | php | {
"resource": ""
} |
q15389 | QueryParameters.setSentimentAnalysisRequestConfig | train | public function setSentimentAnalysisRequestConfig($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\SentimentAnalysisRequestConfig::class);
$this->sentiment_analysis_request_config = $var;
return $this;
} | php | {
"resource": ""
} |
q15390 | ThreatEntryRemovals.setRawIndices | train | public function setRawIndices($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\WebRisk\V1beta1\RawIndices::class);
$this->raw_indices = $var;
return $this;
} | php | {
"resource": ""
} |
q15391 | ParseResumeResponse.setProfile | train | public function setProfile($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Talent\V4beta1\Profile::class);
$this->profile = $var;
return $this;
} | php | {
"resource": ""
} |
q15392 | InspectDataSourceDetails.setRequestedOptions | train | public function setRequestedOptions($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\InspectDataSourceDetails_RequestedOptions::class);
$this->requested_options = $var;
return $this;
} | php | {
"resource": ""
} |
q15393 | InspectDataSourceDetails.setResult | train | public function setResult($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\InspectDataSourceDetails_Result::class);
$this->result = $var;
return $this;
} | php | {
"resource": ""
} |
q15394 | DatabaseAdminGrpcClient.GetIamPolicy | train | public function GetIamPolicy(\Google\Cloud\Iam\V1\GetIamPolicyRequest $argument,
$metadata = [], $options = []) {
return $this->_simpleRequest('/google.spanner.admin.database.v1.DatabaseAdmin/GetIamPolicy',
$argument,
['\Google\Cloud\Iam\V1\Policy', 'decode'],
$metadata, $options);
} | php | {
"resource": ""
} |
q15395 | ClusterMetrics.setHdfsMetrics | train | public function setHdfsMetrics($var)
{
$arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::INT64);
$this->hdfs_metrics = $arr;
return $this;
} | php | {
"resource": ""
} |
q15396 | ClusterMetrics.setYarnMetrics | train | public function setYarnMetrics($var)
{
$arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::INT64);
$this->yarn_metrics = $arr;
return $this;
} | php | {
"resource": ""
} |
q15397 | KeyManagementServiceGapicClient.cryptoKeyName | train | public static function cryptoKeyName($project, $location, $keyRing, $cryptoKey)
{
return self::getCryptoKeyNameTemplate()->render([
'project' => $project,
'location' => $location,
'key_ring' => $keyRing,
'crypto_key' => $cryptoKey,
]);
} | php | {
"resource": ""
} |
q15398 | KeyManagementServiceGapicClient.cryptoKeyPathName | train | public static function cryptoKeyPathName($project, $location, $keyRing, $cryptoKeyPath)
{
return self::getCryptoKeyPathNameTemplate()->render([
'project' => $project,
'location' => $location,
'key_ring' => $keyRing,
'crypto_key_path' => $cryptoKeyPath,
]);
} | php | {
"resource": ""
} |
q15399 | KeyManagementServiceGapicClient.cryptoKeyVersionName | train | public static function cryptoKeyVersionName($project, $location, $keyRing, $cryptoKey, $cryptoKeyVersion)
{
return self::getCryptoKeyVersionNameTemplate()->render([
'project' => $project,
'location' => $location,
'key_ring' => $keyRing,
'crypto_key' => $cryptoKey,
'crypto_key_version' => $cryptoKeyVersion,
]);
} | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.