_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q15900
PsrLogger.validateLogLevel
train
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
{ "resource": "" }
q15901
PsrLogger.sendEntry
train
private function sendEntry(Entry $entry) { if ($this->batchEnabled) { $this->batchRunner->submitItem($this->identifier, $entry); return; } $this->logger->write($entry); }
php
{ "resource": "" }
q15902
Snapshot.create
train
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
{ "resource": "" }
q15903
Snapshot.topic
train
public function topic() { if ($this->info['topic']) { return new Topic( $this->connection, $this->projectId, $this->info['topic'], $this->encode, [], $this->clientConfig ); } return null; }
php
{ "resource": "" }
q15904
Snapshot.subscription
train
public function subscription() { return $this->info['subscription'] ? new Subscription($this->connection, $this->projectId, $this->info['subscription'], null, $this->encode) : null; }
php
{ "resource": "" }
q15905
MessageEvent.info
train
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
{ "resource": "" }
q15906
Profile.setPersonNames
train
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
{ "resource": "" }
q15907
Profile.setAddresses
train
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
{ "resource": "" }
q15908
Profile.setEmailAddresses
train
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
{ "resource": "" }
q15909
Profile.setPersonalUris
train
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
{ "resource": "" }
q15910
Profile.setSkills
train
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
{ "resource": "" }
q15911
Profile.setPublications
train
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
{ "resource": "" }
q15912
Profile.setPatents
train
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
{ "resource": "" }
q15913
Profile.setCertifications
train
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
{ "resource": "" }
q15914
Profile.setApplications
train
public function setApplications($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); $this->applications = $arr; return $this; }
php
{ "resource": "" }
q15915
Profile.setAssignments
train
public function setAssignments($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); $this->assignments = $arr; return $this; }
php
{ "resource": "" }
q15916
ServiceBuilder.createClient
train
private function createClient($class, $packageName, array $config = []) { if (class_exists($class)) { return new $class($this->resolveConfig($config + $this->config)); } throw new \Exception(sprintf( 'The google/cloud-%s package is missing and must be installed.', $packageName )); }
php
{ "resource": "" }
q15917
ServiceBuilder.resolveConfig
train
private function resolveConfig(array $config) { if (!isset($config['httpHandler'])) { $config['httpHandler'] = HttpHandlerFactory::build(); } if (!isset($config['asyncHttpHandler'])) { $isGuzzleHandler = $config['httpHandler'] instanceof Guzzle6HttpHandler || $config['httpHandler'] instanceof Guzzle5HttpHandler; $config['asyncHttpHandler'] = $isGuzzleHandler ? [$config['httpHandler'], 'async'] : [HttpHandlerFactory::build(), 'async']; } return array_merge($this->config, $config); }
php
{ "resource": "" }
q15918
TransformationSummary.setField
train
public function setField($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\FieldId::class); $this->field = $var; return $this; }
php
{ "resource": "" }
q15919
TransformationSummary.setTransformation
train
public function setTransformation($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\PrimitiveTransformation::class); $this->transformation = $var; return $this; }
php
{ "resource": "" }
q15920
TransformationSummary.setFieldTransformations
train
public function setFieldTransformations($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dlp\V2\FieldTransformation::class); $this->field_transformations = $arr; return $this; }
php
{ "resource": "" }
q15921
TransformationSummary.setRecordSuppress
train
public function setRecordSuppress($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\RecordSuppression::class); $this->record_suppress = $var; return $this; }
php
{ "resource": "" }
q15922
TextFrame.setRotatedBoundingBox
train
public function setRotatedBoundingBox($var) { GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1\NormalizedBoundingPoly::class); $this->rotated_bounding_box = $var; return $this; }
php
{ "resource": "" }
q15923
SysvConfigStorage.save
train
public function save(JobConfig $config) { $shmid = shm_attach($this->sysvKey, $this->shmSize, $this->perm); if ($shmid === false) { throw new \RuntimeException( 'Failed to attach to the shared memory' ); } // If the variable write fails, clear the memory and re-raise the exception try { $result = shm_put_var($shmid, self::VAR_KEY, $config); } catch (\Exception $e) { $this->clear(); throw new \RuntimeException($e->getMessage()); } finally { shm_detach($shmid); } return $result; }
php
{ "resource": "" }
q15924
SysvConfigStorage.load
train
public function load() { $shmid = shm_attach($this->sysvKey, $this->shmSize, $this->perm); if ($shmid === false) { throw new \RuntimeException( 'Failed to attach to the shared memory' ); } if (! shm_has_var($shmid, self::VAR_KEY)) { $result = new JobConfig(); } else { $result = shm_get_var($shmid, self::VAR_KEY); } shm_detach($shmid); if ($result === false) { throw new \RuntimeException( 'Failed to deserialize data from shared memory' ); } return $result; }
php
{ "resource": "" }
q15925
SysvConfigStorage.clear
train
public function clear() { $shmid = shm_attach($this->sysvKey, $this->shmSize, $this->perm); shm_remove_var($shmid, self::VAR_KEY); }
php
{ "resource": "" }
q15926
ListInstancesResponse.setUnreachable
train
public function setUnreachable($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); $this->unreachable = $arr; return $this; }
php
{ "resource": "" }
q15927
GrpcTrait.send
train
public function send(callable $request, array $args, $whitelisted = false) { $requestOptions = $this->pluckArray([ 'grpcOptions', 'retries', 'requestTimeout' ], $args[count($args) - 1]); try { return $this->requestWrapper->send($request, $args, $requestOptions); } catch (NotFoundException $e) { if ($whitelisted) { throw $this->modifyWhitelistedError($e); } throw $e; } }
php
{ "resource": "" }
q15928
GrpcTrait.getGaxConfig
train
private function getGaxConfig($version, callable $authHttpHandler = null) { $config = [ 'libName' => 'gccl', 'libVersion' => $version, 'transport' => 'grpc' ]; // GAX v0.32.0 introduced the CredentialsWrapper class and a different // way to configure credentials. If the class exists, use this new method // otherwise default to legacy usage. if (class_exists(CredentialsWrapper::class)) { $config['credentials'] = new CredentialsWrapper( $this->requestWrapper->getCredentialsFetcher(), $authHttpHandler ); } else { $config += [ 'credentialsLoader' => $this->requestWrapper->getCredentialsFetcher(), 'authHttpHandler' => $authHttpHandler, 'enableCaching' => false ]; } return $config; }
php
{ "resource": "" }
q15929
GrpcTrait.formatStructForApi
train
private function formatStructForApi(array $fields) { $fFields = []; foreach ($fields as $key => $value) { $fFields[$key] = $this->formatValueForApi($value); } return ['fields' => $fFields]; }
php
{ "resource": "" }
q15930
GrpcTrait.formatListForApi
train
private function formatListForApi(array $list) { $values = []; foreach ($list as $value) { $values[] = $this->formatValueForApi($value); } return ['values' => $values]; }
php
{ "resource": "" }
q15931
GrpcTrait.formatValueForApi
train
private function formatValueForApi($value) { $type = gettype($value); switch ($type) { case 'string': return ['string_value' => $value]; case 'double': case 'integer': return ['number_value' => $value]; case 'boolean': return ['bool_value' => $value]; case 'NULL': return ['null_value' => NullValue::NULL_VALUE]; case 'array': if (!empty($value) && $this->isAssoc($value)) { return ['struct_value' => $this->formatStructForApi($value)]; } return ['list_value' => $this->formatListForApi($value)]; } }
php
{ "resource": "" }
q15932
GrpcTrait.formatTimestampFromApi
train
private function formatTimestampFromApi(array $timestamp) { $timestamp += [ 'seconds' => 0, 'nanos' => 0 ]; $dt = $this->createDateTimeFromSeconds($timestamp['seconds']); return $this->formatTimeAsString($dt, $timestamp['nanos']); }
php
{ "resource": "" }
q15933
CreateModelRequest.setModel
train
public function setModel($var) { GPBUtil::checkMessage($var, \Google\Cloud\AutoMl\V1beta1\Model::class); $this->model = $var; return $this; }
php
{ "resource": "" }
q15934
PathTrait.fullName
train
private function fullName($projectId, $database, $relativeName = null) { return $relativeName !== null ? FirestoreGapicClient::documentPathName($projectId, $database, $relativeName) : FirestoreGapicClient::documentRootName($projectId, $database); }
php
{ "resource": "" }
q15935
PathTrait.databaseIdFromName
train
private function databaseIdFromName($name) { try { $parsed = FirestoreGapicClient::parseName($name); } catch (ValidationException $e) { return null; } return isset($parsed['database']) ? $parsed['database'] : null; }
php
{ "resource": "" }
q15936
PathTrait.isDocument
train
private function isDocument($name) { if (!$this->isRelative($name)) { $name = $this->relativeName($name); } $parts = $this->splitName($name); return count($parts) > 0 && count($parts) % 2 === 0; }
php
{ "resource": "" }
q15937
PathTrait.isCollection
train
private function isCollection($name) { if (!$this->isRelative($name)) { $name = $this->relativeName($name); } $parts = $this->splitName($name); return count($parts) % 2 === 1; }
php
{ "resource": "" }
q15938
PathTrait.pathId
train
private function pathId($name) { $parts = $this->splitName($name); if ($parts[0] === '') { return null; } return end($parts); }
php
{ "resource": "" }
q15939
PathTrait.parentPath
train
private function parentPath($name) { $parts = $this->splitName($name); array_pop($parts); return implode('/', $parts); }
php
{ "resource": "" }
q15940
PathTrait.randomName
train
private function randomName($parent) { // UUIDs are a pre-existing library dependency, so we'll use that instead // of adding random_compat or something similar. // Generate a UUID, then strip `-` and trim to expected length. // @todo revisit once library requires php >= 7.0 and random_int() can be used without dependency. $rand = substr(str_replace('-', '', Uuid::uuid4()), 0, 20); return $this->childPath($parent, $rand); }
php
{ "resource": "" }
q15941
DeleteFromColumn.setTimeRange
train
public function setTimeRange($var) { GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\TimestampRange::class); $this->time_range = $var; return $this; }
php
{ "resource": "" }
q15942
ListStoredInfoTypesResponse.setStoredInfoTypes
train
public function setStoredInfoTypes($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dlp\V2\StoredInfoType::class); $this->stored_info_types = $arr; return $this; }
php
{ "resource": "" }
q15943
StackTrace.setStackFrames
train
public function setStackFrames($var) { GPBUtil::checkMessage($var, \Google\Cloud\Trace\V2\StackTrace_StackFrames::class); $this->stack_frames = $var; return $this; }
php
{ "resource": "" }
q15944
DataSource.setTransferType
train
public function setTransferType($var) { GPBUtil::checkEnum($var, \Google\Cloud\BigQuery\DataTransfer\V1\TransferType::class); $this->transfer_type = $var; return $this; }
php
{ "resource": "" }
q15945
DataSource.setParameters
train
public function setParameters($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\BigQuery\DataTransfer\V1\DataSourceParameter::class); $this->parameters = $arr; return $this; }
php
{ "resource": "" }
q15946
DataSource.setAuthorizationType
train
public function setAuthorizationType($var) { GPBUtil::checkEnum($var, \Google\Cloud\BigQuery\DataTransfer\V1\DataSource_AuthorizationType::class); $this->authorization_type = $var; return $this; }
php
{ "resource": "" }
q15947
DataSource.setDataRefreshType
train
public function setDataRefreshType($var) { GPBUtil::checkEnum($var, \Google\Cloud\BigQuery\DataTransfer\V1\DataSource_DataRefreshType::class); $this->data_refresh_type = $var; return $this; }
php
{ "resource": "" }
q15948
CollectionReference.add
train
public function add(array $fields = [], array $options = []) { $name = $this->randomName($this->name); $document = $this->documentFactory($name); $result = $document->create($fields, $options); return $document; }
php
{ "resource": "" }
q15949
CollectionReference.listDocuments
train
public function listDocuments(array $options = []) { $resultLimit = $this->pluck('resultLimit', $options, false); $options += [ 'parent' => $this->parentPath($this->name), 'collectionId' => $this->pathId($this->name), 'mask' => [] ]; return new ItemIterator( new PageIterator( function ($document) { return $this->documentFactory($document['name']); }, [$this->connection, 'listDocuments'], $options, [ 'itemsKey' => 'documents', 'resultLimit' => $resultLimit ] ) ); }
php
{ "resource": "" }
q15950
AttributeValue.setStringValue
train
public function setStringValue($var) { GPBUtil::checkMessage($var, \Google\Cloud\Trace\V2\TruncatableString::class); $this->writeOneof(1, $var); return $this; }
php
{ "resource": "" }
q15951
AnnotateTextResponse.setCategories
train
public function setCategories($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Language\V1\ClassificationCategory::class); $this->categories = $arr; return $this; }
php
{ "resource": "" }
q15952
BatchTrait.flush
train
public function flush() { $id = $this->batchRunner ->getJobFromId($this->identifier) ->id(); return $this->batchRunner ->getProcessor() ->flush($id); }
php
{ "resource": "" }
q15953
BatchTrait.send
train
public function send(array $items) { $start = microtime(true); try { call_user_func_array($this->getCallback(), [$items]); } catch (\Exception $e) { if ($this->debugOutput) { fwrite( $this->debugOutputResource, $e->getMessage() . PHP_EOL . PHP_EOL . $e->getTraceAsString() . PHP_EOL ); } return false; } $end = microtime(true); if ($this->debugOutput) { fwrite( $this->debugOutputResource, sprintf( '%f seconds for %s: %d items' . PHP_EOL, $end - $start, $this->batchMethod, count($items) ) ); fwrite( $this->debugOutputResource, sprintf( 'memory used: %d' . PHP_EOL, memory_get_usage() ) ); } return true; }
php
{ "resource": "" }
q15954
StreamingRecognizeResponse.setSpeechEventType
train
public function setSpeechEventType($var) { GPBUtil::checkEnum($var, \Google\Cloud\Speech\V1\StreamingRecognizeResponse_SpeechEventType::class); $this->speech_event_type = $var; return $this; }
php
{ "resource": "" }
q15955
AssetServiceGapicClient.batchGetAssetsHistory
train
public function batchGetAssetsHistory($parent, $contentType, $readTimeWindow, array $optionalArgs = []) { $request = new BatchGetAssetsHistoryRequest(); $request->setParent($parent); $request->setContentType($contentType); $request->setReadTimeWindow($readTimeWindow); if (isset($optionalArgs['assetNames'])) { $request->setAssetNames($optionalArgs['assetNames']); } $requestParams = new RequestParamsHeaderDescriptor([ 'parent' => $request->getParent(), ]); $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); return $this->startCall( 'BatchGetAssetsHistory', BatchGetAssetsHistoryResponse::class, $optionalArgs, $request )->wait(); }
php
{ "resource": "" }
q15956
ResourceNameTrait.pluckName
train
private function pluckName($type, $name) { if (!isset($this->regexes[$type])) { throw new InvalidArgumentException(sprintf( 'Regex `%s` is not defined', $type )); } $matches = []; $res = preg_match($this->regexes[$type], $name, $matches); return ($res === 1) ? $matches[1] : null; }
php
{ "resource": "" }
q15957
ResourceNameTrait.formatName
train
private function formatName($type, $name, $projectId = null) { if (!isset($this->templates[$type])) { throw new InvalidArgumentException(sprintf( 'Template `%s` is not defined', $type )); } return vsprintf($this->templates[$type], [$name, $projectId]); }
php
{ "resource": "" }
q15958
ResourceNameTrait.isFullyQualifiedName
train
private function isFullyQualifiedName($type, $name) { if (!isset($this->regexes[$type])) { throw new InvalidArgumentException(sprintf( 'Regex `%s` is not defined', $type )); } return (preg_match($this->regexes[$type], $name) === 1); }
php
{ "resource": "" }
q15959
Links.setLink
train
public function setLink($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Trace\V2\Span\Link::class); $this->link = $arr; return $this; }
php
{ "resource": "" }
q15960
ListGroupsResponse.setGroup
train
public function setGroup($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Monitoring\V3\Group::class); $this->group = $arr; return $this; }
php
{ "resource": "" }
q15961
GeoPoint.validateValue
train
private function validateValue($value, $type, $allowNull = false) { if (!is_numeric($value) && (!$allowNull || ($allowNull && $value !== null))) { throw new InvalidArgumentException(sprintf( 'Given %s must be a numeric value.', $type )); } return $allowNull && $value === null ? $value : (float) $value; }
php
{ "resource": "" }
q15962
ValueMapper.fromBigQuery
train
public function fromBigQuery(array $value, array $schema) { $value = $value['v']; if (isset($schema['mode'])) { if ($schema['mode'] === 'REPEATED') { return $this->repeatedValueFromBigQuery($value, $schema); } if ($schema['mode'] === 'NULLABLE' && $value === null) { return $value; } } switch ($schema['type']) { case self::TYPE_BOOLEAN: return $value === 'true'; case self::TYPE_INTEGER: return $this->returnInt64AsObject ? new Int64($value) : (int) $value; case self::TYPE_FLOAT: return (float) $value; case self::TYPE_NUMERIC: return new Numeric($value); case self::TYPE_STRING: return (string) $value; case self::TYPE_BYTES: return new Bytes(base64_decode($value)); case self::TYPE_DATE: return new Date(new \DateTime($value)); case self::TYPE_DATETIME: return new \DateTime($value); case self::TYPE_TIME: return new Time(new \DateTime($value)); case self::TYPE_TIMESTAMP: return $this->timestampFromBigQuery($value); case self::TYPE_RECORD: return $this->recordFromBigQuery($value, $schema['fields']); default: throw new \InvalidArgumentException(sprintf( 'Unrecognized value type %s. Please ensure you are using the latest version of google/cloud.', $schema['type'] )); break; } }
php
{ "resource": "" }
q15963
ValueMapper.toBigQuery
train
public function toBigQuery($value) { if ($value instanceof ValueInterface || $value instanceof Int64) { return (string) $value; } if ($value instanceof \DateTime) { return $value->format(self::DATETIME_FORMAT_INSERT); } if (is_array($value)) { foreach ($value as $key => $item) { $value[$key] = $this->toBigQuery($item); } return $value; } return $value; }
php
{ "resource": "" }
q15964
ValueMapper.toParameter
train
public function toParameter($value) { $pValue = ['value' => $value]; $type = gettype($value); switch ($type) { case 'boolean': $pType['type'] = self::TYPE_BOOL; break; case 'integer': $pType['type'] = self::TYPE_INT64; break; case 'double': $pType['type'] = self::TYPE_FLOAT64; break; case 'string': $pType['type'] = self::TYPE_STRING; break; case 'resource': $pType['type'] = self::TYPE_BYTES; $pValue['value'] = base64_encode(stream_get_contents($value)); break; case 'object': list($pType, $pValue) = $this->objectToParameter($value); break; case 'array': list($pType, $pValue) = $this->isAssoc($value) ? $this->assocArrayToParameter($value) : $this->arrayToParameter($value); break; default: throw new \InvalidArgumentException(sprintf( 'Unrecognized value type %s. Please ensure you are using the latest version of google/cloud.', $type )); break; } return [ 'parameterType' => $pType, 'parameterValue' => $pValue ]; }
php
{ "resource": "" }
q15965
PartOfSpeech.setAspect
train
public function setAspect($var) { GPBUtil::checkEnum($var, \Google\Cloud\Language\V1\PartOfSpeech_Aspect::class); $this->aspect = $var; return $this; }
php
{ "resource": "" }
q15966
PartOfSpeech.setMood
train
public function setMood($var) { GPBUtil::checkEnum($var, \Google\Cloud\Language\V1\PartOfSpeech_Mood::class); $this->mood = $var; return $this; }
php
{ "resource": "" }
q15967
PartOfSpeech.setPerson
train
public function setPerson($var) { GPBUtil::checkEnum($var, \Google\Cloud\Language\V1\PartOfSpeech_Person::class); $this->person = $var; return $this; }
php
{ "resource": "" }
q15968
PartOfSpeech.setReciprocity
train
public function setReciprocity($var) { GPBUtil::checkEnum($var, \Google\Cloud\Language\V1\PartOfSpeech_Reciprocity::class); $this->reciprocity = $var; return $this; }
php
{ "resource": "" }
q15969
PartOfSpeech.setTense
train
public function setTense($var) { GPBUtil::checkEnum($var, \Google\Cloud\Language\V1\PartOfSpeech_Tense::class); $this->tense = $var; return $this; }
php
{ "resource": "" }
q15970
PartOfSpeech.setVoice
train
public function setVoice($var) { GPBUtil::checkEnum($var, \Google\Cloud\Language\V1\PartOfSpeech_Voice::class); $this->voice = $var; return $this; }
php
{ "resource": "" }
q15971
Voice.setSsmlGender
train
public function setSsmlGender($var) { GPBUtil::checkEnum($var, \Google\Cloud\TextToSpeech\V1\SsmlVoiceGender::class); $this->ssml_gender = $var; return $this; }
php
{ "resource": "" }
q15972
Retry.retryAll
train
public function retryAll() { foreach ($this->getFailedFiles() as $file) { // Rename the file first $tmpFile = dirname($file) . '/retrying-' . basename($file); rename($file, $tmpFile); $fp = @fopen($tmpFile, 'r'); if ($fp === false) { fwrite( STDERR, sprintf('Could not open the file: %s' . PHP_EOL, $tmpFile) ); continue; } while ($line = fgets($fp)) { $a = unserialize($line); $idNum = key($a); $job = $this->runner->getJobFromIdNum($idNum); if (! $job->callFunc($a[$idNum])) { $this->handleFailure($idNum, $a[$idNum]); } } @fclose($fp); @unlink($tmpFile); } }
php
{ "resource": "" }
q15973
TransactionOptions.setReadOnly
train
public function setReadOnly($var) { GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1beta1\TransactionOptions_ReadOnly::class); $this->writeOneof(2, $var); return $this; }
php
{ "resource": "" }
q15974
TransactionOptions.setReadWrite
train
public function setReadWrite($var) { GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1beta1\TransactionOptions_ReadWrite::class); $this->writeOneof(3, $var); return $this; }
php
{ "resource": "" }
q15975
AlertPolicyServiceGapicClient.alertPolicyConditionName
train
public static function alertPolicyConditionName($project, $alertPolicy, $condition) { return self::getAlertPolicyConditionNameTemplate()->render([ 'project' => $project, 'alert_policy' => $alertPolicy, 'condition' => $condition, ]); }
php
{ "resource": "" }
q15976
SearchUrisRequest.setThreatTypes
train
public function setThreatTypes($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\WebRisk\V1beta1\ThreatType::class); $this->threat_types = $arr; return $this; }
php
{ "resource": "" }
q15977
ReadOptions.setReadConsistency
train
public function setReadConsistency($var) { GPBUtil::checkEnum($var, \Google\Cloud\Datastore\V1\ReadOptions_ReadConsistency::class); $this->writeOneof(1, $var); return $this; }
php
{ "resource": "" }
q15978
CarouselSelect.setItems
train
public function setItems($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\V2\Intent\Message\CarouselSelect\Item::class); $this->items = $arr; return $this; }
php
{ "resource": "" }
q15979
InMemoryConfigStorage.submit
train
public function submit($item, $idNum) { if (!$this->hasShutdownHookRegistered) { register_shutdown_function([$this, 'shutdown']); $this->hasShutdownHookRegistered = true; } if (!array_key_exists($idNum, $this->items)) { $this->items[$idNum] = []; $this->lastInvoked[$idNum] = $this->created; } $this->items[$idNum][] = $item; $job = $this->config->getJobFromIdNum($idNum); $batchSize = $job->getBatchSize(); $period = $job->getCallPeriod(); if ((count($this->items[$idNum]) >= $batchSize) || (count($this->items[$idNum]) !== 0 && microtime(true) > $this->lastInvoked[$idNum] + $period)) { $this->flush($idNum); $this->items[$idNum] = []; $this->lastInvoked[$idNum] = microtime(true); } }
php
{ "resource": "" }
q15980
InMemoryConfigStorage.flush
train
public function flush($idNum) { if (isset($this->items[$idNum])) { $job = $this->config->getJobFromIdNum($idNum); if (!$job->flush($this->items[$idNum])) { $this->handleFailure($idNum, $this->items[$idNum]); } $this->items[$idNum] = []; $this->lastInvoked[$idNum] = microtime(true); } return true; }
php
{ "resource": "" }
q15981
InMemoryConfigStorage.shutdown
train
public function shutdown() { foreach ($this->items as $idNum => $items) { if (count($items) !== 0) { $this->flush($idNum); } } }
php
{ "resource": "" }
q15982
ImageLocation.setBoundingBoxes
train
public function setBoundingBoxes($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dlp\V2\BoundingBox::class); $this->bounding_boxes = $arr; return $this; }
php
{ "resource": "" }
q15983
SetAddonsConfigRequest.setAddonsConfig
train
public function setAddonsConfig($var) { GPBUtil::checkMessage($var, \Google\Cloud\Container\V1\AddonsConfig::class); $this->addons_config = $var; return $this; }
php
{ "resource": "" }
q15984
IncomingMessageTrait.messageFactory
train
private function messageFactory(array $message, ConnectionInterface $connection, $projectId, $encode) { if (!isset($message['message'])) { throw new GoogleException('Invalid message data.'); } if (isset($message['message']['data']) && $encode) { $message['message']['data'] = base64_decode($message['message']['data']); } $subscription = null; if (isset($message['subscription'])) { $subscription = new Subscription( $connection, $projectId, $message['subscription'], null, $encode ); } return new Message($message['message'], [ 'ackId' => (isset($message['ackId'])) ? $message['ackId'] : null, 'subscription' => $subscription ]); }
php
{ "resource": "" }
q15985
CloudRedisGrpcClient.GetInstance
train
public function GetInstance(\Google\Cloud\Redis\V1\GetInstanceRequest $argument, $metadata = [], $options = []) { return $this->_simpleRequest('/google.cloud.redis.v1.CloudRedis/GetInstance', $argument, ['\Google\Cloud\Redis\V1\Instance', 'decode'], $metadata, $options); }
php
{ "resource": "" }
q15986
CloudRedisGrpcClient.UpdateInstance
train
public function UpdateInstance(\Google\Cloud\Redis\V1\UpdateInstanceRequest $argument, $metadata = [], $options = []) { return $this->_simpleRequest('/google.cloud.redis.v1.CloudRedis/UpdateInstance', $argument, ['\Google\LongRunning\Operation', 'decode'], $metadata, $options); }
php
{ "resource": "" }
q15987
ListSnapshotsResponse.setSnapshots
train
public function setSnapshots($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\PubSub\V1\Snapshot::class); $this->snapshots = $arr; return $this; }
php
{ "resource": "" }
q15988
PublishResponse.setMessageIds
train
public function setMessageIds($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); $this->message_ids = $arr; return $this; }
php
{ "resource": "" }
q15989
ImageAnnotatorClient.annotateImage
train
public function annotateImage($image, $features, $optionalArgs = []) { $image = $this->createImageObject($image); return $this->annotateImageHelper( [$this, 'batchAnnotateImages'], AnnotateImageRequest::class, $image, $features, $optionalArgs ); }
php
{ "resource": "" }
q15990
ImageAnnotatorClient.productSearch
train
public function productSearch($image, ProductSearchParams $productSearchParams, $optionalArgs = []) { if (isset($optionalArgs['imageContext']) && $optionalArgs['imageContext'] instanceof ImageContext) { $optionalArgs['imageContext']->setProductSearchParams($productSearchParams); } else { $optionalArgs['imageContext'] = (new ImageContext) ->setProductSearchParams($productSearchParams); } return $this->annotateSingleFeature( $image, Type::PRODUCT_SEARCH, $optionalArgs ); }
php
{ "resource": "" }
q15991
AppEngineHttpTarget.setAppEngineRouting
train
public function setAppEngineRouting($var) { GPBUtil::checkMessage($var, \Google\Cloud\Scheduler\V1beta1\AppEngineRouting::class); $this->app_engine_routing = $var; return $this; }
php
{ "resource": "" }
q15992
NormalizedBoundingPoly.setVertices
train
public function setVertices($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1\NormalizedVertex::class); $this->vertices = $arr; return $this; }
php
{ "resource": "" }
q15993
QueryTimeRange.setPeriod
train
public function setPeriod($var) { GPBUtil::checkEnum($var, \Google\Cloud\ErrorReporting\V1beta1\QueryTimeRange_Period::class); $this->period = $var; return $this; }
php
{ "resource": "" }
q15994
Job.setAppEngineHttpTarget
train
public function setAppEngineHttpTarget($var) { GPBUtil::checkMessage($var, \Google\Cloud\Scheduler\V1\AppEngineHttpTarget::class); $this->writeOneof(5, $var); return $this; }
php
{ "resource": "" }
q15995
Job.setHttpTarget
train
public function setHttpTarget($var) { GPBUtil::checkMessage($var, \Google\Cloud\Scheduler\V1\HttpTarget::class); $this->writeOneof(6, $var); return $this; }
php
{ "resource": "" }
q15996
Job.setState
train
public function setState($var) { GPBUtil::checkEnum($var, \Google\Cloud\Scheduler\V1\Job_State::class); $this->state = $var; return $this; }
php
{ "resource": "" }
q15997
ObjectTrackingFrame.setNormalizedBoundingBox
train
public function setNormalizedBoundingBox($var) { GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1\NormalizedBoundingBox::class); $this->normalized_bounding_box = $var; return $this; }
php
{ "resource": "" }
q15998
Landmark.setPosition
train
public function setPosition($var) { GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\Position::class); $this->position = $var; return $this; }
php
{ "resource": "" }
q15999
RowSet.setRowKeys
train
public function setRowKeys($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::BYTES); $this->row_keys = $arr; return $this; }
php
{ "resource": "" }