public function channel($tag)
    {
        if ($this->channels === null) {
            $this->getChannelSubscriptions();
        }

        if ($this->myChannels === null) {
            $this->getMyChannels();
        }

        foreach ($this->myChannels as $c) {
            if ($tag == $c->tag) {
                $c->myChannel = true;

                return $c;
            }
        }

        foreach ($this->channels as $c) {
            if ($tag == $c->channel->tag) {
                return $c;
            }
        }

        return new Channel(["tag" => $tag], $this->apiKey);
    }
public function channel($tag)
    {
        if ($this->channels === null) {
            $this->getChannelSubscriptions();
        }

        if ($this->myChannels === null) {
            $this->getMyChannels();
        }

        foreach ($this->myChannels as $c) {
            if ($tag == $c->tag) {
                $c->myChannel = true;

                return $c;
            }
        }

        foreach ($this->channels as $c) {
            if ($tag == $c->channel->tag) {
                return $c;
            }
        }

        return new Channel(["tag" => $tag], $this->apiKey);
    }
public function channel ( $ tag ) { if ( $ this -> channels === null ) { $ this -> getChannelSubscriptions ( ) ; } if ( $ this -> myChannels === null ) { $ this -> getMyChannels ( ) ; } foreach ( $ this -> myChannels as $ c ) { if ( $ tag == $ c -> tag ) { $ c -> myChannel = true ; return $ c ; } } foreach ( $ this -> channels as $ c ) { if ( $ tag == $ c -> channel -> tag ) { return $ c ; } } return new Channel ( [ "tag" => $ tag ] , $ this -> apiKey ) ; }
Target a channel to create, subscribe to, unsubscribe from, or get information.

@param string $tag Channel tag.

@return Channel Channel or a subscription to a channel.
If you need information about a channel, and not a subscription to one, it is
recommended to use the <code>getChannelInformation()</code> method and access the properties
of the object it returns.
@throws Exceptions\ConnectionException
@throws Exceptions\InvalidTokenException
Target a channel to create subscribe to unsubscribe from or get information .