You are here

public function Channel::__toString in Rocket.Chat 8.2

File

modules/rocket_chat_api/src/RocketChat/Element/Channel.php, line 131

Class

Channel

Namespace

Drupal\rocket_chat_api\RocketChat\Element

Code

public function __toString() {
  $ret = "#" . $this
    ->getChannelName();
  if ($this
    ->hasType(self::PRIVATE_CHANNEL)) {
    $ret .= " [Private Channel]";
  }
  if ($this
    ->hasType(self::PUBLIC_CHANNEL)) {
    $ret .= " [Public Channel]";
  }
  $perms = "";
  if ($this
    ->hasType(self::READ)) {
    $perms .= "READABLE,";
  }
  if ($this
    ->hasType(self::WRITE)) {
    $perms .= "WRITABLE,";
  }
  if ($this
    ->hasType(self::BROADCAST)) {
    $perms .= "BROADCAST,";
  }
  $perms = rtrim($perms, ",");
  $ret .= " ({$perms})";
  return $ret;
}