_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
33
8k
language
stringclasses
1 value
meta_information
dict
q15100
StorageObject.beginSignedUploadSession
train
public function beginSignedUploadSession(array $options = []) { $expires = new \DateTimeImmutable('+1 minute'); $startUri = $this->signedUploadUrl($expires, $options); $uploaderOptions = $this->pluckArray([
php
{ "resource": "" }
q15101
StorageObject.reload
train
public function reload(array $options = []) { return $this->info = $this->connection->getObject( $this->formatEncryptionHeaders( $options
php
{ "resource": "" }
q15102
StorageObject.formatDestinationRequest
train
private function formatDestinationRequest($destination, array $options) { if (!is_string($destination) && !($destination instanceof Bucket)) { throw new \InvalidArgumentException( '$destination must be either a string or an instance of Bucket.' ); } $destAcl = isset($options['predefinedAcl']) ? $options['predefinedAcl'] : null; $destObject = isset($options['name']) ? $options['name'] : $this->identity['object']; unset($options['name']); unset($options['predefinedAcl']); return array_filter([ 'destinationBucket' => $destination instanceof Bucket ? $destination->name() : $destination, 'destinationObject' => $destObject,
php
{ "resource": "" }
q15103
JobTrigger.setTriggers
train
public function setTriggers($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE,
php
{ "resource": "" }
q15104
JobTrigger.setErrors
train
public function setErrors($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE,
php
{ "resource": "" }
q15105
AssetServiceGrpcClient.BatchGetAssetsHistory
train
public function BatchGetAssetsHistory(\Google\Cloud\Asset\V1\BatchGetAssetsHistoryRequest $argument, $metadata = [], $options = []) { return $this->_simpleRequest('/google.cloud.asset.v1.AssetService/BatchGetAssetsHistory',
php
{ "resource": "" }
q15106
StoredInfoTypeConfig.setLargeCustomDictionary
train
public function setLargeCustomDictionary($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\LargeCustomDictionaryConfig::class);
php
{ "resource": "" }
q15107
InputConfig.setGcsSource
train
public function setGcsSource($var) { GPBUtil::checkMessage($var, \Google\Cloud\AutoMl\V1beta1\GcsSource::class);
php
{ "resource": "" }
q15108
JobStatus.setSubstate
train
public function setSubstate($var) { GPBUtil::checkEnum($var, \Google\Cloud\Dataproc\V1\JobStatus_Substate::class);
php
{ "resource": "" }
q15109
CreateEntityTypeRequest.setEntityType
train
public function setEntityType($var) { GPBUtil::checkMessage($var,
php
{ "resource": "" }
q15110
ValueFrequency.setValue
train
public function setValue($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\Value::class);
php
{ "resource": "" }
q15111
Location.setByteRange
train
public function setByteRange($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\Range::class);
php
{ "resource": "" }
q15112
Location.setCodepointRange
train
public function setCodepointRange($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\Range::class);
php
{ "resource": "" }
q15113
Location.setContentLocations
train
public function setContentLocations($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE,
php
{ "resource": "" }
q15114
ListModelEvaluationsResponse.setModelEvaluation
train
public function setModelEvaluation($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE,
php
{ "resource": "" }
q15115
CreateTableRequest.setTable
train
public function setTable($var) { GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\Admin\V2\Table::class);
php
{ "resource": "" }
q15116
SelectItemInfo.setSynonyms
train
public function setSynonyms($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
php
{ "resource": "" }
q15117
SafeSearchAnnotation.setAdult
train
public function setAdult($var) { GPBUtil::checkEnum($var,
php
{ "resource": "" }
q15118
SafeSearchAnnotation.setSpoof
train
public function setSpoof($var) { GPBUtil::checkEnum($var,
php
{ "resource": "" }
q15119
SafeSearchAnnotation.setMedical
train
public function setMedical($var) { GPBUtil::checkEnum($var,
php
{ "resource": "" }
q15120
SafeSearchAnnotation.setViolence
train
public function setViolence($var) { GPBUtil::checkEnum($var,
php
{ "resource": "" }
q15121
SessionEntityTypesGapicClient.sessionEntityTypeName
train
public static function sessionEntityTypeName($project, $session, $entityType) { return self::getSessionEntityTypeNameTemplate()->render([ 'project' => $project,
php
{ "resource": "" }
q15122
SearchProfilesRequest.setRequestMetadata
train
public function setRequestMetadata($var) { GPBUtil::checkMessage($var,
php
{ "resource": "" }
q15123
ListCryptoKeysRequest.setVersionView
train
public function setVersionView($var) { GPBUtil::checkEnum($var, \Google\Cloud\Kms\V1\CryptoKeyVersion_CryptoKeyVersionView::class);
php
{ "resource": "" }
q15124
WorkflowMetadata.setDeleteCluster
train
public function setDeleteCluster($var) { GPBUtil::checkMessage($var,
php
{ "resource": "" }
q15125
WorkflowMetadata.setState
train
public function setState($var) { GPBUtil::checkEnum($var, \Google\Cloud\Dataproc\V1\WorkflowMetadata_State::class);
php
{ "resource": "" }
q15126
CommuteInfo.setJobLocation
train
public function setJobLocation($var) { GPBUtil::checkMessage($var, \Google\Cloud\Talent\V4beta1\Location::class);
php
{ "resource": "" }
q15127
LeaseTasksResponse.setTasks
train
public function setTasks($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE,
php
{ "resource": "" }
q15128
MasterAuth.setClientCertificateConfig
train
public function setClientCertificateConfig($var) { GPBUtil::checkMessage($var, \Google\Cloud\Container\V1\ClientCertificateConfig::class);
php
{ "resource": "" }
q15129
QueryResults.rows
train
public function rows(array $options = []) { $options += $this->queryResultsOptions; $this->waitUntilComplete($options); $schema = $this->info['schema']['fields']; return new ItemIterator( new PageIterator( function (array $row) use ($schema) { $mergedRow = []; if ($row === null) { return $mergedRow; } if (!array_key_exists('f', $row)) { throw new GoogleException('Bad response - missing key "f" for a row.'); } foreach ($row['f'] as $key => $value) { $fieldSchema = $schema[$key]; $mergedRow[$fieldSchema['name']] = $this->mapper->fromBigQuery($value, $fieldSchema);
php
{ "resource": "" }
q15130
QueryResults.waitUntilComplete
train
public function waitUntilComplete(array $options = []) { $options += $this->queryResultsOptions; $maxRetries = $this->pluck('maxRetries', $options, false); $this->wait(
php
{ "resource": "" }
q15131
QueryResults.reload
train
public function reload(array $options = []) { return $this->info = $this->connection->getQueryResults(
php
{ "resource": "" }
q15132
ListTablesResponse.setTables
train
public function setTables($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE,
php
{ "resource": "" }
q15133
AssetDiscoveryConfig.setProjectIds
train
public function setProjectIds($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
php
{ "resource": "" }
q15134
AssetDiscoveryConfig.setInclusionMode
train
public function setInclusionMode($var) { GPBUtil::checkEnum($var, \Google\Cloud\Security
php
{ "resource": "" }
q15135
CreateInspectTemplateRequest.setInspectTemplate
train
public function setInspectTemplate($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\InspectTemplate::class);
php
{ "resource": "" }
q15136
StorageConfig.setDatastoreOptions
train
public function setDatastoreOptions($var) { GPBUtil::checkMessage($var,
php
{ "resource": "" }
q15137
StorageConfig.setCloudStorageOptions
train
public function setCloudStorageOptions($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\CloudStorageOptions::class);
php
{ "resource": "" }
q15138
StorageConfig.setBigQueryOptions
train
public function setBigQueryOptions($var) { GPBUtil::checkMessage($var,
php
{ "resource": "" }
q15139
ListModelsResponse.setModel
train
public function setModel($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE,
php
{ "resource": "" }
q15140
StackFrame.setLoadModule
train
public function setLoadModule($var) { GPBUtil::checkMessage($var, \Google\Cloud\Trace\V2\Module::class);
php
{ "resource": "" }
q15141
SynthesizeSpeechConfig.setVoice
train
public function setVoice($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\VoiceSelectionParams::class);
php
{ "resource": "" }
q15142
Image.setInputConfig
train
public function setInputConfig($var) { GPBUtil::checkMessage($var,
php
{ "resource": "" }
q15143
BeginTransactionRequest.setTransactionOptions
train
public function setTransactionOptions($var) { GPBUtil::checkMessage($var, \Google\Cloud\Datastore\V1\TransactionOptions::class);
php
{ "resource": "" }
q15144
UpdateProductRequest.setProduct
train
public function setProduct($var) { GPBUtil::checkMessage($var,
php
{ "resource": "" }
q15145
BigQueryKey.setTableReference
train
public function setTableReference($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\BigQueryTable::class);
php
{ "resource": "" }
q15146
FailoverInstanceRequest.setDataProtectionMode
train
public function setDataProtectionMode($var) { GPBUtil::checkEnum($var, \Google\Cloud\Redis\V1beta1\FailoverInstanceRequest_DataProtectionMode::class);
php
{ "resource": "" }
q15147
ContextsGapicClient.contextName
train
public static function contextName($project, $session, $context) { return self::getContextNameTemplate()->render([ 'project' => $project,
php
{ "resource": "" }
q15148
ListMonitoredResourceDescriptorsResponse.setResourceDescriptors
train
public function setResourceDescriptors($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE,
php
{ "resource": "" }
q15149
BigtableInstanceAdminGapicClient.appProfileName
train
public static function appProfileName($project, $instance, $appProfile) { return self::getAppProfileNameTemplate()->render([ 'project' => $project,
php
{ "resource": "" }
q15150
BigtableInstanceAdminGapicClient.clusterName
train
public static function clusterName($project, $instance, $cluster) { return self::getClusterNameTemplate()->render([ 'project' => $project,
php
{ "resource": "" }
q15151
PartitionResponse.setPartitions
train
public function setPartitions($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE,
php
{ "resource": "" }
q15152
PartitionResponse.setTransaction
train
public function setTransaction($var) { GPBUtil::checkMessage($var,
php
{ "resource": "" }
q15153
CreateApplicationRequest.setApplication
train
public function setApplication($var) { GPBUtil::checkMessage($var,
php
{ "resource": "" }
q15154
TimestampTrait.formatDate
train
private function formatDate($when = null) { if (is_string($when)) { return $when; } elseif (!$when) { list($usec, $sec) = explode(' ', microtime()); $micro = sprintf("%06d", $usec * 1000000); $when = new \DateTime(date('Y-m-d H:i:s.' . $micro)); } elseif (is_numeric($when)) { // Expect that this is a timestamp
php
{ "resource": "" }
q15155
CreateDatasetRequest.setDataset
train
public function setDataset($var) { GPBUtil::checkMessage($var, \Google\Cloud\AutoMl\V1beta1\Dataset::class);
php
{ "resource": "" }
q15156
Instance.setState
train
public function setState($var) { GPBUtil::checkEnum($var, \Google\Cloud\Redis\V1beta1\Instance_State::class);
php
{ "resource": "" }
q15157
Instance.setTier
train
public function setTier($var) { GPBUtil::checkEnum($var, \Google\Cloud\Redis\V1beta1\Instance_Tier::class);
php
{ "resource": "" }
q15158
Item.setInfo
train
public function setInfo($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\Intent_Message
php
{ "resource": "" }
q15159
Item.setImage
train
public function setImage($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\Intent_Message_Image::class);
php
{ "resource": "" }
q15160
JobQuery.setPublishTimeRange
train
public function setPublishTimeRange($var) { GPBUtil::checkMessage($var, \Google\Cloud\Talent\V4beta1\TimestampRange::class);
php
{ "resource": "" }
q15161
JobQuery.setExcludedJobs
train
public function setExcludedJobs($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
php
{ "resource": "" }
q15162
ListJobsResponse.setJobs
train
public function setJobs($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE,
php
{ "resource": "" }
q15163
ListJobsResponse.setMetadata
train
public function setMetadata($var) { GPBUtil::checkMessage($var, \Google\Cloud\Talent\V4beta1\ResponseMetadata::class);
php
{ "resource": "" }
q15164
Action.setSaveFindings
train
public function setSaveFindings($var) { GPBUtil::checkMessage($var,
php
{ "resource": "" }
q15165
Action.setPubSub
train
public function setPubSub($var) { GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\Action_PublishToPubSub::class);
php
{ "resource": "" }
q15166
TemporalAsset.setWindow
train
public function setWindow($var) { GPBUtil::checkMessage($var,
php
{ "resource": "" }
q15167
GitHub.doesTagExist
train
public function doesTagExist($target, $tagName) { $res = $this->client->get(sprintf( self::GITHUB_RELEASES_ENDPOINT, $this->cleanTarget($target), $tagName ), [
php
{ "resource": "" }
q15168
GitHub.createRelease
train
public function createRelease($target, $tagName, $display, $notes) { $requestBody = [ 'tag_name' => $tagName, 'name' => $display, 'body' => $notes ]; $res = $this->client->post(sprintf( self::GITHUB_RELEASE_CREATE_ENDPOINT, $this->cleanTarget($target)
php
{ "resource": "" }
q15169
GitHub.push
train
public function push($target, $ref, $targetBranch = 'master', $force = true) { $cmd = [ 'git push -q', sprintf('https://%s@github.com/%s', $this->token, $target), sprintf('%s:%s', $ref, $targetBranch) ]; if
php
{ "resource": "" }
q15170
AlertPolicy.setDocumentation
train
public function setDocumentation($var) { GPBUtil::checkMessage($var, \Google\Cloud\Monitoring\V3\AlertPolicy_Documentation::class);
php
{ "resource": "" }
q15171
AlertPolicy.setConditions
train
public function setConditions($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE,
php
{ "resource": "" }
q15172
AlertPolicy.setCombiner
train
public function setCombiner($var) { GPBUtil::checkEnum($var, \Google\Cloud\Monitoring\V3\AlertPolicy_Cond
php
{ "resource": "" }
q15173
AlertPolicy.setCreationRecord
train
public function setCreationRecord($var) { GPBUtil::checkMessage($var,
php
{ "resource": "" }
q15174
AlertPolicy.setMutationRecord
train
public function setMutationRecord($var) { GPBUtil::checkMessage($var,
php
{ "resource": "" }
q15175
AnnotateTextRequest.setDocument
train
public function setDocument($var) { GPBUtil::checkMessage($var,
php
{ "resource": "" }
q15176
AnnotateTextRequest.setFeatures
train
public function setFeatures($var) { GPBUtil::checkMessage($var, \Google\Cloud\Language\V1\AnnotateTextRequest_Features::class);
php
{ "resource": "" }
q15177
AnnotateTextRequest.setEncodingType
train
public function setEncodingType($var) { GPBUtil::checkEnum($var, \Google\Cloud\Language\V1\EncodingType::class);
php
{ "resource": "" }
q15178
TransactionConfigurationTrait.transactionSelector
train
private function transactionSelector(array &$options, array $previous = []) { $options += [ 'begin' => false, 'transactionType' => SessionPoolInterface::CONTEXT_READ, ]; $res = $this->transactionOptions($options, $previous); // TransactionSelector uses a different key name for singleUseTransaction // and transactionId than transactionOptions, so we'll rewrite those here // so transactionOptions works as
php
{ "resource": "" }
q15179
TransactionConfigurationTrait.transactionOptions
train
private function transactionOptions(array &$options, array $previous = []) { $options += [ 'begin' => false, 'transactionType' => SessionPoolInterface::CONTEXT_READWRITE, 'transactionId' => null, ]; $type = null; $context = $this->pluck('transactionType', $options); $id = $this->pluck('transactionId', $options); $begin = $this->pluck('begin', $options); if ($id === null) { if ($begin) { $type = 'begin'; } else { $type = 'singleUseTransaction'; $options['singleUse'] = true; } } if ($id !== null) { $type = 'transactionId'; $transactionOptions = $id; } elseif ($context === SessionPoolInterface::CONTEXT_READ) { $transactionOptions
php
{ "resource": "" }
q15180
TransactionConfigurationTrait.configureSnapshotOptions
train
private function configureSnapshotOptions(array &$options, array $previous = []) { $options += [ 'singleUse' => false, 'returnReadTimestamp' => null, 'strong' => null, 'readTimestamp' => null, 'exactStaleness' => null, 'minReadTimestamp' => null, 'maxStaleness' => null, ]; $previousOptions = isset($previous['transactionOptions']['readOnly']) ? $previous['transactionOptions']['readOnly'] : []; // These are only available in single-use transactions. if (!$options['singleUse'] && ($options['maxStaleness'] || $options['minReadTimestamp'])) { throw new \BadMethodCallException( 'maxStaleness and minReadTimestamp are only available in single-use transactions.' ); } $transactionOptions = [ 'readOnly' => $this->arrayFilterRemoveNull([ 'returnReadTimestamp' => $this->pluck('returnReadTimestamp', $options), 'strong' => $this->pluck('strong', $options), 'minReadTimestamp' => $this->pluck('minReadTimestamp', $options), 'maxStaleness' => $this->pluck('maxStaleness', $options), 'readTimestamp' => $this->pluck('readTimestamp', $options), 'exactStaleness' => $this->pluck('exactStaleness', $options), ]) + $previousOptions ]; if (empty($transactionOptions['readOnly'])) { $transactionOptions['readOnly']['strong'] = true; } $timestampFields = [ 'minReadTimestamp', 'readTimestamp' ]; $durationFields = [ 'exactStaleness', 'maxStaleness' ]; foreach ($timestampFields as $tsf) { if (isset($transactionOptions['readOnly'][$tsf]) && !isset($previousOptions[$tsf])) { $field = $transactionOptions['readOnly'][$tsf]; if (!($field instanceof Timestamp)) { throw new \BadMethodCallException(sprintf(
php
{ "resource": "" }
q15181
RegistryCredential.setPublicKeyCertificate
train
public function setPublicKeyCertificate($var) { GPBUtil::checkMessage($var, \Google\Cloud\Iot\V1\PublicKeyCertificate::class);
php
{ "resource": "" }
q15182
StackFrame.setArguments
train
public function setArguments($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE,
php
{ "resource": "" }
q15183
StackFrame.setLocals
train
public function setLocals($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE,
php
{ "resource": "" }
q15184
ResourceGroup.setResourceType
train
public function setResourceType($var) { GPBUtil::checkEnum($var, \Google\Cloud\Monitoring\V3\GroupResourceType::class);
php
{ "resource": "" }
q15185
StreamWrapper.register
train
public static function register(StorageClient $client, $protocol = null) { $protocol = $protocol ?: self::DEFAULT_PROTOCOL; if (!in_array($protocol, stream_get_wrappers())) {
php
{ "resource": "" }
q15186
StreamWrapper.unregister
train
public static function unregister($protocol = null) { $protocol = $protocol ?: self::DEFAULT_PROTOCOL;
php
{ "resource": "" }
q15187
StreamWrapper.getClient
train
public static function getClient($protocol = null) { $protocol = $protocol ?:
php
{ "resource": "" }
q15188
StreamWrapper.stream_open
train
public function stream_open($path, $mode, $flags, &$openedPath) { $client = $this->openPath($path); // strip off 'b' or 't' from the mode $mode = rtrim($mode, 'bt'); $options = []; if ($this->context) { $contextOptions = stream_context_get_options($this->context); if (array_key_exists($this->protocol, $contextOptions)) { $options = $contextOptions[$this->protocol] ?: []; } } if ($mode == 'w') { $this->stream = new WriteStream(null, $options); $this->stream->setUploader( $this->bucket->getStreamableUploader( $this->stream, $options + ['name' => $this->file] ) ); } elseif ($mode == 'r') { try { // Lazy read from the source $options['restOptions']['stream'] = true;
php
{ "resource": "" }
q15189
StreamWrapper.stream_stat
train
public function stream_stat() { $mode = $this->stream->isWritable() ? self::FILE_WRITABLE_MODE
php
{ "resource": "" }
q15190
StreamWrapper.stream_seek
train
public function stream_seek($offset, $whence = SEEK_SET) { if ($this->stream->isSeekable()) {
php
{ "resource": "" }
q15191
StreamWrapper.dir_readdir
train
public function dir_readdir() { $object = $this->directoryIterator->current(); if ($object) {
php
{ "resource": "" }
q15192
StreamWrapper.dir_rewinddir
train
public function dir_rewinddir() { try { $this->directoryIterator = $this->bucket->objects([ 'prefix' => $this->file, 'fields' => 'items/name,nextPageToken' ]);
php
{ "resource": "" }
q15193
StreamWrapper.mkdir
train
public function mkdir($path, $mode, $options) { $path = $this->makeDirectory($path); $client = $this->openPath($path); $predefinedAcl = $this->determineAclFromMode($mode); try { if ($options & STREAM_MKDIR_RECURSIVE || $this->file == '') { if (!$this->bucket->exists()) { $client->createBucket($this->bucket->name(), [ 'predefinedAcl' => $predefinedAcl, 'predefinedDefaultObjectAcl' => $predefinedAcl ]); } } // If the file name is empty, we were trying to create a bucket. In this case, // don't create the placeholder file. if ($this->file != '') {
php
{ "resource": "" }
q15194
StreamWrapper.rename
train
public function rename($from, $to) { $url = (array) parse_url($to) + [ 'path' => '', 'host' => '' ]; $destinationBucket = $url['host']; $destinationPath = substr($url['path'], 1); $this->dir_opendir($from, []); foreach ($this->directoryIterator as $file) { $name = $file->name(); $newPath = str_replace($this->file, $destinationPath, $name); $obj = $this->bucket->object($name); try {
php
{ "resource": "" }
q15195
StreamWrapper.unlink
train
public function unlink($path) { $client = $this->openPath($path); $object = $this->bucket->object($this->file); try { $object->delete();
php
{ "resource": "" }
q15196
StreamWrapper.url_stat
train
public function url_stat($path, $flags) { $client = $this->openPath($path); // if directory if ($this->isDirectory($this->file)) {
php
{ "resource": "" }
q15197
StreamWrapper.openPath
train
private function openPath($path) { $url = (array) parse_url($path) + [ 'scheme' => '', 'path' => '', 'host' => '' ]; $this->protocol = $url['scheme']; $this->file = ltrim($url['path'], '/');
php
{ "resource": "" }
q15198
StreamWrapper.urlStatDirectory
train
private function urlStatDirectory() { $stats = []; // 1. try to look up the directory as a file try { $this->object = $this->bucket->object($this->file); $info = $this->object->info(); // equivalent to 40777 and 40444 in octal $stats['mode'] = $this->bucket->isWritable() ? self::DIRECTORY_WRITABLE_MODE : self::DIRECTORY_READABLE_MODE; $this->statsFromFileInfo($info, $stats); return $this->makeStatArray($stats); } catch (NotFoundException $e) { } catch (ServiceException $e) { return false; } // 2. try list files in that directory try { $objects = $this->bucket->objects([ 'prefix' => $this->file, ]); if (!$objects->current()) {
php
{ "resource": "" }
q15199
StreamWrapper.urlStatFile
train
private function urlStatFile() { try { $this->object = $this->bucket->object($this->file); $info = $this->object->info(); } catch (ServiceException $e) { // couldn't stat file return false; } // equivalent to 100666 and 100444 in octal $stats = array( 'mode' => $this->bucket->isWritable()
php
{ "resource": "" }