public function subscribe()
    {
        if ($this->type == "subscription") {
            throw new Exceptions\ChannelException("Already subscribed to this channel.");
        }

        if (!empty($this->myChannel)) {
            throw new Exceptions\ChannelException("Cannot subscribe to own channel.");
        }

        try {
            return new Channel(
                Connection::sendCurlRequest(Connection::URL_SUBSCRIPTIONS, 'POST', ['channel_tag' => $this->channelTag],
                    true, $this->apiKey), $this->apiKey
            );
        } catch (Exceptions\ConnectionException $e) {
            if ($e->getCode() === 400) {
                throw new Exceptions\NotFoundException("Channel does not exist.");
            } else {
                throw $e;
            }
        }
    }
public function subscribe()
    {
        if ($this->type == "subscription") {
            throw new Exceptions\ChannelException("Already subscribed to this channel.");
        }

        if (!empty($this->myChannel)) {
            throw new Exceptions\ChannelException("Cannot subscribe to own channel.");
        }

        try {
            return new Channel(
                Connection::sendCurlRequest(Connection::URL_SUBSCRIPTIONS, 'POST', ['channel_tag' => $this->channelTag],
                    true, $this->apiKey), $this->apiKey
            );
        } catch (Exceptions\ConnectionException $e) {
            if ($e->getCode() === 400) {
                throw new Exceptions\NotFoundException("Channel does not exist.");
            } else {
                throw $e;
            }
        }
    }
public function subscribe ( ) { if ( $ this -> type == "subscription" ) { throw new Exceptions \ ChannelException ( "Already subscribed to this channel." ) ; } if ( ! empty ( $ this -> myChannel ) ) { throw new Exceptions \ ChannelException ( "Cannot subscribe to own channel." ) ; } try { return new Channel ( Connection :: sendCurlRequest ( Connection :: URL_SUBSCRIPTIONS , 'POST' , [ 'channel_tag' => $ this -> channelTag ] , true , $ this -> apiKey ) , $ this -> apiKey ) ; } catch ( Exceptions \ ConnectionException $ e ) { if ( $ e -> getCode ( ) === 400 ) { throw new Exceptions \ NotFoundException ( "Channel does not exist." ) ; } else { throw $ e ; } } }
Subscribe to the channel.

@return Channel Subscription.
@throws Exceptions\ConnectionException
@throws Exceptions\NotFoundException
@throws Exceptions\ChannelException
Subscribe to the channel .