_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q16000
RowSet.setRowRanges
train
public function setRowRanges($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Bigtable\V2\RowRange::class); $this->row_ranges = $arr; return $this; }
php
{ "resource": "" }
q16001
ClusterConfig.setSecondaryWorkerConfig
train
public function setSecondaryWorkerConfig($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dataproc\V1beta2\InstanceGroupConfig::class); $this->secondary_worker_config = $var; return $this; }
php
{ "resource": "" }
q16002
ClusterConfig.setSoftwareConfig
train
public function setSoftwareConfig($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dataproc\V1beta2\SoftwareConfig::class); $this->software_config = $var; return $this; }
php
{ "resource": "" }
q16003
ClusterConfig.setLifecycleConfig
train
public function setLifecycleConfig($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dataproc\V1beta2\LifecycleConfig::class); $this->lifecycle_config = $var; return $this; }
php
{ "resource": "" }
q16004
ClusterConfig.setEncryptionConfig
train
public function setEncryptionConfig($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dataproc\V1beta2\EncryptionConfig::class); $this->encryption_config = $var; return $this; }
php
{ "resource": "" }
q16005
TransactionOptions.setPartitionedDml
train
public function setPartitionedDml($var) { GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\TransactionOptions_PartitionedDml::class); $this->writeOneof(3, $var); return $this; }
php
{ "resource": "" }
q16006
Document.setType
train
public function setType($var) { GPBUtil::checkEnum($var, \Google\Cloud\Language\V1beta2\Document_Type::class); $this->type = $var; return $this; }
php
{ "resource": "" }
q16007
InputConfig.setGcsSource
train
public function setGcsSource($var) { GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\GcsSource::class); $this->gcs_source = $var; return $this; }
php
{ "resource": "" }
q16008
UpdateCompanyRequest.setCompany
train
public function setCompany($var) { GPBUtil::checkMessage($var, \Google\Cloud\Talent\V4beta1\Company::class); $this->company = $var; return $this; }
php
{ "resource": "" }
q16009
PublicKeyCredential.setFormat
train
public function setFormat($var) { GPBUtil::checkEnum($var, \Google\Cloud\Iot\V1\PublicKeyFormat::class); $this->format = $var; return $this; }
php
{ "resource": "" }
q16010
ListAssetsResponse.setListAssetsResults
train
public function setListAssetsResults($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\SecurityCenter\V1\ListAssetsResponse\ListAssetsResult::class); $this->list_assets_results = $arr; return $this; }
php
{ "resource": "" }
q16011
ListTransferLogsResponse.setTransferMessages
train
public function setTransferMessages($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\BigQuery\DataTransfer\V1\TransferMessage::class); $this->transfer_messages = $arr; return $this; }
php
{ "resource": "" }
q16012
StructuredQuery.setSelect
train
public function setSelect($var) { GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1beta1\StructuredQuery_Projection::class); $this->select = $var; return $this; }
php
{ "resource": "" }
q16013
StructuredQuery.setEndAt
train
public function setEndAt($var) { GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1beta1\Cursor::class); $this->end_at = $var; return $this; }
php
{ "resource": "" }
q16014
StreamingPullRequest.setModifyDeadlineAckIds
train
public function setModifyDeadlineAckIds($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); $this->modify_deadline_ack_ids = $arr; return $this; }
php
{ "resource": "" }
q16015
OperationMetadata.setCreateModelDetails
train
public function setCreateModelDetails($var) { GPBUtil::checkMessage($var, \Google\Cloud\AutoMl\V1beta1\CreateModelOperationMetadata::class); $this->writeOneof(10, $var); return $this; }
php
{ "resource": "" }
q16016
OperationMetadata.setPartialFailures
train
public function setPartialFailures($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Rpc\Status::class); $this->partial_failures = $arr; return $this; }
php
{ "resource": "" }
q16017
AbortedException.getRetryDelay
train
public function getRetryDelay() { $metadata = array_filter($this->metadata, function ($metadataItem) { return array_key_exists('retryDelay', $metadataItem); }); if (count($metadata) === 0) { return ['seconds' => 0, 'nanos' => 0]; } return $metadata[0]['retryDelay'] + [ 'seconds' => 0, 'nanos' => 0 ]; }
php
{ "resource": "" }
q16018
Word.setSymbols
train
public function setSymbols($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\Symbol::class); $this->symbols = $arr; return $this; }
php
{ "resource": "" }
q16019
NumericalStatsResult.setMinValue
train
public function setMinValue($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\Value::class); $this->min_value = $var; return $this; }
php
{ "resource": "" }
q16020
NumericalStatsResult.setMaxValue
train
public function setMaxValue($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\Value::class); $this->max_value = $var; return $this; }
php
{ "resource": "" }
q16021
NumericalStatsResult.setQuantileValues
train
public function setQuantileValues($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dlp\V2\Value::class); $this->quantile_values = $arr; return $this; }
php
{ "resource": "" }
q16022
LDiversityConfig.setSensitiveAttribute
train
public function setSensitiveAttribute($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\FieldId::class); $this->sensitive_attribute = $var; return $this; }
php
{ "resource": "" }
q16023
HotwordRule.setHotwordRegex
train
public function setHotwordRegex($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\CustomInfoType_Regex::class); $this->hotword_regex = $var; return $this; }
php
{ "resource": "" }
q16024
HotwordRule.setLikelihoodAdjustment
train
public function setLikelihoodAdjustment($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\CustomInfoType_DetectionRule_LikelihoodAdjustment::class); $this->likelihood_adjustment = $var; return $this; }
php
{ "resource": "" }
q16025
Company.setSize
train
public function setSize($var) { GPBUtil::checkEnum($var, \Google\Cloud\Talent\V4beta1\CompanySize::class); $this->size = $var; return $this; }
php
{ "resource": "" }
q16026
Job.queryResults
train
public function queryResults(array $options = []) { $timeoutMs = $this->pluck('initialTimeoutMs', $options, false) ?: 0; $queryResultsOptions = $options; $options['timeoutMs'] = $timeoutMs; return new QueryResults( $this->connection, $this->identity['jobId'], $this->identity['projectId'], $this->connection->getQueryResults($options + $this->identity), $this->mapper, $this, $queryResultsOptions ); }
php
{ "resource": "" }
q16027
Job.reload
train
public function reload(array $options = []) { return $this->info = $this->connection->getJob($options + $this->identity); }
php
{ "resource": "" }
q16028
PartitionQueryRequest.setPartitionOptions
train
public function setPartitionOptions($var) { GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\PartitionOptions::class); $this->partition_options = $var; return $this; }
php
{ "resource": "" }
q16029
RowFilter.setChain
train
public function setChain($var) { GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\RowFilter_Chain::class); $this->writeOneof(1, $var); return $this; }
php
{ "resource": "" }
q16030
RowFilter.setInterleave
train
public function setInterleave($var) { GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\RowFilter_Interleave::class); $this->writeOneof(2, $var); return $this; }
php
{ "resource": "" }
q16031
RowFilter.setCondition
train
public function setCondition($var) { GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\RowFilter_Condition::class); $this->writeOneof(3, $var); return $this; }
php
{ "resource": "" }
q16032
RowFilter.setColumnRangeFilter
train
public function setColumnRangeFilter($var) { GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\ColumnRange::class); $this->writeOneof(7, $var); return $this; }
php
{ "resource": "" }
q16033
RowFilter.setTimestampRangeFilter
train
public function setTimestampRangeFilter($var) { GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\TimestampRange::class); $this->writeOneof(8, $var); return $this; }
php
{ "resource": "" }
q16034
RowFilter.setValueRangeFilter
train
public function setValueRangeFilter($var) { GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\ValueRange::class); $this->writeOneof(15, $var); return $this; }
php
{ "resource": "" }
q16035
EncryptionTrait.formatEncryptionHeaders
train
public function formatEncryptionHeaders(array $options) { $encryptionHeaders = []; $useCopySourceHeaders = isset($options['useCopySourceHeaders']) ? $options['useCopySourceHeaders'] : false; $key = isset($options['encryptionKey']) ? $options['encryptionKey'] : null; $keySHA256 = isset($options['encryptionKeySHA256']) ? $options['encryptionKeySHA256'] : null; $destinationKey = isset($options['destinationEncryptionKey']) ? $options['destinationEncryptionKey'] : null; $destinationKeySHA256 = isset($options['destinationEncryptionKeySHA256']) ? $options['destinationEncryptionKeySHA256'] : null; unset($options['useCopySourceHeaders']); unset($options['encryptionKey']); unset($options['encryptionKeySHA256']); unset($options['destinationEncryptionKey']); unset($options['destinationEncryptionKeySHA256']); $encryptionHeaders = $this->buildHeaders($key, $keySHA256, $useCopySourceHeaders) + $this->buildHeaders($destinationKey, $destinationKeySHA256, false); if (!empty($encryptionHeaders)) { if (isset($options['restOptions']['headers'])) { $options['restOptions']['headers'] += $encryptionHeaders; } else { $options['restOptions']['headers'] = $encryptionHeaders; } } return $options; }
php
{ "resource": "" }
q16036
EncryptionTrait.buildHeaders
train
private function buildHeaders($key, $keySHA256, $useCopySourceHeaders) { if ($key) { $headerNames = $useCopySourceHeaders ? $this->copySourceEncryptionHeaderNames : $this->encryptionHeaderNames; if (!$keySHA256) { $decodedKey = base64_decode($key); $keySHA256 = base64_encode(hash('SHA256', $decodedKey, true)); } return [ $headerNames['algorithm'] => 'AES256', $headerNames['key'] => $key, $headerNames['keySHA256'] => $keySHA256 ]; } return []; }
php
{ "resource": "" }
q16037
EncryptionTrait.signString
train
protected function signString($privateKey, $data, $forceOpenssl = false) { $signature = ''; if (class_exists(RSA::class) && !$forceOpenssl) { $rsa = new RSA; $rsa->loadKey($privateKey); $rsa->setSignatureMode(RSA::SIGNATURE_PKCS1); $rsa->setHash('sha256'); $signature = $rsa->sign($data); } elseif (extension_loaded('openssl')) { openssl_sign($data, $signature, $privateKey, 'sha256WithRSAEncryption'); } else { // @codeCoverageIgnoreStart throw new \RuntimeException('OpenSSL is not installed.'); } // @codeCoverageIgnoreEnd return $signature; }
php
{ "resource": "" }
q16038
MqttConfig.setMqttEnabledState
train
public function setMqttEnabledState($var) { GPBUtil::checkEnum($var, \Google\Cloud\Iot\V1\MqttState::class); $this->mqtt_enabled_state = $var; return $this; }
php
{ "resource": "" }
q16039
ErrorEvent.setServiceContext
train
public function setServiceContext($var) { GPBUtil::checkMessage($var, \Google\Cloud\ErrorReporting\V1beta1\ServiceContext::class); $this->service_context = $var; return $this; }
php
{ "resource": "" }
q16040
ErrorEvent.setContext
train
public function setContext($var) { GPBUtil::checkMessage($var, \Google\Cloud\ErrorReporting\V1beta1\ErrorContext::class); $this->context = $var; return $this; }
php
{ "resource": "" }
q16041
Token.setText
train
public function setText($var) { GPBUtil::checkMessage($var, \Google\Cloud\Language\V1\TextSpan::class); $this->text = $var; return $this; }
php
{ "resource": "" }
q16042
Token.setPartOfSpeech
train
public function setPartOfSpeech($var) { GPBUtil::checkMessage($var, \Google\Cloud\Language\V1\PartOfSpeech::class); $this->part_of_speech = $var; return $this; }
php
{ "resource": "" }
q16043
Token.setDependencyEdge
train
public function setDependencyEdge($var) { GPBUtil::checkMessage($var, \Google\Cloud\Language\V1\DependencyEdge::class); $this->dependency_edge = $var; return $this; }
php
{ "resource": "" }
q16044
TimeTrait.parseTimeString
train
private function parseTimeString($timestamp) { $nanoRegex = '/\d{4}-\d{1,2}-\d{1,2}T\d{1,2}\:\d{1,2}\:\d{1,2}(?:\.(\d{1,}))?/'; preg_match($nanoRegex, $timestamp, $matches); $subSeconds = isset($matches[1]) ? $matches[1] : '0'; if (strlen($subSeconds) > 6) { $timestamp = str_replace('.'. $subSeconds, '.' . substr($subSeconds, 0, 6), $timestamp); } $dt = new \DateTimeImmutable($timestamp); if (!$dt) { throw new \InvalidArgumentException(sprintf( 'Could not create a DateTime instance from given timestamp %s.', $timestamp )); } $nanos = (int) str_pad($subSeconds, 9, '0', STR_PAD_RIGHT); return [$dt, $nanos]; }
php
{ "resource": "" }
q16045
TimeTrait.formatTimeAsString
train
private function formatTimeAsString(\DateTimeInterface $dateTime, $ns) { $dateTime = $dateTime->setTimeZone(new \DateTimeZone('UTC')); if ($ns === null) { return $dateTime->format(Timestamp::FORMAT); } else { $ns = (string) $ns; $ns = str_pad($ns, 9, '0', STR_PAD_LEFT); if (substr($ns, 6, 3) === '000') { $ns = substr($ns, 0, 6); } return sprintf( $dateTime->format(Timestamp::FORMAT_INTERPOLATE), $ns ); } }
php
{ "resource": "" }
q16046
UpdateTenantRequest.setTenant
train
public function setTenant($var) { GPBUtil::checkMessage($var, \Google\Cloud\Talent\V4beta1\Tenant::class); $this->tenant = $var; return $this; }
php
{ "resource": "" }
q16047
StatusMessage.fromJson
train
public static function fromJson(array $data) { if (!$data) { return null; } $data += [ 'isError' => false, 'refersTo' => null, 'description' => null ]; return new static($data['isError'], $data['refersTo'], FormatMessage::fromJson($data['description'])); }
php
{ "resource": "" }
q16048
StorageClient.buckets
train
public function buckets(array $options = []) { if (!$this->projectId) { throw new GoogleException( 'No project ID was provided, ' . 'and we were unable to detect a default project ID.' ); } $resultLimit = $this->pluck('resultLimit', $options, false); $bucketUserProject = $this->pluck('bucketUserProject', $options, false); $bucketUserProject = !is_null($bucketUserProject) ? $bucketUserProject : true; $userProject = (isset($options['userProject']) && $bucketUserProject) ? $options['userProject'] : null; return new ItemIterator( new PageIterator( function (array $bucket) use ($userProject) { return new Bucket( $this->connection, $bucket['name'], $bucket + ['requesterProjectId' => $userProject] ); }, [$this->connection, 'listBuckets'], $options + ['project' => $this->projectId], ['resultLimit' => $resultLimit] ) ); }
php
{ "resource": "" }
q16049
StorageClient.signedUrlUploader
train
public function signedUrlUploader($uri, $data, array $options = []) { return new SignedUrlUploader($this->connection->requestWrapper(), $data, $uri, $options); }
php
{ "resource": "" }
q16050
ListTopicsResponse.setTopics
train
public function setTopics($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\PubSub\V1\Topic::class); $this->topics = $arr; return $this; }
php
{ "resource": "" }
q16051
WorkflowGraph.setNodes
train
public function setNodes($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dataproc\V1beta2\WorkflowNode::class); $this->nodes = $arr; return $this; }
php
{ "resource": "" }
q16052
ParameterValidation.setRegex
train
public function setRegex($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dataproc\V1beta2\RegexValidation::class); $this->writeOneof(1, $var); return $this; }
php
{ "resource": "" }
q16053
ParameterValidation.setValues
train
public function setValues($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dataproc\V1beta2\ValueValidation::class); $this->writeOneof(2, $var); return $this; }
php
{ "resource": "" }
q16054
LROTrait.setLroProperties
train
private function setLroProperties( LongRunningConnectionInterface $lroConnection, array $lroCallables, $resource = null ) { $this->lroConnection = $lroConnection; $this->lroCallables = $lroCallables; $this->lroResource = $resource; }
php
{ "resource": "" }
q16055
LROTrait.resumeOperation
train
public function resumeOperation($operationName, array $info = []) { return new LongRunningOperation( $this->lroConnection, $operationName, $this->lroCallables, $info ); }
php
{ "resource": "" }
q16056
LROTrait.longRunningOperations
train
public function longRunningOperations(array $options = []) { if (is_null($this->lroResource)) { throw new \BadMethodCallException('This service does list support listing operations.'); } $resultLimit = $this->pluck('resultLimit', $options, false) ?: 0; $options['name'] = $this->lroResource .'/operations'; return new ItemIterator( new PageIterator( function (array $operation) { return $this->resumeOperation($operation['name'], $operation); }, [$this->lroConnection, 'operations'], $options, [ 'itemsKey' => 'operations', 'resultLimit' => $resultLimit ] ) ); }
php
{ "resource": "" }
q16057
ListDevicesResponse.setDevices
train
public function setDevices($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Iot\V1\Device::class); $this->devices = $arr; return $this; }
php
{ "resource": "" }
q16058
ErrorGroup.setTrackingIssues
train
public function setTrackingIssues($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\ErrorReporting\V1beta1\TrackingIssue::class); $this->tracking_issues = $arr; return $this; }
php
{ "resource": "" }
q16059
Annotation.filter
train
private function filter($items, $path, $type) { if (!$items) { return null; } return array_filter($items, function ($item) use ($path, $type) { $itemCopy = $item; // key into the value with the given path foreach ($path as $key) { $itemCopy = $itemCopy[$key]; } if (strtolower($itemCopy) === strtolower($type)) { return $item; } }); }
php
{ "resource": "" }
q16060
ListTransferRunsResponse.setTransferRuns
train
public function setTransferRuns($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\BigQuery\DataTransfer\V1\TransferRun::class); $this->transfer_runs = $arr; return $this; }
php
{ "resource": "" }
q16061
SourceContext.setCloudRepo
train
public function setCloudRepo($var) { GPBUtil::checkMessage($var, \Google\Cloud\DevTools\Source\V1\CloudRepoSourceContext::class); $this->writeOneof(1, $var); return $this; }
php
{ "resource": "" }
q16062
SourceContext.setCloudWorkspace
train
public function setCloudWorkspace($var) { GPBUtil::checkMessage($var, \Google\Cloud\DevTools\Source\V1\CloudWorkspaceSourceContext::class); $this->writeOneof(2, $var); return $this; }
php
{ "resource": "" }
q16063
SourceContext.setGerrit
train
public function setGerrit($var) { GPBUtil::checkMessage($var, \Google\Cloud\DevTools\Source\V1\GerritSourceContext::class); $this->writeOneof(3, $var); return $this; }
php
{ "resource": "" }
q16064
UpdateSshPublicKeyRequest.setSshPublicKey
train
public function setSshPublicKey($var) { GPBUtil::checkMessage($var, \Google\Cloud\OsLogin\Common\SshPublicKey::class); $this->ssh_public_key = $var; return $this; }
php
{ "resource": "" }
q16065
Value.setMapValue
train
public function setMapValue($var) { GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1beta1\MapValue::class); $this->writeOneof(6, $var); return $this; }
php
{ "resource": "" }
q16066
JobControllerGapicClient.getJob
train
public function getJob($projectId, $region, $jobId, array $optionalArgs = []) { $request = new GetJobRequest(); $request->setProjectId($projectId); $request->setRegion($region); $request->setJobId($jobId); return $this->startCall( 'GetJob', Job::class, $optionalArgs, $request )->wait(); }
php
{ "resource": "" }
q16067
JobControllerGapicClient.updateJob
train
public function updateJob($projectId, $region, $jobId, $job, $updateMask, array $optionalArgs = []) { $request = new UpdateJobRequest(); $request->setProjectId($projectId); $request->setRegion($region); $request->setJobId($jobId); $request->setJob($job); $request->setUpdateMask($updateMask); return $this->startCall( 'UpdateJob', Job::class, $optionalArgs, $request )->wait(); }
php
{ "resource": "" }
q16068
DlpServiceGrpcClient.ActivateJobTrigger
train
public function ActivateJobTrigger(\Google\Cloud\Dlp\V2\ActivateJobTriggerRequest $argument, $metadata = [], $options = []) { return $this->_simpleRequest('/google.privacy.dlp.v2.DlpService/ActivateJobTrigger', $argument, ['\Google\Cloud\Dlp\V2\DlpJob', 'decode'], $metadata, $options); }
php
{ "resource": "" }
q16069
LabelAnnotation.setEntity
train
public function setEntity($var) { GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1\Entity::class); $this->entity = $var; return $this; }
php
{ "resource": "" }
q16070
LabelAnnotation.setFrames
train
public function setFrames($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1\LabelFrame::class); $this->frames = $arr; return $this; }
php
{ "resource": "" }
q16071
Asset.setResource
train
public function setResource($var) { GPBUtil::checkMessage($var, \Google\Cloud\Asset\V1beta1\Resource::class); $this->resource = $var; return $this; }
php
{ "resource": "" }
q16072
Asset.setIamPolicy
train
public function setIamPolicy($var) { GPBUtil::checkMessage($var, \Google\Cloud\Iam\V1\Policy::class); $this->iam_policy = $var; return $this; }
php
{ "resource": "" }
q16073
SourceLocationResolver.resolve
train
public function resolve(SourceLocation $location) { $origPath = str_replace('/', DIRECTORY_SEPARATOR, $location->path()); $basename = basename($origPath); $prefixes = $this->searchPrefixes($origPath); $includePaths = array_filter($this->includePaths, function ($path) { return file_exists($path); }); // Phase 1: search for an exact file match and try stripping off extra // folders foreach ($prefixes as $prefix) { foreach ($includePaths as $path) { $file = implode(DIRECTORY_SEPARATOR, [$path, $prefix, $basename]); if (file_exists($file)) { return new SourceLocation($this->realRelativePath($file, $path), $location->line()); } } } // Phase 2: recursively search folders for a matching file foreach ($includePaths as $includePath) { $iterator = new MatchingFileIterator( $includePath, $origPath ); foreach ($iterator as $file => $info) { return new SourceLocation($this->realRelativePath($file, $includePath), $location->line()); } } return null; }
php
{ "resource": "" }
q16074
SourceLocationResolver.searchPrefixes
train
private function searchPrefixes($path) { $dirname = dirname($path); $directoryParts = explode(DIRECTORY_SEPARATOR, $dirname); $directories = []; while ($directoryParts) { $directories[] = implode(DIRECTORY_SEPARATOR, $directoryParts); array_shift($directoryParts); } return $directories; }
php
{ "resource": "" }
q16075
ListDatasetsResponse.setDatasets
train
public function setDatasets($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\AutoMl\V1beta1\Dataset::class); $this->datasets = $arr; return $this; }
php
{ "resource": "" }
q16076
Point.setValue
train
public function setValue($var) { GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\TypedValue::class); $this->value = $var; return $this; }
php
{ "resource": "" }
q16077
FieldPath.fromString
train
public static function fromString($path, $splitPath = true) { self::validateString($path); $parts = $splitPath ? explode('.', $path) : [$path]; return new self($parts); }
php
{ "resource": "" }
q16078
FieldPath.pathString
train
public function pathString() { $out = []; foreach ($this->fieldNames as $part) { $out[] = $this->escapePathPart($part); } $fieldPath = implode('.', $out); return $fieldPath; }
php
{ "resource": "" }
q16079
VisionClient.annotate
train
public function annotate(Image $image, array $options = []) { $res = $this->annotateBatch([$image], $options); return $res[0]; }
php
{ "resource": "" }
q16080
VisionClient.annotateBatch
train
public function annotateBatch(array $images, array $options = []) { $this->validateBatch($images, Image::class); $requests = []; foreach ($images as $image) { $requests[] = $image->requestObject(); } $res = $this->connection->annotate([ 'requests' => $requests ] + $options); $annotations = []; if (isset($res['responses'])) { foreach ($res['responses'] as $response) { $annotations[] = new Annotation($response); } } return $annotations; }
php
{ "resource": "" }
q16081
Row.setExampleCount
train
public function setExampleCount($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); $this->example_count = $arr; return $this; }
php
{ "resource": "" }
q16082
BigQueryOptions.setIdentifyingFields
train
public function setIdentifyingFields($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dlp\V2\FieldId::class); $this->identifying_fields = $arr; return $this; }
php
{ "resource": "" }
q16083
BigQueryOptions.setExcludedFields
train
public function setExcludedFields($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dlp\V2\FieldId::class); $this->excluded_fields = $arr; return $this; }
php
{ "resource": "" }
q16084
TransactionTrait.lookupBatch
train
public function lookupBatch(array $keys, array $options = []) { return $this->operation->lookup($keys, $options + [ 'transaction' => $this->transactionId ]); }
php
{ "resource": "" }
q16085
TransactionTrait.runQuery
train
public function runQuery(QueryInterface $query, array $options = []) { return $this->operation->runQuery($query, $options + [ 'transaction' => $this->transactionId ]); }
php
{ "resource": "" }
q16086
EntityAnnotation.setLocations
train
public function setLocations($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\LocationInfo::class); $this->locations = $arr; return $this; }
php
{ "resource": "" }
q16087
UpdateSnapshotRequest.setSnapshot
train
public function setSnapshot($var) { GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\Snapshot::class); $this->snapshot = $var; return $this; }
php
{ "resource": "" }
q16088
EntityTrait.getProperty
train
public function getProperty($property) { return isset($this->entity[$property]) ? $this->entity[$property] : null; }
php
{ "resource": "" }
q16089
ListTablesRequest.setView
train
public function setView($var) { GPBUtil::checkEnum($var, \Google\Cloud\Bigtable\Admin\V2\Table_View::class); $this->view = $var; return $this; }
php
{ "resource": "" }
q16090
ListFindingsResponse.setListFindingsResults
train
public function setListFindingsResults($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\SecurityCenter\V1\ListFindingsResponse\ListFindingsResult::class); $this->list_findings_results = $arr; return $this; }
php
{ "resource": "" }
q16091
Button.setOpenUriAction
train
public function setOpenUriAction($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\Intent_Message_BasicCard_Button_OpenUriAction::class); $this->open_uri_action = $var; return $this; }
php
{ "resource": "" }
q16092
Field.setIndexConfig
train
public function setIndexConfig($var) { GPBUtil::checkMessage($var, \Google\Cloud\Firestore\Admin\V1\Field_IndexConfig::class); $this->index_config = $var; return $this; }
php
{ "resource": "" }
q16093
Constraints.setSupportedCompressions
train
public function setSupportedCompressions($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\WebRisk\V1beta1\CompressionType::class); $this->supported_compressions = $arr; return $this; }
php
{ "resource": "" }
q16094
Variable.fromJson
train
public static function fromJson(array $data) { if (array_key_exists('members', $data)) { $data['members'] = array_map([static::class, 'fromJson'], $data['members']); } if (array_key_exists('status', $data)) { $data['status'] = StatusMessage::fromJson($data['status']); } return new static($data['name'], $data['type'], $data); }
php
{ "resource": "" }
q16095
Variable.byteSize
train
public function byteSize() { return mb_strlen($this->name) + mb_strlen($this->type) + mb_strlen($this->value); }
php
{ "resource": "" }
q16096
Variable.fullByteSize
train
public function fullByteSize() { $size = $this->byteSize(); foreach ($this->members as $variable) { $size += $variable->fullByteSize(); } return $size; }
php
{ "resource": "" }
q16097
JobWaitTrait.wait
train
private function wait( callable $isCompleteFn, callable $reloadFn, Job $job, $maxRetries ) { if (!$isCompleteFn()) { if ($maxRetries === null) { $maxRetries = Job::MAX_RETRIES; } $retryFn = function () use ($isCompleteFn, $reloadFn, $job) { $reloadFn(); if (!$isCompleteFn()) { throw new JobException('Job did not complete within the allowed number of retries.', $job); } }; (new ExponentialBackoff($maxRetries)) ->execute($retryFn); } }
php
{ "resource": "" }
q16098
FormatMessage.setParameters
train
public function setParameters($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); $this->parameters = $arr; return $this; }
php
{ "resource": "" }
q16099
CheckAndMutateRowRequest.setPredicateFilter
train
public function setPredicateFilter($var) { GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\RowFilter::class); $this->predicate_filter = $var; return $this; }
php
{ "resource": "" }