idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
2,200 | public function entries ( array $ options = [ ] ) { $ resultLimit = $ this -> pluck ( 'resultLimit' , $ options , false ) ; $ resourceNames = [ 'projects/' . $ this -> projectId ] ; if ( isset ( $ options [ 'projectIds' ] ) ) { foreach ( $ options [ 'projectIds' ] as $ projectId ) { $ resourceNames [ ] = 'projects/' . $ projectId ; } unset ( $ options [ 'projectIds' ] ) ; } if ( isset ( $ options [ 'resourceNames' ] ) ) { $ options [ 'resourceNames' ] = array_merge ( $ resourceNames , $ options [ 'projectIds' ] ) ; } else { $ options [ 'resourceNames' ] = $ resourceNames ; } return new ItemIterator ( new PageIterator ( function ( array $ entry ) { return new Entry ( $ entry ) ; } , [ $ this -> connection , 'listEntries' ] , $ options , [ 'itemsKey' => 'entries' , 'resultLimit' => $ resultLimit ] ) ) ; } | Fetches log entries . |
2,201 | public function psrLogger ( $ name , array $ options = [ ] ) { $ messageKey = null ; if ( isset ( $ options [ 'messageKey' ] ) ) { $ messageKey = $ options [ 'messageKey' ] ; unset ( $ options [ 'messageKey' ] ) ; } $ psrLoggerOptions = $ this -> pluckArray ( [ 'metadataProvider' , 'batchEnabled' , 'debugOutput' , 'batchOptions' , 'clientConfig' , 'batchRunner' , 'closureSerializer' , 'debugOutputResource' ] , $ options ) ; return new PsrLogger ( $ this -> logger ( $ name , $ options ) , $ messageKey , $ psrLoggerOptions + [ 'clientConfig' => $ this -> config ] ) ; } | Fetches a logger which will write log entries to Stackdriver Logging and implements the PSR - 3 specification . |
2,202 | public function logger ( $ name , array $ options = [ ] ) { return new Logger ( $ this -> connection , $ name , $ this -> projectId , isset ( $ options [ 'resource' ] ) ? $ options [ 'resource' ] : null , isset ( $ options [ 'labels' ] ) ? $ options [ 'labels' ] : null ) ; } | Fetches a logger which will write log entries to Stackdriver Logging . |
2,203 | public function setSources ( $ var ) { $ arr = GPBUtil :: checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType :: MESSAGE , \ Google \ Cloud \ SecurityCenter \ V1 \ Source :: class ) ; $ this -> sources = $ arr ; return $ this ; } | Sources belonging to the requested parent . |
2,204 | public function setClusterLabels ( $ var ) { $ arr = GPBUtil :: checkMapField ( $ var , \ Google \ Protobuf \ Internal \ GPBType :: STRING , \ Google \ Protobuf \ Internal \ GPBType :: STRING ) ; $ this -> cluster_labels = $ arr ; return $ this ; } | Required . The cluster labels . Cluster must have all labels to match . |
2,205 | public function upload ( $ data , array $ options = [ ] ) { if ( $ this -> isObjectNameRequired ( $ data ) && ! isset ( $ options [ 'name' ] ) ) { throw new \ InvalidArgumentException ( 'A name is required when data is of type string or null.' ) ; } $ encryptionKey = isset ( $ options [ 'encryptionKey' ] ) ? $ options [ 'encryptionKey' ] : null ; $ encryptionKeySHA256 = isset ( $ options [ 'encryptionKeySHA256' ] ) ? $ options [ 'encryptionKeySHA256' ] : null ; $ response = $ this -> connection -> insertObject ( $ this -> formatEncryptionHeaders ( $ options ) + $ this -> identity + [ 'data' => $ data ] ) -> upload ( ) ; return new StorageObject ( $ this -> connection , $ response [ 'name' ] , $ this -> identity [ 'bucket' ] , $ response [ 'generation' ] , $ response , $ encryptionKey , $ encryptionKeySHA256 ) ; } | Upload your data in a simple fashion . Uploads will default to being resumable if the file size is greater than 5mb . |
2,206 | public function getResumableUploader ( $ data , array $ options = [ ] ) { if ( $ this -> isObjectNameRequired ( $ data ) && ! isset ( $ options [ 'name' ] ) ) { throw new \ InvalidArgumentException ( 'A name is required when data is of type string or null.' ) ; } return $ this -> connection -> insertObject ( $ this -> formatEncryptionHeaders ( $ options ) + $ this -> identity + [ 'data' => $ data , 'resumable' => true ] ) ; } | Get a resumable uploader which can provide greater control over the upload process . This is recommended when dealing with large files where reliability is key . |
2,207 | public function getStreamableUploader ( $ data , array $ options = [ ] ) { if ( $ this -> isObjectNameRequired ( $ data ) && ! isset ( $ options [ 'name' ] ) ) { throw new \ InvalidArgumentException ( 'A name is required when data is of type string or null.' ) ; } return $ this -> connection -> insertObject ( $ this -> formatEncryptionHeaders ( $ options ) + $ this -> identity + [ 'data' => $ data , 'streamable' => true , 'validate' => false ] ) ; } | Get a streamable uploader which can provide greater control over the upload process . This is useful for generating large files and uploading the contents in chunks . |
2,208 | public function objects ( array $ options = [ ] ) { $ resultLimit = $ this -> pluck ( 'resultLimit' , $ options , false ) ; return new ObjectIterator ( new ObjectPageIterator ( function ( array $ object ) { return new StorageObject ( $ this -> connection , $ object [ 'name' ] , $ this -> identity [ 'bucket' ] , isset ( $ object [ 'generation' ] ) ? $ object [ 'generation' ] : null , $ object + array_filter ( [ 'requesterProjectId' => $ this -> identity [ 'userProject' ] ] ) ) ; } , [ $ this -> connection , 'listObjects' ] , $ options + $ this -> identity , [ 'resultLimit' => $ resultLimit ] ) ) ; } | Fetches all objects in the bucket . |
2,209 | public function createNotification ( $ topic , array $ options = [ ] ) { $ res = $ this -> connection -> insertNotification ( $ options + $ this -> identity + [ 'topic' => $ this -> getFormattedTopic ( $ topic ) , 'payload_format' => 'JSON_API_V1' ] ) ; return new Notification ( $ this -> connection , $ res [ 'id' ] , $ this -> identity [ 'bucket' ] , $ res + [ 'requesterProjectId' => $ this -> identity [ 'userProject' ] ] ) ; } | Create a Cloud PubSub notification . |
2,210 | public function notifications ( array $ options = [ ] ) { $ resultLimit = $ this -> pluck ( 'resultLimit' , $ options , false ) ; return new ItemIterator ( new PageIterator ( function ( array $ notification ) { return new Notification ( $ this -> connection , $ notification [ 'id' ] , $ this -> identity [ 'bucket' ] , $ notification + [ 'requesterProjectId' => $ this -> identity [ 'userProject' ] ] ) ; } , [ $ this -> connection , 'listNotifications' ] , $ options + $ this -> identity , [ 'resultLimit' => $ resultLimit ] ) ) ; } | Fetches all notifications associated with this bucket . |
2,211 | public function update ( array $ options = [ ] ) { if ( isset ( $ options [ 'lifecycle' ] ) && $ options [ 'lifecycle' ] instanceof Lifecycle ) { $ options [ 'lifecycle' ] = $ options [ 'lifecycle' ] -> toArray ( ) ; } return $ this -> info = $ this -> connection -> patchBucket ( $ options + $ this -> identity ) ; } | Update the bucket . Upon receiving a result the local bucket s data will be updated . |
2,212 | public function compose ( array $ sourceObjects , $ name , array $ options = [ ] ) { if ( count ( $ sourceObjects ) < 2 ) { throw new \ InvalidArgumentException ( 'Must provide at least two objects to compose.' ) ; } $ options += [ 'destinationBucket' => $ this -> name ( ) , 'destinationObject' => $ name , 'destinationPredefinedAcl' => isset ( $ options [ 'predefinedAcl' ] ) ? $ options [ 'predefinedAcl' ] : null , 'destination' => isset ( $ options [ 'metadata' ] ) ? $ options [ 'metadata' ] : null , 'userProject' => $ this -> identity [ 'userProject' ] , 'sourceObjects' => array_map ( function ( $ sourceObject ) { $ name = null ; $ generation = null ; if ( $ sourceObject instanceof StorageObject ) { $ name = $ sourceObject -> name ( ) ; $ generation = isset ( $ sourceObject -> identity ( ) [ 'generation' ] ) ? $ sourceObject -> identity ( ) [ 'generation' ] : null ; } return array_filter ( [ 'name' => $ name ? : $ sourceObject , 'generation' => $ generation ] ) ; } , $ sourceObjects ) ] ; if ( ! isset ( $ options [ 'destination' ] [ 'contentType' ] ) ) { $ options [ 'destination' ] [ 'contentType' ] = Psr7 \ mimetype_from_filename ( $ name ) ; } if ( $ options [ 'destination' ] [ 'contentType' ] === null ) { throw new \ InvalidArgumentException ( 'A content type could not be detected and must be provided manually.' ) ; } unset ( $ options [ 'metadata' ] ) ; unset ( $ options [ 'predefinedAcl' ] ) ; $ response = $ this -> connection -> composeObject ( array_filter ( $ options ) ) ; return new StorageObject ( $ this -> connection , $ response [ 'name' ] , $ this -> identity [ 'bucket' ] , $ response [ 'generation' ] , $ response + array_filter ( [ 'requesterProjectId' => $ this -> identity [ 'userProject' ] ] ) ) ; } | Composes a set of objects into a single object . |
2,213 | public function reload ( array $ options = [ ] ) { return $ this -> info = $ this -> connection -> getBucket ( $ options + $ this -> identity ) ; } | Triggers a network request to reload the bucket s details . |
2,214 | public function iam ( ) { if ( ! $ this -> iam ) { $ this -> iam = new Iam ( new IamBucket ( $ this -> connection ) , $ this -> identity [ 'bucket' ] , [ 'parent' => null , 'args' => $ this -> identity ] ) ; } return $ this -> iam ; } | Manage the IAM policy for the current Bucket . |
2,215 | public function lockRetentionPolicy ( array $ options = [ ] ) { if ( ! isset ( $ options [ 'ifMetagenerationMatch' ] ) ) { if ( ! isset ( $ this -> info [ 'metageneration' ] ) ) { throw new \ BadMethodCallException ( 'No metageneration value was detected. Please either provide ' . 'a value explicitly or ensure metadata is loaded through a ' . 'call such as Bucket::reload().' ) ; } $ options [ 'ifMetagenerationMatch' ] = $ this -> info [ 'metageneration' ] ; } return $ this -> info = $ this -> connection -> lockRetentionPolicy ( $ options + $ this -> identity ) ; } | Locks a provided retention policy on this bucket . Upon receiving a result the local bucket s data will be updated . |
2,216 | public function signedUrl ( $ expires , array $ options = [ ] ) { $ signingHelper = $ this -> pluck ( 'helper' , $ options , false ) ? : SigningHelper :: getHelper ( ) ; $ resource = sprintf ( '/%s' , $ this -> identity [ 'bucket' ] ) ; return $ signingHelper -> sign ( $ this -> connection , $ expires , $ resource , null , $ options ) ; } | Create a Signed URL listing objects in this bucket . |
2,217 | private function getFormattedTopic ( $ topic ) { if ( $ topic instanceof Topic ) { return sprintf ( self :: NOTIFICATION_TEMPLATE , $ topic -> name ( ) ) ; } if ( ! is_string ( $ topic ) ) { throw new \ InvalidArgumentException ( '$topic may only be a string or instance of Google\Cloud\PubSub\Topic' ) ; } if ( preg_match ( '/projects\/[^\/]*\/topics\/(.*)/' , $ topic ) === 1 ) { return sprintf ( self :: NOTIFICATION_TEMPLATE , $ topic ) ; } if ( ! $ this -> projectId ) { throw new GoogleException ( 'No project ID was provided, ' . 'and we were unable to detect a default project ID.' ) ; } return sprintf ( self :: NOTIFICATION_TEMPLATE , sprintf ( self :: TOPIC_TEMPLATE , $ this -> projectId , $ topic ) ) ; } | Return a topic name in its fully qualified format . |
2,218 | public function setSchedule ( $ var ) { GPBUtil :: checkMessage ( $ var , \ Google \ Cloud \ Dlp \ V2 \ Schedule :: class ) ; $ this -> writeOneof ( 1 , $ var ) ; return $ this ; } | Create a job on a repeating basis based on the elapse of time . |
2,219 | public function setFieldTransforms ( $ var ) { $ arr = GPBUtil :: checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType :: MESSAGE , \ Google \ Cloud \ Firestore \ V1beta1 \ DocumentTransform \ FieldTransform :: class ) ; $ this -> field_transforms = $ arr ; return $ this ; } | The list of transformations to apply to the fields of the document in order . This must not be empty . |
2,220 | public function setPayload ( $ var ) { $ arr = GPBUtil :: checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType :: MESSAGE , \ Google \ Cloud \ AutoMl \ V1beta1 \ AnnotationPayload :: class ) ; $ this -> payload = $ arr ; return $ this ; } | Prediction result . |
2,221 | public function setInterval ( $ var ) { GPBUtil :: checkMessage ( $ var , \ Google \ Cloud \ Monitoring \ V3 \ TimeInterval :: class ) ; $ this -> interval = $ var ; return $ this ; } | The time interval for which results should be returned . Only time series that contain data points in the specified interval are included in the response . |
2,222 | public function setAggregation ( $ var ) { GPBUtil :: checkMessage ( $ var , \ Google \ Cloud \ Monitoring \ V3 \ Aggregation :: class ) ; $ this -> aggregation = $ var ; return $ this ; } | By default the raw time series data is returned . Use this field to combine multiple time series for different views of the data . |
2,223 | public function setView ( $ var ) { GPBUtil :: checkEnum ( $ var , \ Google \ Cloud \ Monitoring \ V3 \ ListTimeSeriesRequest_TimeSeriesView :: class ) ; $ this -> view = $ var ; return $ this ; } | Specifies which information is returned about the time series . |
2,224 | public function setNormalizedBoundingBoxes ( $ var ) { $ arr = GPBUtil :: checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType :: MESSAGE , \ Google \ Cloud \ VideoIntelligence \ V1 \ NormalizedBoundingBox :: class ) ; $ this -> normalized_bounding_boxes = $ arr ; return $ this ; } | Normalized Bounding boxes in a frame . There can be more than one boxes if the same face is detected in multiple locations within the current frame . |
2,225 | public function setAuthenticationInfo ( $ var ) { GPBUtil :: checkMessage ( $ var , \ Google \ Cloud \ Audit \ AuthenticationInfo :: class ) ; $ this -> authentication_info = $ var ; return $ this ; } | Authentication information . |
2,226 | public function setRequestMetadata ( $ var ) { GPBUtil :: checkMessage ( $ var , \ Google \ Cloud \ Audit \ RequestMetadata :: class ) ; $ this -> request_metadata = $ var ; return $ this ; } | Metadata about the operation . |
2,227 | public function setConfig ( $ var ) { GPBUtil :: checkMessage ( $ var , \ Google \ Cloud \ Container \ V1 \ NodeConfig :: class ) ; $ this -> config = $ var ; return $ this ; } | The node configuration of the pool . |
2,228 | public function setAutoscaling ( $ var ) { GPBUtil :: checkMessage ( $ var , \ Google \ Cloud \ Container \ V1 \ NodePoolAutoscaling :: class ) ; $ this -> autoscaling = $ var ; return $ this ; } | Autoscaler configuration for this NodePool . Autoscaler is enabled only if a valid configuration is present . |
2,229 | public function setManagement ( $ var ) { GPBUtil :: checkMessage ( $ var , \ Google \ Cloud \ Container \ V1 \ NodeManagement :: class ) ; $ this -> management = $ var ; return $ this ; } | NodeManagement configuration for this NodePool . |
2,230 | public function setUptimeCheckConfigs ( $ var ) { $ arr = GPBUtil :: checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType :: MESSAGE , \ Google \ Cloud \ Monitoring \ V3 \ UptimeCheckConfig :: class ) ; $ this -> uptime_check_configs = $ arr ; return $ this ; } | The returned uptime check configurations . |
2,231 | public function setAvailableZones ( $ var ) { $ arr = GPBUtil :: checkMapField ( $ var , \ Google \ Protobuf \ Internal \ GPBType :: STRING , \ Google \ Protobuf \ Internal \ GPBType :: MESSAGE , \ Google \ Cloud \ Redis \ V1 \ ZoneMetadata :: class ) ; $ this -> available_zones = $ arr ; return $ this ; } | Output only . The set of available zones in the location . The map is keyed by the lowercase ID of each zone as defined by GCE . These keys can be specified in location_id or alternative_location_id fields when creating a Redis instance . |
2,232 | public function add ( $ name , $ type ) { $ invalidIntTypes = [ Database :: TYPE_STRUCT , Database :: TYPE_ARRAY ] ; if ( is_int ( $ type ) && in_array ( $ type , $ invalidIntTypes ) ) { throw new \ InvalidArgumentException ( '`Database::TYPE_ARRAY` and `Database::TYPE_STRUCT` are not valid as struct types. ' . 'Instead provide `Google\Cloud\Spanner\ArrayType` or `Google\Cloud\Spanner\StructType`.' ) ; } $ child = null ; if ( $ type instanceof StructType ) { $ child = $ type ; $ type = Database :: TYPE_STRUCT ; } elseif ( $ type instanceof ArrayType ) { $ child = $ type ; $ type = Database :: TYPE_ARRAY ; } if ( ! in_array ( $ type , ValueMapper :: $ allowedTypes ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Field type `%s` is not valid.' , $ type ) ) ; } $ this -> fields [ ] = [ 'name' => $ name , 'type' => $ type , 'child' => $ child ] ; return $ this ; } | Add a struct field definition . |
2,233 | public function setAppProfile ( $ var ) { GPBUtil :: checkMessage ( $ var , \ Google \ Cloud \ Bigtable \ Admin \ V2 \ AppProfile :: class ) ; $ this -> app_profile = $ var ; return $ this ; } | The app profile to be created . Fields marked OutputOnly will be ignored . |
2,234 | public function setExclusion ( $ var ) { GPBUtil :: checkMessage ( $ var , \ Google \ Cloud \ Logging \ V2 \ LogExclusion :: class ) ; $ this -> exclusion = $ var ; return $ this ; } | Required . New values for the existing exclusion . Only the fields specified in update_mask are relevant . |
2,235 | public static function spanName ( $ project , $ trace , $ span ) { return self :: getSpanNameTemplate ( ) -> render ( [ 'project' => $ project , 'trace' => $ trace , 'span' => $ span , ] ) ; } | Formats a string containing the fully - qualified path to represent a span resource . |
2,236 | private function applyEtagHeader ( array $ options , $ argName = 'etag' ) { if ( isset ( $ options [ $ argName ] ) ) { if ( ! isset ( $ options [ 'restOptions' ] ) ) { $ options [ 'restOptions' ] = [ ] ; } if ( ! isset ( $ options [ 'restOptions' ] [ 'headers' ] ) ) { $ options [ 'restOptions' ] [ 'headers' ] = [ ] ; } $ options [ 'restOptions' ] [ 'headers' ] [ 'If-Match' ] = $ options [ $ argName ] ; } return $ options ; } | Apply the If - Match header to requests requiring concurrency control . |
2,237 | public function setNetworkPolicy ( $ var ) { GPBUtil :: checkMessage ( $ var , \ Google \ Cloud \ Container \ V1 \ NetworkPolicy :: class ) ; $ this -> network_policy = $ var ; return $ this ; } | Configuration options for the NetworkPolicy feature . |
2,238 | public function setLocation ( $ var ) { GPBUtil :: checkMessage ( $ var , \ Google \ Cloud \ Dlp \ V2 \ Location :: class ) ; $ this -> location = $ var ; return $ this ; } | Where the content was found . |
2,239 | public function setSessionEntityType ( $ var ) { GPBUtil :: checkMessage ( $ var , \ Google \ Cloud \ Dialogflow \ V2 \ SessionEntityType :: class ) ; $ this -> session_entity_type = $ var ; return $ this ; } | Required . The session entity type to create . |
2,240 | public function setSink ( $ var ) { GPBUtil :: checkMessage ( $ var , \ Google \ Cloud \ Logging \ V2 \ LogSink :: class ) ; $ this -> sink = $ var ; return $ this ; } | Required . The new sink whose name parameter is a sink identifier that is not already in use . |
2,241 | public function setFrames ( $ var ) { $ arr = GPBUtil :: checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType :: MESSAGE , \ Google \ Cloud \ VideoIntelligence \ V1beta2 \ ExplicitContentFrame :: class ) ; $ this -> frames = $ arr ; return $ this ; } | All video frames where explicit content was detected . |
2,242 | public function setProjection ( $ var ) { $ arr = GPBUtil :: checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType :: MESSAGE , \ Google \ Cloud \ Datastore \ V1 \ Projection :: class ) ; $ this -> projection = $ arr ; return $ this ; } | The projection to return . Defaults to returning all properties . |
2,243 | public function setValidNodeVersions ( $ var ) { $ arr = GPBUtil :: checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType :: STRING ) ; $ this -> valid_node_versions = $ arr ; return $ this ; } | List of valid node upgrade target versions . |
2,244 | public function setValidImageTypes ( $ var ) { $ arr = GPBUtil :: checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType :: STRING ) ; $ this -> valid_image_types = $ arr ; return $ this ; } | List of valid image types . |
2,245 | public function setValidMasterVersions ( $ var ) { $ arr = GPBUtil :: checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType :: STRING ) ; $ this -> valid_master_versions = $ arr ; return $ this ; } | List of valid master versions . |
2,246 | public function setFrom ( $ var ) { $ arr = GPBUtil :: checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType :: MESSAGE , \ Google \ Cloud \ Firestore \ V1 \ StructuredQuery \ CollectionSelector :: class ) ; $ this -> from = $ arr ; return $ this ; } | The collections to query . |
2,247 | public function setStartAt ( $ var ) { GPBUtil :: checkMessage ( $ var , \ Google \ Cloud \ Firestore \ V1 \ Cursor :: class ) ; $ this -> start_at = $ var ; return $ this ; } | A starting point for the query results . |
2,248 | public function setConfig ( $ var ) { GPBUtil :: checkMessage ( $ var , \ Google \ Cloud \ Iot \ V1 \ DeviceConfig :: class ) ; $ this -> config = $ var ; return $ this ; } | The most recent device configuration which is eventually sent from Cloud IoT Core to the device . If not present on creation the configuration will be initialized with an empty payload and version value of 1 . To update this field after creation use the DeviceManager . ModifyCloudToDeviceConfig method . |
2,249 | public function setGatewayConfig ( $ var ) { GPBUtil :: checkMessage ( $ var , \ Google \ Cloud \ Iot \ V1 \ GatewayConfig :: class ) ; $ this -> gateway_config = $ var ; return $ this ; } | Gateway - related configuration and state . |
2,250 | public function setBreakpoints ( $ var ) { $ arr = GPBUtil :: checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType :: MESSAGE , \ Google \ Cloud \ Debugger \ V2 \ Breakpoint :: class ) ; $ this -> breakpoints = $ arr ; return $ this ; } | List of all active breakpoints . The fields id and location are guaranteed to be set on each breakpoint . |
2,251 | public function info ( ) { $ data = [ 'displayName' => [ 'value' => $ this -> name ] , 'spanId' => $ this -> spanId , 'startTime' => $ this -> startTime , 'endTime' => $ this -> endTime ] ; if ( $ this -> parentSpanId ) { $ data [ 'parentSpanId' ] = $ this -> parentSpanId ; } if ( $ this -> attributes ) { $ data [ 'attributes' ] = $ this -> attributes -> info ( ) ; } if ( $ this -> timeEvents ) { $ data [ 'timeEvents' ] = [ 'timeEvent' => array_map ( function ( $ timeEvent ) { return $ timeEvent -> info ( ) ; } , $ this -> timeEvents ) ] ; } if ( $ this -> links ) { $ data [ 'links' ] = [ 'link' => array_map ( function ( $ link ) { return $ link -> info ( ) ; } , $ this -> links ) ] ; } if ( $ this -> status ) { $ data [ 'status' ] = $ this -> status -> info ( ) ; } if ( $ this -> stackTrace ) { $ data [ 'stackTrace' ] = $ this -> stackTrace -> info ( ) ; } if ( $ this -> sameProcessAsParentSpan !== null ) { $ data [ 'sameProcessAsParentSpan' ] = $ this -> sameProcessAsParentSpan ; } return $ data ; } | Returns the info array for serialization . |
2,252 | public function addTimeEvent ( TimeEvent $ event ) { if ( ! $ this -> timeEvents ) { $ this -> timeEvents = [ ] ; } $ this -> timeEvents [ ] = $ event ; } | Add a single TimeEvent to this span . |
2,253 | public function addLink ( Link $ link ) { if ( ! $ this -> links ) { $ this -> links = [ ] ; } $ this -> links [ ] = $ link ; } | Add a single Link to this span . |
2,254 | public function keys ( $ kind , array $ options = [ ] ) { $ options += [ 'number' => 1 , 'ancestors' => [ ] , 'id' => null , 'name' => null ] ; if ( $ options [ 'number' ] < 1 ) { throw new \ InvalidArgumentException ( 'Number of keys cannot be less than 1.' ) ; } $ path = [ ] ; if ( count ( $ options [ 'ancestors' ] ) > 0 ) { $ path = $ options [ 'ancestors' ] ; } $ path [ ] = array_filter ( [ 'kind' => $ kind , 'id' => $ options [ 'id' ] , 'name' => $ options [ 'name' ] ] ) ; $ key = new Key ( $ this -> projectId , [ 'path' => $ path , 'namespaceId' => $ this -> namespaceId ] ) ; $ keys = [ $ key ] ; for ( $ i = 1 ; $ i < $ options [ 'number' ] ; $ i ++ ) { $ keys [ ] = clone $ key ; } return $ keys ; } | Create multiple keys with the same configuration . |
2,255 | public function entity ( $ key = null , array $ entity = [ ] , array $ options = [ ] ) { $ options += [ 'className' => null ] ; if ( $ key && ! is_string ( $ key ) && ! ( $ key instanceof Key ) ) { throw new \ InvalidArgumentException ( '$key must be an instance of Key or a string' ) ; } if ( is_string ( $ key ) ) { $ key = $ this -> key ( $ key ) ; } $ className = $ options [ 'className' ] ; if ( ! is_null ( $ className ) && ! is_subclass_of ( $ className , EntityInterface :: class ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Given classname %s must implement EntityInterface' , $ className ) ) ; } if ( is_null ( $ className ) ) { $ className = Entity :: class ; } return $ className :: build ( $ key , $ entity , $ options ) ; } | Create an entity |
2,256 | public function beginTransaction ( $ transactionOptions , array $ options = [ ] ) { $ res = $ this -> connection -> beginTransaction ( [ 'projectId' => $ this -> projectId , 'transactionOptions' => $ transactionOptions ] + $ options ) ; return $ res [ 'transaction' ] ; } | Begin a Datastore Transaction . |
2,257 | public function allocateIds ( array $ keys , array $ options = [ ] ) { $ this -> validateBatch ( $ keys , Key :: class , function ( $ key ) { if ( $ key -> state ( ) !== Key :: STATE_INCOMPLETE ) { throw new \ InvalidArgumentException ( sprintf ( 'Given $key is in an invalid state. Can only allocate IDs for incomplete keys. ' . 'Given path was %s' , ( string ) $ key ) ) ; } } ) ; $ serviceKeys = [ ] ; foreach ( $ keys as $ key ) { $ serviceKeys [ ] = $ key -> keyObject ( ) ; } $ res = $ this -> connection -> allocateIds ( [ 'projectId' => $ this -> projectId , 'keys' => $ serviceKeys ] + $ options ) ; if ( isset ( $ res [ 'keys' ] ) ) { foreach ( $ res [ 'keys' ] as $ index => $ key ) { if ( ! isset ( $ keys [ $ index ] ) ) { continue ; } $ end = end ( $ key [ 'path' ] ) ; $ id = $ end [ 'id' ] ; $ keys [ $ index ] -> setLastElementIdentifier ( $ id ) ; } } return $ keys ; } | Allocate available IDs to a set of keys |
2,258 | public function lookup ( array $ keys , array $ options = [ ] ) { $ options += [ 'className' => Entity :: class , 'sort' => false ] ; $ serviceKeys = [ ] ; $ this -> validateBatch ( $ keys , Key :: class , function ( $ key ) use ( & $ serviceKeys ) { if ( $ key -> state ( ) !== Key :: STATE_NAMED ) { throw new \ InvalidArgumentException ( sprintf ( 'Given $key is in an invalid state. Can only lookup records when given a complete key. ' . 'Given path was %s' , ( string ) $ key ) ) ; } $ serviceKeys [ ] = $ key -> keyObject ( ) ; } ) ; $ res = $ this -> connection -> lookup ( $ options + $ this -> readOptions ( $ options ) + [ 'projectId' => $ this -> projectId , 'keys' => $ serviceKeys ] ) ; $ result = [ ] ; if ( isset ( $ res [ 'found' ] ) ) { foreach ( $ res [ 'found' ] as $ found ) { $ result [ 'found' ] [ ] = $ this -> mapEntityResult ( $ found , $ options [ 'className' ] ) ; } if ( $ options [ 'sort' ] ) { $ result [ 'found' ] = $ this -> sortEntities ( $ result [ 'found' ] , $ keys ) ; } } if ( isset ( $ res [ 'missing' ] ) ) { $ result [ 'missing' ] = [ ] ; foreach ( $ res [ 'missing' ] as $ missing ) { $ key = $ this -> key ( $ missing [ 'entity' ] [ 'key' ] [ 'path' ] , $ missing [ 'entity' ] [ 'key' ] [ 'partitionId' ] ) ; $ result [ 'missing' ] [ ] = $ key ; } } if ( isset ( $ res [ 'deferred' ] ) ) { $ result [ 'deferred' ] = [ ] ; foreach ( $ res [ 'deferred' ] as $ deferred ) { $ key = $ this -> key ( $ deferred [ 'path' ] , $ deferred [ 'partitionId' ] ) ; $ result [ 'deferred' ] [ ] = $ key ; } } return $ result ; } | Lookup records by key |
2,259 | public function runQuery ( QueryInterface $ query , array $ options = [ ] ) { $ options += [ 'className' => Entity :: class , 'namespaceId' => $ this -> namespaceId ] ; $ iteratorConfig = [ 'itemsKey' => 'batch.entityResults' , 'resultTokenKey' => 'query.startCursor' , 'nextResultTokenKey' => 'batch.endCursor' , 'setNextResultTokenCondition' => function ( $ res ) use ( $ query ) { if ( isset ( $ res [ 'batch' ] [ 'moreResults' ] ) ) { $ moreResultsType = $ res [ 'batch' ] [ 'moreResults' ] ; if ( is_numeric ( $ moreResultsType ) ) { $ moreResultsType = MoreResultsType :: name ( $ moreResultsType ) ; } return $ query -> canPaginate ( ) && $ moreResultsType === 'NOT_FINISHED' ; } return false ; } ] ; $ runQueryObj = clone $ query ; $ runQueryFn = function ( array $ args = [ ] ) use ( & $ runQueryObj , $ options ) { $ args += [ 'query' => [ ] ] ; $ requestQueryArr = $ args [ 'query' ] + $ runQueryObj -> queryObject ( ) ; $ request = [ 'projectId' => $ this -> projectId , 'partitionId' => $ this -> partitionId ( $ this -> projectId , $ options [ 'namespaceId' ] ) , $ runQueryObj -> queryKey ( ) => $ requestQueryArr ] + $ this -> readOptions ( $ options ) + $ options ; $ res = $ this -> connection -> runQuery ( $ request ) ; if ( isset ( $ res [ 'query' ] ) ) { $ runQueryObj = new Query ( $ this -> entityMapper , $ res [ 'query' ] ) ; } return $ res ; } ; return new EntityIterator ( new EntityPageIterator ( function ( array $ entityResult ) use ( $ options ) { return $ this -> mapEntityResult ( $ entityResult , $ options [ 'className' ] ) ; } , $ runQueryFn , [ ] , $ iteratorConfig ) ) ; } | Run a query and return entities |
2,260 | public function commit ( array $ mutations , array $ options = [ ] ) { $ options += [ 'transaction' => null ] ; $ res = $ this -> connection -> commit ( $ options + [ 'mode' => ( $ options [ 'transaction' ] ) ? 'TRANSACTIONAL' : 'NON_TRANSACTIONAL' , 'mutations' => $ mutations , 'projectId' => $ this -> projectId ] ) ; return $ res ; } | Commit all mutations |
2,261 | public function allocateIdsToEntities ( array $ entities ) { $ this -> validateBatch ( $ entities , EntityInterface :: class ) ; $ incompleteKeys = [ ] ; foreach ( $ entities as $ entity ) { if ( $ entity -> key ( ) -> state ( ) === Key :: STATE_INCOMPLETE ) { $ incompleteKeys [ ] = $ entity -> key ( ) ; } } if ( ! empty ( $ incompleteKeys ) ) { $ keys = $ this -> allocateIds ( $ incompleteKeys ) ; } return $ entities ; } | Patch any incomplete keys in the given array of entities |
2,262 | public function mutation ( $ operation , $ input , $ type , $ baseVersion = null ) { if ( $ input instanceof EntityInterface ) { $ baseVersion = $ input -> baseVersion ( ) ; $ data = $ this -> entityMapper -> objectToRequest ( $ input ) ; if ( ! $ input -> key ( ) ) { throw new \ InvalidArgumentException ( 'Base entities must provide a datastore key.' ) ; } } elseif ( $ input instanceof Key ) { $ data = $ input -> keyObject ( ) ; } else { throw new \ InvalidArgumentException ( sprintf ( 'Input must be a Key or Entity, %s given' , get_class ( $ input ) ) ) ; } return array_filter ( [ $ operation => $ data , 'baseVersion' => $ baseVersion ] ) ; } | Enqueue a mutation |
2,263 | public function checkOverwrite ( array $ entities , $ allowOverwrite = false ) { $ this -> validateBatch ( $ entities , EntityInterface :: class ) ; foreach ( $ entities as $ entity ) { if ( ! $ entity -> populatedByService ( ) && ! $ allowOverwrite ) { throw new \ InvalidArgumentException ( sprintf ( 'Given entity cannot be saved because it may overwrite an ' . 'existing record. When updating manually created entities, ' . 'please set the options `$allowOverwrite` flag to `true`. ' . 'Invalid entity key was %s' , ( string ) $ entity -> key ( ) ) ) ; } } } | Check whether an update or upsert operation may proceed safely |
2,264 | private function mapEntityResult ( array $ result , $ class ) { $ entity = $ result [ 'entity' ] ; $ namespaceId = ( isset ( $ entity [ 'key' ] [ 'partitionId' ] [ 'namespaceId' ] ) ) ? $ entity [ 'key' ] [ 'partitionId' ] [ 'namespaceId' ] : null ; $ key = new Key ( $ this -> projectId , [ 'path' => $ entity [ 'key' ] [ 'path' ] , 'namespaceId' => $ namespaceId ] ) ; if ( is_array ( $ class ) ) { $ lastPathElement = $ key -> pathEnd ( ) ; if ( ! array_key_exists ( $ lastPathElement [ 'kind' ] , $ class ) ) { throw new \ InvalidArgumentException ( sprintf ( 'No class found for kind %s' , $ lastPathElement [ 'kind' ] ) ) ; } $ className = $ class [ $ lastPathElement [ 'kind' ] ] ; } else { $ className = $ class ; } $ properties = [ ] ; $ excludes = [ ] ; $ meanings = [ ] ; if ( isset ( $ entity [ 'properties' ] ) ) { $ res = $ this -> entityMapper -> responseToEntityProperties ( $ entity [ 'properties' ] , $ className ) ; $ properties = $ res [ 'properties' ] ; $ excludes = $ res [ 'excludes' ] ; $ meanings = $ res [ 'meanings' ] ; } return $ this -> entity ( $ key , $ properties , [ 'cursor' => ( isset ( $ result [ 'cursor' ] ) ) ? $ result [ 'cursor' ] : null , 'baseVersion' => ( isset ( $ result [ 'version' ] ) ) ? $ result [ 'version' ] : null , 'className' => $ className , 'populatedByService' => true , 'excludeFromIndexes' => $ excludes , 'meanings' => $ meanings ] ) ; } | Convert an EntityResult into an array of entities |
2,265 | private function readOptions ( array $ options = [ ] ) { $ options += [ 'readConsistency' => null , 'transaction' => null ] ; $ readOptions = array_filter ( [ 'readConsistency' => $ options [ 'readConsistency' ] , 'transaction' => $ options [ 'transaction' ] ] ) ; return array_filter ( [ 'readOptions' => $ readOptions ] ) ; } | Format the readOptions |
2,266 | public function setInstance ( $ var ) { GPBUtil :: checkMessage ( $ var , \ Google \ Cloud \ Bigtable \ Admin \ V2 \ Instance :: class ) ; $ this -> instance = $ var ; return $ this ; } | The instance to create . Fields marked OutputOnly must be left blank . |
2,267 | public function setLastAttempt ( $ var ) { GPBUtil :: checkMessage ( $ var , \ Google \ Cloud \ Tasks \ V2 \ Attempt :: class ) ; $ this -> last_attempt = $ var ; return $ this ; } | Output only . The status of the task s last attempt . |
2,268 | public function setInspectResult ( $ var ) { GPBUtil :: checkMessage ( $ var , \ Google \ Cloud \ Dlp \ V2 \ InspectResult :: class ) ; $ this -> inspect_result = $ var ; return $ this ; } | The findings . Populated when include_findings in the request is true . |
2,269 | public function setTranslationDatasetMetadata ( $ var ) { GPBUtil :: checkMessage ( $ var , \ Google \ Cloud \ AutoMl \ V1beta1 \ TranslationDatasetMetadata :: class ) ; $ this -> writeOneof ( 23 , $ var ) ; return $ this ; } | Metadata for a dataset used for translation . |
2,270 | public function setImageClassificationDatasetMetadata ( $ var ) { GPBUtil :: checkMessage ( $ var , \ Google \ Cloud \ AutoMl \ V1beta1 \ ImageClassificationDatasetMetadata :: class ) ; $ this -> writeOneof ( 24 , $ var ) ; return $ this ; } | Metadata for a dataset used for image classification . |
2,271 | public function setTextClassificationDatasetMetadata ( $ var ) { GPBUtil :: checkMessage ( $ var , \ Google \ Cloud \ AutoMl \ V1beta1 \ TextClassificationDatasetMetadata :: class ) ; $ this -> writeOneof ( 25 , $ var ) ; return $ this ; } | Metadata for a dataset used for text classification . |
2,272 | public function setSparkSqlJob ( $ var ) { GPBUtil :: checkMessage ( $ var , \ Google \ Cloud \ Dataproc \ V1beta2 \ SparkSqlJob :: class ) ; $ this -> writeOneof ( 12 , $ var ) ; return $ this ; } | Job is a SparkSql job . |
2,273 | public function setStatusHistory ( $ var ) { $ arr = GPBUtil :: checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType :: MESSAGE , \ Google \ Cloud \ Dataproc \ V1beta2 \ JobStatus :: class ) ; $ this -> status_history = $ arr ; return $ this ; } | Output only . The previous job status . |
2,274 | public static function init ( PsrLogger $ psrLogger = null ) { self :: $ psrLogger = $ psrLogger ? : ( new LoggingClient ( ) ) -> psrLogger ( self :: DEFAULT_LOGNAME , [ 'batchEnabled' => true , 'debugOutput' => true , 'batchOptions' => [ 'numWorkers' => 2 ] ] ) ; register_shutdown_function ( [ self :: class , 'shutdownHandler' ] ) ; set_exception_handler ( [ self :: class , 'exceptionHandler' ] ) ; set_error_handler ( [ self :: class , 'errorHandler' ] ) ; } | Register hooks for error reporting . |
2,275 | public static function getErrorPrefix ( $ level ) { switch ( $ level ) { case E_PARSE : $ prefix = 'PHP Parse error' ; break ; case E_ERROR : case E_CORE_ERROR : case E_COMPILE_ERROR : $ prefix = 'PHP Fatal error' ; break ; case E_USER_ERROR : case E_RECOVERABLE_ERROR : $ prefix = 'PHP error' ; break ; case E_WARNING : case E_CORE_WARNING : case E_COMPILE_WARNING : case E_USER_WARNING : $ prefix = 'PHP Warning' ; break ; case E_NOTICE : case E_USER_NOTICE : $ prefix = 'PHP Notice' ; break ; case E_STRICT : $ prefix = 'PHP Debug' ; break ; default : $ prefix = 'PHP Notice' ; } return $ prefix ; } | Return a string prefix for the given error level . |
2,276 | public static function getErrorLevelString ( $ level ) { switch ( $ level ) { case E_PARSE : return 'CRITICAL' ; case E_ERROR : case E_CORE_ERROR : case E_COMPILE_ERROR : case E_USER_ERROR : case E_RECOVERABLE_ERROR : return 'ERROR' ; case E_WARNING : case E_CORE_WARNING : case E_COMPILE_WARNING : case E_USER_WARNING : return 'WARNING' ; case E_NOTICE : case E_USER_NOTICE : return 'NOTICE' ; case E_STRICT : return 'DEBUG' ; default : return 'NOTICE' ; } } | Return an error level string for the given PHP error level . |
2,277 | public static function shutdownHandler ( ) { if ( $ err = error_get_last ( ) ) { switch ( $ err [ 'type' ] ) { case E_ERROR : case E_PARSE : case E_COMPILE_ERROR : case E_CORE_ERROR : $ service = self :: $ psrLogger -> getMetadataProvider ( ) -> serviceId ( ) ; $ version = self :: $ psrLogger -> getMetadataProvider ( ) -> versionId ( ) ; $ message = sprintf ( '%s: %s in %s on line %d' , self :: getErrorPrefix ( $ err [ 'type' ] ) , $ err [ 'message' ] , $ err [ 'file' ] , $ err [ 'line' ] ) ; $ context = [ 'context' => [ 'reportLocation' => [ 'filePath' => $ err [ 'file' ] , 'lineNumber' => $ err [ 'line' ] , 'functionName' => self :: getFunctionNameForReport ( ) , ] ] , 'serviceContext' => [ 'service' => $ service , 'version' => $ version ] ] ; if ( self :: $ psrLogger ) { self :: $ psrLogger -> log ( self :: getErrorLevelString ( $ err [ 'type' ] ) , $ message , $ context ) ; } break ; } } } | Called at exit to check there s a fatal error and report the error if any . |
2,278 | public function setJobEvent ( $ var ) { GPBUtil :: checkMessage ( $ var , \ Google \ Cloud \ Talent \ V4beta1 \ JobEvent :: class ) ; $ this -> writeOneof ( 5 , $ var ) ; return $ this ; } | An event issued when a job seeker interacts with the application that implements Cloud Talent Solution . |
2,279 | public function setProfileEvent ( $ var ) { GPBUtil :: checkMessage ( $ var , \ Google \ Cloud \ Talent \ V4beta1 \ ProfileEvent :: class ) ; $ this -> writeOneof ( 6 , $ var ) ; return $ this ; } | An event issued when a profile searcher interacts with the application that implements Cloud Talent Solution . |
2,280 | public function setPysparkJob ( $ var ) { GPBUtil :: checkMessage ( $ var , \ Google \ Cloud \ Dataproc \ V1beta2 \ PySparkJob :: class ) ; $ this -> writeOneof ( 4 , $ var ) ; return $ this ; } | Job is a Pyspark job . |
2,281 | public function setPrerequisiteStepIds ( $ var ) { $ arr = GPBUtil :: checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType :: STRING ) ; $ this -> prerequisite_step_ids = $ arr ; return $ this ; } | Optional . The optional list of prerequisite job step_ids . If not specified the job will start at the beginning of workflow . |
2,282 | public function setDailyMaintenanceWindow ( $ var ) { GPBUtil :: checkMessage ( $ var , \ Google \ Cloud \ Container \ V1 \ DailyMaintenanceWindow :: class ) ; $ this -> writeOneof ( 2 , $ var ) ; return $ this ; } | DailyMaintenanceWindow specifies a daily maintenance operation window . |
2,283 | public function setGatewayType ( $ var ) { GPBUtil :: checkEnum ( $ var , \ Google \ Cloud \ Iot \ V1 \ GatewayType :: class ) ; $ this -> gateway_type = $ var ; return $ this ; } | Indicates whether the device is a gateway . |
2,284 | public function setSinks ( $ var ) { $ arr = GPBUtil :: checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType :: MESSAGE , \ Google \ Cloud \ Logging \ V2 \ LogSink :: class ) ; $ this -> sinks = $ arr ; return $ this ; } | A list of sinks . |
2,285 | public function setGcsSource ( $ var ) { GPBUtil :: checkMessage ( $ var , \ Google \ Cloud \ Vision \ V1 \ ImportProductSetsGcsSource :: class ) ; $ this -> writeOneof ( 1 , $ var ) ; return $ this ; } | The Google Cloud Storage location for a csv file which preserves a list of ImportProductSetRequests in each line . |
2,286 | public function jobConfigurationProperties ( $ projectId , array $ config , $ location ) { $ this -> config = array_replace_recursive ( [ 'projectId' => $ projectId , 'jobReference' => [ 'projectId' => $ projectId ] ] , $ config ) ; if ( $ location && ! isset ( $ this -> config [ 'jobReference' ] [ 'location' ] ) ) { $ this -> config [ 'jobReference' ] [ 'location' ] = $ location ; } if ( ! isset ( $ this -> config [ 'jobReference' ] [ 'jobId' ] ) ) { $ this -> config [ 'jobReference' ] [ 'jobId' ] = $ this -> generateJobId ( ) ; } } | Sets shared job configuration properties . |
2,287 | public function toArray ( ) { if ( $ this -> jobIdPrefix ) { $ this -> config [ 'jobReference' ] [ 'jobId' ] = sprintf ( '%s-%s' , $ this -> jobIdPrefix , $ this -> config [ 'jobReference' ] [ 'jobId' ] ) ; } return $ this -> config ; } | Returns the job config as an array . |
2,288 | 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.' ) ; } $ this -> state = self :: STATE_SINGLE_USE_USED ; return true ; } return false ; } | Check the transaction state and update as necessary for single - use transactions . |
2,289 | private function checkReadContext ( ) { if ( $ this -> type === self :: TYPE_SINGLE_USE && $ this -> context === SessionPoolInterface :: CONTEXT_READWRITE ) { throw new \ BadMethodCallException ( 'Cannot use a single-use read-write transaction for read or execute.' ) ; } } | Check whether the context is valid for a read operation . Reads are not allowed in single - use read - write transactions . |
2,290 | public function setWorkspaceId ( $ var ) { GPBUtil :: checkMessage ( $ var , \ Google \ Cloud \ DevTools \ Source \ V1 \ CloudWorkspaceId :: class ) ; $ this -> workspace_id = $ var ; return $ this ; } | The ID of the workspace . |
2,291 | public function setEntityOverrideMode ( $ var ) { GPBUtil :: checkEnum ( $ var , \ Google \ Cloud \ Dialogflow \ V2 \ SessionEntityType_EntityOverrideMode :: class ) ; $ this -> entity_override_mode = $ var ; return $ this ; } | Required . Indicates whether the additional data should override or supplement the developer entity type definition . |
2,292 | public function requestObject ( $ encode = true ) { return array_filter ( [ 'image' => $ this -> imageObject ( $ encode ) , 'features' => $ this -> features , 'imageContext' => $ this -> options [ 'imageContext' ] ] ) ; } | Return a formatted annotate image request . |
2,293 | 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 ) { $ string = $ this -> image ; return [ 'content' => ( $ encode ) ? base64_encode ( $ string ) : $ string ] ; } return [ 'source' => [ 'imageUri' => $ this -> image ] ] ; } | Create an image object . |
2,294 | 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 ] ; } $ result [ ] = array_filter ( [ 'type' => $ feature , 'maxResults' => $ maxResults ] ) ; } return $ result ; } | Normalizes short feature names to identifiers compatible with the vision API and adds maxResults if specified . |
2,295 | private function maxResult ( $ feature ) { return ( isset ( $ this -> options [ 'maxResults' ] [ $ feature ] ) ) ? $ this -> options [ 'maxResults' ] [ $ feature ] : null ; } | Identify and return a maxResults value for a given feature if maxResults is specified . |
2,296 | public function setProductCategories ( $ var ) { $ arr = GPBUtil :: checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType :: STRING ) ; $ this -> product_categories = $ arr ; return $ this ; } | The list of product categories to search in . Currently we only consider the first category and either homegoods apparel or toys should be specified . |
2,297 | public function reload ( array $ options = [ ] ) { $ this -> info = $ this -> connection -> getInstanceConfig ( $ options + [ 'name' => $ this -> name , 'projectId' => $ this -> projectId ] ) ; return $ this -> info ; } | Fetch a fresh representation of the configuration from the service . |
2,298 | private function fullyQualifiedConfigName ( $ name , $ projectId ) { try { return InstanceAdminClient :: instanceConfigName ( $ projectId , $ name ) ; } catch ( ValidationException $ e ) { return $ name ; } } | Get the fully qualified instance config name . |
2,299 | public function setRequests ( $ var ) { $ arr = GPBUtil :: checkRepeatedField ( $ var , \ Google \ Protobuf \ Internal \ GPBType :: MESSAGE , \ Google \ Cloud \ Vision \ V1 \ AsyncAnnotateFileRequest :: class ) ; $ this -> requests = $ arr ; return $ this ; } | Individual async file annotation requests for this batch . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.