/**
  * Connect to TeamSpeak3 server
  */
 function __construct($logger, $channel = null)
 {
     $cfg = new Config($logger);
     $this->config = $cfg->get();
     $this->logger = $logger;
     $this->channel = $channel;
     $TsServerConfig = array($this->config['teamspeak']['user'], $this->config['teamspeak']['password'], $this->config['teamspeak']['host'], $this->config['teamspeak']['server_port']);
     $serverUri = vsprintf("serverquery://%s:%s@%s/?server_port=%d", $TsServerConfig);
     try {
         $this->ts3Server = TeamSpeak3::factory($serverUri);
     } catch (\Exception $e) {
         $logger->critical('[slack-teamspeak-integration] Fail to connect to the TeamSpeak server');
     }
 }
 /**
  * EventWorker constructor.
  *
  * @param $logger
  */
 public function __construct($logger)
 {
     $cfg = new Config($logger);
     $this->config = $cfg->get();
     $this->logger = $logger;
     $TsServerConfig = array($this->config['teamspeak']['user'], $this->config['teamspeak']['password'], $this->config['teamspeak']['host'], $this->config['teamspeak']['server_port']);
     $serverUri = vsprintf("serverquery://%s:%s@%s/?server_port=%d&blocking=0", $TsServerConfig);
     try {
         $this->ts3Server = TeamSpeak3::factory($serverUri);
     } catch (\Exception $e) {
         echo '[slack-teamspeak-integration] Fail to connect to the TeamSpeak server';
         exit;
     }
     // Listen for user connection / disconnection from the server
     $this->ts3Server->notifyRegister(self::EVENT_CATEGORY);
     Signal::getInstance()->subscribe(self::EVENT_CONNECT, array($this, self::EVENT_CONNECT));
     Signal::getInstance()->subscribe(self::EVENT_DISCONNECT, array($this, self::EVENT_DISCONNECT));
 }