TeamSpeak 3 PHP Framework
Modern use-at-will framework that provides individual components to manage TeamSpeak 3 Server instances
TeamSpeak3_Adapter_ServerQuery_Event Class Reference

Provides methods to analyze and format a ServerQuery event. More...

Inherits ArrayAccess.

Public Member Functions

 __construct (TeamSpeak3_Helper_String $evt, TeamSpeak3_Node_Host $con=null)
 Creates a new TeamSpeak3_Adapter_ServerQuery_Event object. More...
 
 __get ($offset)
 
 __set ($offset, $value)
 
 getData ()
 Returns the event data array. More...
 
 getMessage ()
 Returns the event data as an unparsed string. More...
 
 getType ()
 Returns the event type string. More...
 
 offsetExists ($offset)
 
 offsetGet ($offset)
 
 offsetSet ($offset, $value)
 
 offsetUnset ($offset)
 

Detailed Description

Provides methods to analyze and format a ServerQuery event.

Constructor & Destructor Documentation

◆ __construct()

__construct ( TeamSpeak3_Helper_String  $evt,
TeamSpeak3_Node_Host  $con = null 
)

Creates a new TeamSpeak3_Adapter_ServerQuery_Event object.

Parameters
TeamSpeak3_Helper_String$evt
TeamSpeak3_Node_Host$con
Exceptions
TeamSpeak3_Adapter_Exception
Returns
TeamSpeak3_Adapter_ServerQuery_Event
61  {
62  if(!$evt->startsWith(TeamSpeak3::EVENT))
63  {
64  throw new TeamSpeak3_Adapter_Exception("invalid notification event format");
65  }
66 
67  list($type, $data) = $evt->split(TeamSpeak3::SEPARATOR_CELL, 2);
68 
69  if(empty($data))
70  {
71  throw new TeamSpeak3_Adapter_Exception("invalid notification event data");
72  }
73 
75  $repl = new TeamSpeak3_Adapter_ServerQuery_Reply(array($data, $fake), $type);
76 
77  $this->type = $type->substr(strlen(TeamSpeak3::EVENT));
78  $this->data = $repl->toList();
79  $this->mesg = $data;
80 
81  TeamSpeak3_Helper_Signal::getInstance()->emit("notifyEvent", $this, $con);
82  TeamSpeak3_Helper_Signal::getInstance()->emit("notify" . ucfirst($this->type), $this, $con);
83  }
Helper class for string handling.
Definition: String.php:29
const SEPARATOR_CELL
protocol cell separator
Definition: TeamSpeak3.php:76
static getInstance()
Returns a singleton instance of TeamSpeak3_Helper_Signal.
Definition: Signal.php:201
split($separator, $limit=0)
Splits the string into substrings wherever $separator occurs.
Definition: String.php:218
Provides methods to analyze and format a ServerQuery reply.
Definition: Reply.php:29
const SEPARATOR_PAIR
protocol pair separator
Definition: TeamSpeak3.php:77
const ERROR
TeamSpeak 3 protocol error message prefix.
Definition: TeamSpeak3.php:44
Enhanced exception class for TeamSpeak3_Adapter_Abstract objects.
Definition: Exception.php:29
startsWith($pattern)
Returns true if the string starts with $pattern.
Definition: String.php:115
const EVENT
TeamSpeak 3 protocol event message prefix.
Definition: TeamSpeak3.php:49

Member Function Documentation

◆ getData()

getData ( )

Returns the event data array.

Returns
array
101  {
102  return $this->data;
103  }

◆ getMessage()

getMessage ( )

Returns the event data as an unparsed string.

Returns
TeamSpeak3_Helper_String
111  {
112  return $this->mesg;
113  }

◆ getType()

getType ( )

Returns the event type string.

Returns
TeamSpeak3_Helper_String
91  {
92  return $this->type;
93  }

The documentation for this class was generated from the following file: