PHP Trait Google\Cloud\PubSub\ResourceNameTrait

Datei anzeigen Open project: GoogleCloudPlatform/gcloud-php

Public Methods

Method Description
formatName ( string $type, string $name, string $projectId = null ) : string Convert a simple name into the fully-qualified name required by the API.
isFullyQualifiedName ( string $type, string $name ) : boolean Check if a name of a give type is a fully-qualified resource name.
pluckName ( $type, string $name ) : string Convert a fully-qualified name into a simple name.

Method Details

formatName() public method

Example: $topic = $pubsub->topic('my-topic-name'); echo $topic->formatName('topic', $name); // projects/my-awesome-project/topics/my-topic-name
public formatName ( string $type, string $name, string $projectId = null ) : string
$type string
$name string
$projectId string [optional]
return string

isFullyQualifiedName() public method

Example: $topic = $pubsub->topic('my-topic-name'); if ($topic->isFullyQualifiedName('project', 'projects/my-awesome-project/topics/my-topic-name')) { do stuff }
public isFullyQualifiedName ( string $type, string $name ) : boolean
$type string
$name string
return boolean

pluckName() public method

Example: $topic = $pubsub->topic('projects/my-awesome-project/topics/my-topic-name'); echo $topic->pluckName('topic', $name); // my-topic-name
public pluckName ( $type, string $name ) : string
$name string
return string