PubSub/src/ResourceNameTrait.php
private 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]);
    }
private 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]);
    }
private 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 ] ) ; }
Convert a simple name into the fully-qualified name required by
the API.

Example:
```
$topic = $pubsub->topic('my-topic-name');
echo $topic->formatName('topic', $name); // `projects/my-awesome-project/topics/my-topic-name`
```

@param  string $type
@param  string $name
@param  string $projectId [optional]
@return string
@throws \InvalidArgumentException
Convert a simple name into the fully - qualified name required by the API .