Google\Cloud\PubSub\ResourceNameTrait::pluckName PHP Method

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
    public function pluckName($type, $name)
    {
        if (!isset($this->regexes[$type])) {
            throw new InvalidArgumentException(sprintf('Regex `%s` is not defined', $type));
        }
        $matches = [];
        $res = preg_match($this->regexes[$type], $name, $matches);
        return $res === 1 ? $matches[1] : null;
    }