/** * Creates a new Event object. * * @param StringHelper $evt * @param Host $con * @throws Ts3Exception * @return Event */ public function __construct(StringHelper $evt, Host $con = null) { if (!$evt->startsWith(TeamSpeak3::EVENT)) { throw new Ts3Exception("invalid notification event format"); } list($type, $data) = $evt->split(TeamSpeak3::SEPARATOR_CELL, 2); if (empty($data)) { throw new Ts3Exception("invalid notification event data"); } $fake = new StringHelper(TeamSpeak3::ERROR . TeamSpeak3::SEPARATOR_CELL . "id" . TeamSpeak3::SEPARATOR_PAIR . 0 . TeamSpeak3::SEPARATOR_CELL . "msg" . TeamSpeak3::SEPARATOR_PAIR . "ok"); $repl = new Reply(array($data, $fake), $type); $this->type = $type->substr(strlen(TeamSpeak3::EVENT)); $this->data = $repl->toList(); $this->mesg = $data; Signal::getInstance()->emit("notifyEvent", $this, $con); Signal::getInstance()->emit("notify" . ucfirst($this->type), $this, $con); }