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

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

@param  string $name
@return string
@throws \InvalidArgumentException
Convert a fully - qualified name into a simple name .