public function __construct(ConnectionInterface $connection, $projectId, $name, $topicName, $encode, array $info = null)
{
$this->connection = $connection;
$this->projectId = $projectId;
$this->encode = (bool) $encode;
$this->info = $info;
// Accept either a simple name or a fully-qualified name.
if ($this->isFullyQualifiedName('subscription', $name)) {
$this->name = $name;
} else {
$this->name = $this->formatName('subscription', $name, $projectId);
}
// Accept either a simple name or a fully-qualified name.
if ($this->isFullyQualifiedName('topic', $topicName)) {
$this->topicName = $topicName;
} else {
$this->topicName = !is_null($topicName) ? $this->formatName('topic', $topicName, $projectId) : null;
}
$iamConnection = new IamSubscription($this->connection);
$this->iam = new Iam($iamConnection, $this->name);
}