TeamSpeak 3 PHP Framework  1.1.16
Copyright © Planet TeamSpeak. All rights reserved.
 All Classes Namespaces Files Functions Variables Pages
TeamSpeak3_Adapter_ServerQuery_Exception Class Reference

Enhanced exception class for TeamSpeak3_Adapter_ServerQuery objects. More...

+ Inheritance diagram for TeamSpeak3_Adapter_ServerQuery_Exception:

Public Member Functions

 getSender ()
 Returns the class from which the exception was thrown.
 

Static Public Member Functions

static registerCustomMessage ($code, $mesg)
 Registers a custom error message to $code.
 
static unregisterCustomMessage ($code)
 Unregisters a custom error message from $code.
 

Protected Member Functions

 prepareCustomMessage (TeamSpeak3_Helper_String $mesg)
 Prepares a custom error message by replacing pre-defined signs with given values.
 

Static Protected Attributes

static $messages = array()
 

Detailed Description

Enhanced exception class for TeamSpeak3_Adapter_ServerQuery objects.

Definition at line 32 of file Exception.php.

Member Function Documentation

TeamSpeak3_Exception::prepareCustomMessage ( TeamSpeak3_Helper_String  $mesg)
protectedinherited

Prepares a custom error message by replacing pre-defined signs with given values.

Parameters
TeamSpeak3_Helper_String$mesg
Returns
TeamSpeak3_Helper_String

Definition at line 66 of file Exception.php.

References TeamSpeak3_Helper_String\arg().

Referenced by TeamSpeak3_Exception\__construct().

{
$args = array(
"code" => $this->getCode(),
"mesg" => $this->getMessage(),
"line" => $this->getLine(),
"file" => $this->getFile(),
);
return $mesg->arg($args)->toString();
}
static TeamSpeak3_Exception::registerCustomMessage (   $code,
  $mesg 
)
staticinherited

Registers a custom error message to $code.

Parameters
integer$code
string$mesg
Exceptions
TeamSpeak3_Exception
Returns
void

Definition at line 86 of file Exception.php.

{
if(array_key_exists((int) $code, self::$messages))
{
throw new self("custom message for code 0x" . strtoupper(dechex($code)) . " is already registered");
}
if(!is_string($mesg))
{
throw new self("custom message for code 0x" . strtoupper(dechex($code)) . " must be a string");
}
self::$messages[(int) $code] = new TeamSpeak3_Helper_String($mesg);
}
static TeamSpeak3_Exception::unregisterCustomMessage (   $code)
staticinherited

Unregisters a custom error message from $code.

Parameters
integer$code
Exceptions
TeamSpeak3_Exception
Returns
void

Definition at line 108 of file Exception.php.

{
if(!array_key_exists((int) $code, self::$messages))
{
throw new self("custom message for code 0x" . strtoupper(dechex($code)) . " is not registered");
}
unset(self::$messages[intval($code)]);
}
TeamSpeak3_Exception::getSender ( )
inherited

Returns the class from which the exception was thrown.

Returns
string

Definition at line 123 of file Exception.php.

{
$trace = $this->getTrace();
return (isset($trace[0]["class"])) ? $trace[0]["class"] : "{main}";
}

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