_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
33
8k
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;
php
{ "resource": "" }
q15901
PsrLogger.sendEntry
train
private function sendEntry(Entry $entry) { if ($this->batchEnabled) { $this->batchRunner->submitItem($this->identifier, $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' =>
php
{ "resource": "" }
q15903
Snapshot.topic
train
public function topic() { if ($this->info['topic']) { return new Topic( $this->connection, $this->projectId, $this->info['topic'],
php
{ "resource": "" }
q15904
Snapshot.subscription
train
public function subscription() { return $this->info['subscription'] ? new
php
{ "resource": "" }
q15905
MessageEvent.info
train
public function info() { $data = [ 'id' => $this->id, 'type' => $this->type ]; if ($this->uncompressedSizeBytes) { $data['uncompressedSizeBytes'] = $this->uncompressedSizeBytes;
php
{ "resource": "" }
q15906
Profile.setPersonNames
train
public function setPersonNames($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE,
php
{ "resource": "" }
q15907
Profile.setAddresses
train
public function setAddresses($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE,
php
{ "resource": "" }
q15908
Profile.setEmailAddresses
train
public function setEmailAddresses($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE,
php
{ "resource": "" }
q15909
Profile.setPersonalUris
train
public function setPersonalUris($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE,
php
{ "resource": "" }
q15910
Profile.setSkills
train
public function setSkills($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE,
php
{ "resource": "" }
q15911
Profile.setPublications
train
public function setPublications($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE,
php
{ "resource": "" }
q15912
Profile.setPatents
train
public function setPatents($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE,
php
{ "resource": "" }
q15913
Profile.setCertifications
train
public function setCertifications($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE,
php
{ "resource": "" }
q15914
Profile.setApplications
train
public function setApplications($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
php
{ "resource": "" }
q15915
Profile.setAssignments
train
public function setAssignments($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
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));
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 ...
php
{ "resource": "" }
q15918
TransformationSummary.setField
train
public function setField($var) { GPBUtil::checkMessage($var,
php
{ "resource": "" }
q15919
TransformationSummary.setTransformation
train
public function setTransformation($var) { GPBUtil::checkMessage($var,
php
{ "resource": "" }
q15920
TransformationSummary.setFieldTransformations
train
public function setFieldTransformations($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE,
php
{ "resource": "" }
q15921
TransformationSummary.setRecordSuppress
train
public function setRecordSuppress($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\RecordSuppression::class);
php
{ "resource": "" }
q15922
TextFrame.setRotatedBoundingBox
train
public function setRotatedBoundingBox($var) { GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1\NormalizedBoundingPoly::class);
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' );
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
php
{ "resource": "" }
q15925
SysvConfigStorage.clear
train
public function clear() { $shmid = shm_attach($this->sysvKey,
php
{ "resource": "" }
q15926
ListInstancesResponse.setUnreachable
train
public function setUnreachable($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
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...
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 config...
php
{ "resource": "" }
q15929
GrpcTrait.formatStructForApi
train
private function formatStructForApi(array $fields) { $fFields = []; foreach ($fields as $key => $value) { $fFields[$key]
php
{ "resource": "" }
q15930
GrpcTrait.formatListForApi
train
private function formatListForApi(array $list) { $values = []; foreach ($list as $value) { $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': ...
php
{ "resource": "" }
q15932
GrpcTrait.formatTimestampFromApi
train
private function formatTimestampFromApi(array $timestamp) { $timestamp += [ 'seconds' => 0,
php
{ "resource": "" }
q15933
CreateModelRequest.setModel
train
public function setModel($var) { GPBUtil::checkMessage($var, \Google\Cloud\AutoMl\V1beta1\Model::class);
php
{ "resource": "" }
q15934
PathTrait.fullName
train
private function fullName($projectId, $database, $relativeName = null) { return $relativeName !== null
php
{ "resource": "" }
q15935
PathTrait.databaseIdFromName
train
private function databaseIdFromName($name) { try { $parsed = FirestoreGapicClient::parseName($name); } catch (ValidationException $e) { return null; }
php
{ "resource": "" }
q15936
PathTrait.isDocument
train
private function isDocument($name) { if (!$this->isRelative($name)) { $name = $this->relativeName($name); }
php
{ "resource": "" }
q15937
PathTrait.isCollection
train
private function isCollection($name) { if (!$this->isRelative($name)) { $name = $this->relativeName($name); }
php
{ "resource": "" }
q15938
PathTrait.pathId
train
private function pathId($name) { $parts = $this->splitName($name); if ($parts[0] === '') {
php
{ "resource": "" }
q15939
PathTrait.parentPath
train
private function parentPath($name) { $parts = $this->splitName($name);
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,
php
{ "resource": "" }
q15941
DeleteFromColumn.setTimeRange
train
public function setTimeRange($var) { GPBUtil::checkMessage($var,
php
{ "resource": "" }
q15942
ListStoredInfoTypesResponse.setStoredInfoTypes
train
public function setStoredInfoTypes($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE,
php
{ "resource": "" }
q15943
StackTrace.setStackFrames
train
public function setStackFrames($var) { GPBUtil::checkMessage($var, \Google\Cloud\Trace\V2\StackTrace_StackFrames::class);
php
{ "resource": "" }
q15944
DataSource.setTransferType
train
public function setTransferType($var) { GPBUtil::checkEnum($var, \Google\Cloud\BigQuery\DataTransfer\V1\TransferType::class);
php
{ "resource": "" }
q15945
DataSource.setParameters
train
public function setParameters($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE,
php
{ "resource": "" }
q15946
DataSource.setAuthorizationType
train
public function setAuthorizationType($var) { GPBUtil::checkEnum($var, \Google\Cloud\BigQuery\DataTransfer\V1\DataSource_AuthorizationType::class);
php
{ "resource": "" }
q15947
DataSource.setDataRefreshType
train
public function setDataRefreshType($var) { GPBUtil::checkEnum($var, \Google\Cloud\BigQuery\DataTransfer\V1\DataSource_DataRefreshType::class);
php
{ "resource": "" }
q15948
CollectionReference.add
train
public function add(array $fields = [], array $options = []) { $name = $this->randomName($this->name); $document = $this->documentFactory($name);
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 I...
php
{ "resource": "" }
q15950
AttributeValue.setStringValue
train
public function setStringValue($var) { GPBUtil::checkMessage($var,
php
{ "resource": "" }
q15951
AnnotateTextResponse.setCategories
train
public function setCategories($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE,
php
{ "resource": "" }
q15952
BatchTrait.flush
train
public function flush() { $id = $this->batchRunner ->getJobFromId($this->identifier) ->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, $...
php
{ "resource": "" }
q15954
StreamingRecognizeResponse.setSpeechEventType
train
public function setSpeechEventType($var) { GPBUtil::checkEnum($var, \Google\Cloud\Speech\V1\StreamingRecognizeResponse_SpeechEventType::class);
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 (iss...
php
{ "resource": "" }
q15956
ResourceNameTrait.pluckName
train
private function pluckName($type, $name) { if (!isset($this->regexes[$type])) { throw new InvalidArgumentException(sprintf(
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',
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',
php
{ "resource": "" }
q15959
Links.setLink
train
public function setLink($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE,
php
{ "resource": "" }
q15960
ListGroupsResponse.setGroup
train
public function setGroup($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE,
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.',
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' &...
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)) {
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;...
php
{ "resource": "" }
q15965
PartOfSpeech.setAspect
train
public function setAspect($var) { GPBUtil::checkEnum($var, \Google\Cloud\Language\V1\PartOfSpeech_Aspect::class);
php
{ "resource": "" }
q15966
PartOfSpeech.setMood
train
public function setMood($var) { GPBUtil::checkEnum($var, \Google\Cloud\Language\V1\PartOfSpeech_Mood::class);
php
{ "resource": "" }
q15967
PartOfSpeech.setPerson
train
public function setPerson($var) { GPBUtil::checkEnum($var, \Google\Cloud\Language\V1\PartOfSpeech_Person::class);
php
{ "resource": "" }
q15968
PartOfSpeech.setReciprocity
train
public function setReciprocity($var) { GPBUtil::checkEnum($var, \Google\Cloud\Language\V1\PartOfSpeech_Reciprocity::class);
php
{ "resource": "" }
q15969
PartOfSpeech.setTense
train
public function setTense($var) { GPBUtil::checkEnum($var, \Google\Cloud\Language\V1\PartOfSpeech_Tense::class);
php
{ "resource": "" }
q15970
PartOfSpeech.setVoice
train
public function setVoice($var) { GPBUtil::checkEnum($var, \Google\Cloud\Language\V1\PartOfSpeech_Voice::class);
php
{ "resource": "" }
q15971
Voice.setSsmlGender
train
public function setSsmlGender($var) { GPBUtil::checkEnum($var, \Google\Cloud\TextToSpeech\V1\SsmlVoiceGender::class);
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) { ...
php
{ "resource": "" }
q15973
TransactionOptions.setReadOnly
train
public function setReadOnly($var) { GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1beta1\TransactionOptions_ReadOnly::class);
php
{ "resource": "" }
q15974
TransactionOptions.setReadWrite
train
public function setReadWrite($var) { GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1beta1\TransactionOptions_ReadWrite::class);
php
{ "resource": "" }
q15975
AlertPolicyServiceGapicClient.alertPolicyConditionName
train
public static function alertPolicyConditionName($project, $alertPolicy, $condition) { return self::getAlertPolicyConditionNameTemplate()->render([ 'project' => $project,
php
{ "resource": "" }
q15976
SearchUrisRequest.setThreatTypes
train
public function setThreatTypes($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM,
php
{ "resource": "" }
q15977
ReadOptions.setReadConsistency
train
public function setReadConsistency($var) { GPBUtil::checkEnum($var, \Google\Cloud\Datastore\V1\ReadOptions_ReadConsistency::class);
php
{ "resource": "" }
q15978
CarouselSelect.setItems
train
public function setItems($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE,
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] = []; ...
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]); }
php
{ "resource": "" }
q15981
InMemoryConfigStorage.shutdown
train
public function shutdown() { foreach ($this->items as $idNum => $items) { if (count($items) !== 0) {
php
{ "resource": "" }
q15982
ImageLocation.setBoundingBoxes
train
public function setBoundingBoxes($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE,
php
{ "resource": "" }
q15983
SetAddonsConfigRequest.setAddonsConfig
train
public function setAddonsConfig($var) { GPBUtil::checkMessage($var,
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']['...
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',
php
{ "resource": "" }
q15986
CloudRedisGrpcClient.UpdateInstance
train
public function UpdateInstance(\Google\Cloud\Redis\V1\UpdateInstanceRequest $argument, $metadata = [], $options = []) {
php
{ "resource": "" }
q15987
ListSnapshotsResponse.setSnapshots
train
public function setSnapshots($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE,
php
{ "resource": "" }
q15988
PublishResponse.setMessageIds
train
public function setMessageIds($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
php
{ "resource": "" }
q15989
ImageAnnotatorClient.annotateImage
train
public function annotateImage($image, $features, $optionalArgs = []) { $image = $this->createImageObject($image); return $this->annotateImageHelper( [$this, 'batchAnnotateImages'],
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 {...
php
{ "resource": "" }
q15991
AppEngineHttpTarget.setAppEngineRouting
train
public function setAppEngineRouting($var) { GPBUtil::checkMessage($var, \Google\Cloud\Scheduler\V1beta1\AppEngineRouting::class);
php
{ "resource": "" }
q15992
NormalizedBoundingPoly.setVertices
train
public function setVertices($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE,
php
{ "resource": "" }
q15993
QueryTimeRange.setPeriod
train
public function setPeriod($var) { GPBUtil::checkEnum($var, \Google\Cloud\ErrorReporting\V1beta1\QueryT
php
{ "resource": "" }
q15994
Job.setAppEngineHttpTarget
train
public function setAppEngineHttpTarget($var) { GPBUtil::checkMessage($var,
php
{ "resource": "" }
q15995
Job.setHttpTarget
train
public function setHttpTarget($var) { GPBUtil::checkMessage($var, \Google\Cloud\Scheduler\V1\HttpTarget::class);
php
{ "resource": "" }
q15996
Job.setState
train
public function setState($var) { GPBUtil::checkEnum($var,
php
{ "resource": "" }
q15997
ObjectTrackingFrame.setNormalizedBoundingBox
train
public function setNormalizedBoundingBox($var) { GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1\NormalizedBoundingBox::class);
php
{ "resource": "" }
q15998
Landmark.setPosition
train
public function setPosition($var) { GPBUtil::checkMessage($var,
php
{ "resource": "" }
q15999
RowSet.setRowKeys
train
public function setRowKeys($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::BYTES);
php
{ "resource": "" }