Google\Cloud\PubSub\ResourceNameTrait::formatName PHP Метод

formatName() публичный Метод

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]
Результат string
    public function formatName($type, $name, $projectId = null)
    {
        if (!isset($this->templates[$type])) {
            throw new InvalidArgumentException(sprintf('Template `%s` is not defined', $type));
        }
        return vsprintf($this->templates[$type], [$name, $projectId]);
    }