_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
33
8k
language
stringclasses
1 value
meta_information
dict
q15700
JobConfigurationTrait.jobConfigurationProperties
train
public function jobConfigurationProperties( $projectId, array $config, $location ) { $this->config = array_replace_recursive([ 'projectId' => $projectId, 'jobReference' => ['projectId' => $projectId] ], $config); if ($location && !isset($this-...
php
{ "resource": "" }
q15701
JobConfigurationTrait.toArray
train
public function toArray() { if ($this->jobIdPrefix) { $this->config['jobReference']['jobId'] = sprintf( '%s-%s', $this->jobIdPrefix,
php
{ "resource": "" }
q15702
TransactionalReadTrait.singleUseState
train
private function singleUseState() { if ($this->type === self::TYPE_SINGLE_USE) { if ($this->state === self::STATE_SINGLE_USE_USED) { throw new \BadMethodCallException('This single-use transaction has already been used.'); }
php
{ "resource": "" }
q15703
TransactionalReadTrait.checkReadContext
train
private function checkReadContext() { if ($this->type === self::TYPE_SINGLE_USE && $this->context === SessionPoolInterface::CONTEXT_READWRITE) {
php
{ "resource": "" }
q15704
CloudWorkspaceSourceContext.setWorkspaceId
train
public function setWorkspaceId($var) { GPBUtil::checkMessage($var, \Google\Cloud\DevTools\Source\V1\CloudWorkspaceId::class);
php
{ "resource": "" }
q15705
SessionEntityType.setEntityOverrideMode
train
public function setEntityOverrideMode($var) { GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\V2\SessionEntityType_EntityOverrideMode::class);
php
{ "resource": "" }
q15706
Image.requestObject
train
public function requestObject($encode = true) { return array_filter([ 'image' => $this->imageObject($encode), 'features' => $this->features,
php
{ "resource": "" }
q15707
Image.imageObject
train
private function imageObject($encode) { if ($this->type === self::TYPE_BYTES) { $bytes = (string) $this->image; return [ 'content' => ($encode) ? base64_encode($bytes) : $bytes ]; } if ($this->type === self::TYPE_STRING) { $st...
php
{ "resource": "" }
q15708
Image.normalizeFeatures
train
private function normalizeFeatures(array $features) { $result = []; foreach ($features as $key => $feature) { $maxResults = $this->maxResult($feature); if (array_key_exists($feature, $this->featureShortNames)) { $feature = $this->featureShortNames[$feature];...
php
{ "resource": "" }
q15709
Image.maxResult
train
private function maxResult($feature) { return (isset($this->options['maxResults'][$feature]))
php
{ "resource": "" }
q15710
ProductSearchParams.setProductCategories
train
public function setProductCategories($var) { $arr = GPBUtil::checkRepeatedField($var,
php
{ "resource": "" }
q15711
InstanceConfiguration.reload
train
public function reload(array $options = []) { $this->info = $this->connection->getInstanceConfig($options + [ 'name' => $this->name,
php
{ "resource": "" }
q15712
InstanceConfiguration.fullyQualifiedConfigName
train
private function fullyQualifiedConfigName($name, $projectId) { try { return InstanceAdminClient::instanceConfigName( $projectId, $name
php
{ "resource": "" }
q15713
AsyncBatchAnnotateFilesRequest.setRequests
train
public function setRequests($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE,
php
{ "resource": "" }
q15714
ListNotificationChannelDescriptorsResponse.setChannelDescriptors
train
public function setChannelDescriptors($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE,
php
{ "resource": "" }
q15715
Topic.reload
train
public function reload(array $options = []) { return $this->info = $this->connection->getTopic($options + [
php
{ "resource": "" }
q15716
Topic.publishBatch
train
public function publishBatch(array $messages, array $options = []) { foreach ($messages as &$message) { $message = $this->formatMessage($message); }
php
{ "resource": "" }
q15717
Topic.subscribe
train
public function subscribe($name, array $options = []) { $subscription = $this->subscriptionFactory($name);
php
{ "resource": "" }
q15718
Topic.subscriptions
train
public function subscriptions(array $options = []) { $resultLimit = $this->pluck('resultLimit', $options, false); return new ItemIterator( new PageIterator( function ($subscription) {
php
{ "resource": "" }
q15719
Topic.iam
train
public function iam() { if (!$this->iam) { $iamConnection = new IamTopic($this->connection);
php
{ "resource": "" }
q15720
Topic.formatMessage
train
private function formatMessage(array $message) { if (isset($message['data']) && $this->encode) { $message['data'] = base64_encode($message['data']); } if (!array_key_exists('data', $message) &&
php
{ "resource": "" }
q15721
Topic.subscriptionFactory
train
private function subscriptionFactory($name, array $info = []) { return new Subscription( $this->connection, $this->projectId, $name,
php
{ "resource": "" }
q15722
Expressions.setLogicalOperator
train
public function setLogicalOperator($var) { GPBUtil::checkEnum($var, \Google\Cloud\Dlp\V2\RecordCondition_Expressions_LogicalOperator::class);
php
{ "resource": "" }
q15723
CreateSessionRequest.setSession
train
public function setSession($var) { GPBUtil::checkMessage($var,
php
{ "resource": "" }
q15724
BatchGetAssetsHistoryRequest.setReadTimeWindow
train
public function setReadTimeWindow($var) { GPBUtil::checkMessage($var, \Google\Cloud\Asset\V1beta1\TimeWindow::class);
php
{ "resource": "" }
q15725
VideoContext.setShotChangeDetectionConfig
train
public function setShotChangeDetectionConfig($var) { GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1\ShotChangeDetectionConfig::class);
php
{ "resource": "" }
q15726
VideoContext.setExplicitContentDetectionConfig
train
public function setExplicitContentDetectionConfig($var) { GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1\ExplicitContentDetectionConfig::class);
php
{ "resource": "" }
q15727
VideoContext.setSpeechTranscriptionConfig
train
public function setSpeechTranscriptionConfig($var) { GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1\SpeechTranscriptionConfig::class);
php
{ "resource": "" }
q15728
VideoContext.setTextDetectionConfig
train
public function setTextDetectionConfig($var) { GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1\TextDetectionConfig::class);
php
{ "resource": "" }
q15729
DlpJob.setState
train
public function setState($var) { GPBUtil::checkEnum($var,
php
{ "resource": "" }
q15730
DlpJob.setRiskDetails
train
public function setRiskDetails($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\AnalyzeDataSourceRiskDetails::class);
php
{ "resource": "" }
q15731
DlpJob.setInspectDetails
train
public function setInspectDetails($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\InspectDataSourceDetails::class);
php
{ "resource": "" }
q15732
Page.setBlocks
train
public function setBlocks($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE,
php
{ "resource": "" }
q15733
TrainingPhrase.setType
train
public function setType($var) { GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\V2\Intent_TrainingPhrase_Type::class);
php
{ "resource": "" }
q15734
SetLabelsRequest.setResourceLabels
train
public function setResourceLabels($var) { $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING,
php
{ "resource": "" }
q15735
SearchAgentsResponse.setAgents
train
public function setAgents($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE,
php
{ "resource": "" }
q15736
BatchGetDocumentsRequest.setNewTransaction
train
public function setNewTransaction($var) { GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1beta1\TransactionOptions::class);
php
{ "resource": "" }
q15737
Skill.setLevel
train
public function setLevel($var) { GPBUtil::checkEnum($var, \Google\Cloud\Talent\V4beta1\SkillProficiencyLevel::class);
php
{ "resource": "" }
q15738
ErrorGroupStats.setGroup
train
public function setGroup($var) { GPBUtil::checkMessage($var, \Google\Cloud\ErrorReporting\V1beta1\ErrorGroup::class);
php
{ "resource": "" }
q15739
ErrorGroupStats.setAffectedServices
train
public function setAffectedServices($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE,
php
{ "resource": "" }
q15740
ErrorGroupStats.setRepresentative
train
public function setRepresentative($var) { GPBUtil::checkMessage($var, \Google\Cloud\ErrorReporting\V1beta1\ErrorEvent::class);
php
{ "resource": "" }
q15741
QuoteInfo.setDateTime
train
public function setDateTime($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\DateTime::class);
php
{ "resource": "" }
q15742
ListCryptoKeyVersionsRequest.setView
train
public function setView($var) { GPBUtil::checkEnum($var, \Google\Cloud\Kms\V1\CryptoKeyVersion_Crypto
php
{ "resource": "" }
q15743
Model.setImageClassificationModelMetadata
train
public function setImageClassificationModelMetadata($var) { GPBUtil::checkMessage($var,
php
{ "resource": "" }
q15744
Model.setTextClassificationModelMetadata
train
public function setTextClassificationModelMetadata($var) { GPBUtil::checkMessage($var,
php
{ "resource": "" }
q15745
Model.setTranslationModelMetadata
train
public function setTranslationModelMetadata($var) { GPBUtil::checkMessage($var,
php
{ "resource": "" }
q15746
Model.setDeploymentState
train
public function setDeploymentState($var) { GPBUtil::checkEnum($var, \Google\Cloud\AutoMl\V1beta1\Model_DeploymentState::class);
php
{ "resource": "" }
q15747
ListDeidentifyTemplatesResponse.setDeidentifyTemplates
train
public function setDeidentifyTemplates($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE,
php
{ "resource": "" }
q15748
Interview.setRating
train
public function setRating($var) { GPBUtil::checkMessage($var, \Google\Cloud\Talent\V4beta1\Rating::class);
php
{ "resource": "" }
q15749
AnnotateFileRequest.setInputConfig
train
public function setInputConfig($var) { GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\InputConfig::class);
php
{ "resource": "" }
q15750
AnnotateFileRequest.setFeatures
train
public function setFeatures($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE,
php
{ "resource": "" }
q15751
AnnotateFileRequest.setPages
train
public function setPages($var) { $arr = GPBUtil::checkRepeatedField($var,
php
{ "resource": "" }
q15752
Transaction.insertBatch
train
public function insertBatch(array $entities) { $entities = $this->operation->allocateIdsToEntities($entities); foreach ($entities as $entity) {
php
{ "resource": "" }
q15753
Transaction.updateBatch
train
public function updateBatch(array $entities, array $options = []) { $options += [ 'allowOverwrite' => false ]; $this->operation->checkOverwrite($entities, $options['allowOverwrite']); foreach ($entities as $entity) {
php
{ "resource": "" }
q15754
Transaction.deleteBatch
train
public function deleteBatch(array $keys) { foreach ($keys as $key) {
php
{ "resource": "" }
q15755
Transaction.commit
train
public function commit(array $options = []) { $options['transaction'] = $this->transactionId;
php
{ "resource": "" }
q15756
StreamingDetectIntentResponse.setRecognitionResult
train
public function setRecognitionResult($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\StreamingRecognitionResult::class);
php
{ "resource": "" }
q15757
ListAssetsResult.setStateChange
train
public function setStateChange($var) { GPBUtil::checkEnum($var, \Google\Cloud\Secur
php
{ "resource": "" }
q15758
UptimeCheckIp.setRegion
train
public function setRegion($var) { GPBUtil::checkEnum($var, \Google\Cloud\Monitoring\V3\UptimeCheckRegion::class);
php
{ "resource": "" }
q15759
UpdateDeidentifyTemplateRequest.setDeidentifyTemplate
train
public function setDeidentifyTemplate($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\DeidentifyTemplate::class);
php
{ "resource": "" }
q15760
ValueValidation.setValues
train
public function setValues($var) { $arr = GPBUtil::checkRepeatedField($var,
php
{ "resource": "" }
q15761
BatchUpdateIntentsRequest.setIntentBatchInline
train
public function setIntentBatchInline($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\IntentBatch::class);
php
{ "resource": "" }
q15762
PartOfSpeech.setTag
train
public function setTag($var) { GPBUtil::checkEnum($var, \Google\Cloud\Language\V1beta2\PartOfSpeech_Tag::class);
php
{ "resource": "" }
q15763
PartOfSpeech.setCase
train
public function setCase($var) { GPBUtil::checkEnum($var, \Google\Cloud\Language\V1beta2\PartOfSpeech_Case::class);
php
{ "resource": "" }
q15764
PartOfSpeech.setForm
train
public function setForm($var) { GPBUtil::checkEnum($var, \Google\Cloud\Language\V1beta2\PartOfSpeech_Form::class);
php
{ "resource": "" }
q15765
PartOfSpeech.setGender
train
public function setGender($var) { GPBUtil::checkEnum($var, \Google\Cloud\Language\V1beta2\PartOfSpeech_Gender::class);
php
{ "resource": "" }
q15766
PartOfSpeech.setNumber
train
public function setNumber($var) { GPBUtil::checkEnum($var, \Google\Cloud\Language\V1beta2\PartOfSpeech_Number::class);
php
{ "resource": "" }
q15767
PartOfSpeech.setProper
train
public function setProper($var) { GPBUtil::checkEnum($var, \Google\Cloud\Language\V1beta2\PartOfSpeech_Proper::class);
php
{ "resource": "" }
q15768
PolicyBuilder.setBindings
train
public function setBindings(array $bindings = []) { $this->bindings = []; foreach ($bindings
php
{ "resource": "" }
q15769
PolicyBuilder.removeBinding
train
public function removeBinding($role, array $members) { $bindings = $this->bindings; foreach ((array) $bindings as $i => $binding) { if ($binding['role'] == $role) { $newMembers = array_diff($binding['members'], $members); if (count($newMembers) != count($b...
php
{ "resource": "" }
q15770
Logger.entries
train
public function entries(array $options = []) { $resultLimit = $this->pluck('resultLimit', $options, false); $logNameFilter = "logName = $this->formattedName"; $options += [ 'resourceNames' => ["projects/$this->projectId"], 'filter' => isset($options['filter']) ...
php
{ "resource": "" }
q15771
Logger.write
train
public function write($entry, array $options = []) { $entryOptions = $this->pluckArray($this->entryOptions, $options); $this->writeBatch(
php
{ "resource": "" }
q15772
Logger.writeBatch
train
public function writeBatch(array $entries, array $options = []) { $this->validateBatch($entries, Entry::class);
php
{ "resource": "" }
q15773
ListenResponse.setTargetChange
train
public function setTargetChange($var) { GPBUtil::checkMessage($var,
php
{ "resource": "" }
q15774
Lifecycle.clearRules
train
public function clearRules($action = null) { if (!$action) { $this->lifecycle = []; return $this; } if (!is_string($action) && !is_callable($action)) { throw new \InvalidArgumentException( sprintf( 'Expected either a st...
php
{ "resource": "" }
q15775
SetMaintenancePolicyRequest.setMaintenancePolicy
train
public function setMaintenancePolicy($var) { GPBUtil::checkMessage($var, \Google\Cloud\Container\V1\MaintenancePolicy::class);
php
{ "resource": "" }
q15776
ArrayTrait.pluck
train
private function pluck($key, array &$arr, $isRequired = true) { if (!array_key_exists($key, $arr)) { if ($isRequired) { throw new \InvalidArgumentException( "Key $key does not exist in the provided array."
php
{ "resource": "" }
q15777
ArrayTrait.pluckArray
train
private function pluckArray(array $keys, &$arr) { $values = []; foreach ($keys as $key) {
php
{ "resource": "" }
q15778
ArrayTrait.arrayMergeRecursive
train
private function arrayMergeRecursive(array $array1, array $array2) { foreach ($array2 as $key => $value) { if (array_key_exists($key, $array1) && is_array($array1[$key]) && is_array($value)) { $array1[$key] = ($this->isAssoc($array1[$key]) && $this->isAssoc($value)) ...
php
{ "resource": "" }
q15779
Sink.update
train
public function update(array $metadata, array $options = []) { $options += $metadata; $options += $this->info($options);
php
{ "resource": "" }
q15780
Sink.reload
train
public function reload(array $options = []) { return $this->info = $this->connection->getSink($options + [
php
{ "resource": "" }
q15781
RedactImageRequest.setImageRedactionConfigs
train
public function setImageRedactionConfigs($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE,
php
{ "resource": "" }
q15782
RedactImageRequest.setByteItem
train
public function setByteItem($var) { GPBUtil::checkMessage($var,
php
{ "resource": "" }
q15783
SearchProfilesResponse.setSpellCorrection
train
public function setSpellCorrection($var) { GPBUtil::checkMessage($var, \Google\Cloud\Talent\V4beta1\SpellingCorrection::class);
php
{ "resource": "" }
q15784
Instance.setType
train
public function setType($var) { GPBUtil::checkEnum($var, \Google\Cloud\Bigtable\Admin\V2\Instance_Type::class);
php
{ "resource": "" }
q15785
Intersection.setRules
train
public function setRules($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE,
php
{ "resource": "" }
q15786
CacheSessionPool.release
train
public function release(Session $session) { $this->config['lock']->synchronize(function () use ($session) { $item = $this->cacheItemPool->getItem($this->cacheKey); $data = $item->get(); $name = $session->name(); if (isset($data['inUse'][$name])) { ...
php
{ "resource": "" }
q15787
CacheSessionPool.keepAlive
train
public function keepAlive(Session $session) { $this->config['lock']->synchronize(function () use ($session) { $item = $this->cacheItemPool->getItem($this->cacheKey); $data = $item->get();
php
{ "resource": "" }
q15788
CacheSessionPool.warmup
train
public function warmup() { $toCreate = $this->config['lock']->synchronize(function () { $item = $this->cacheItemPool->getItem($this->cacheKey); $data = (array) $item->get() ?: $this->initialize(); $count = $this->getSessionCount($data); $toCreate = []; ...
php
{ "resource": "" }
q15789
CacheSessionPool.clear
train
public function clear() { $sessions = $this->config['lock']->synchronize(function () { $item = $this->cacheItemPool->getItem($this->cacheKey); $data = (array) $item->get() ?: $this->initialize(); $sessions = $data['queue'] + $data['inUse'];
php
{ "resource": "" }
q15790
CacheSessionPool.setDatabase
train
public function setDatabase(Database $database) { $this->database = $database; $identity = $database->identity(); $this->cacheKey = sprintf( self::CACHE_KEY_TEMPLATE, $identity['projectId'], $identity['instance'],
php
{ "resource": "" }
q15791
CacheSessionPool.buildToCreateList
train
private function buildToCreateList($number) { $toCreate = []; $time = $this->time(); for ($i = 0; $i < $number; $i++) {
php
{ "resource": "" }
q15792
CacheSessionPool.purgeOrphanedToCreateItems
train
private function purgeOrphanedToCreateItems(array &$data) { foreach ($data['toCreate'] as $key => $timestamp) { $time = $this->time();
php
{ "resource": "" }
q15793
CacheSessionPool.purgeOrphanedInUseSessions
train
private function purgeOrphanedInUseSessions(array &$data) { foreach ($data['inUse'] as $key => $session) { if ($session['lastActive'] + SessionPoolInterface::SESSION_EXPIRATION_SECONDS < $this->time()) { unset($data['inUse'][$key]); } elseif ($session['lastActive'] + ...
php
{ "resource": "" }
q15794
CacheSessionPool.getSession
train
private function getSession(array &$data) { $session = array_shift($data['queue']); if ($session) { if ($session['expiration'] - self::DURATION_ONE_MINUTE < $this->time()) { return $this->getSession($data);
php
{ "resource": "" }
q15795
CacheSessionPool.createSessions
train
private function createSessions($count) { $args = [ 'database' => $this->database->name(), 'session' => [ 'labels' => isset($this->config['labels']) ? $this->config['labels'] : [] ] ]; $promises = []; for ($i = 0; $i < $count; $i+...
php
{ "resource": "" }
q15796
CacheSessionPool.isSessionValid
train
private function isSessionValid(array $session) { $halfHourBeforeExpiration = $session['expiration'] - (SessionPoolInterface::SESSION_EXPIRATION_SECONDS / 2); if ($this->time() < $halfHourBeforeExpiration) {
php
{ "resource": "" }
q15797
CacheSessionPool.handleSession
train
private function handleSession(array $session) { if ($this->isSessionValid($session)) { return $session; } $this->config['lock']->synchronize(function () use
php
{ "resource": "" }
q15798
CacheSessionPool.waitForNextAvailableSession
train
private function waitForNextAvailableSession() { $elapsedCycles = 0; while (true) { $session = $this->config['lock']->synchronize(function () use ($elapsedCycles) { $item = $this->cacheItemPool->getItem($this->cacheKey); $data = $item->get(); ...
php
{ "resource": "" }
q15799
CacheSessionPool.getDefaultLock
train
private function getDefaultLock() { if ($this->isSysvIPCLoaded()) { return new SemaphoreLock( $this->getSysvKey(crc32($this->cacheKey))
php
{ "resource": "" }