Enhanced exception class for TeamSpeak3 objects.
More...
Enhanced exception class for TeamSpeak3 objects.
◆ __construct()
__construct |
( |
|
$mesg, |
|
|
|
$code = 0x00 |
|
) |
| |
The TeamSpeak3_Exception constructor.
- Parameters
-
- Returns
- TeamSpeak3_Exception
47 parent::__construct($mesg, $code);
49 if(array_key_exists((
int) $code, self::$messages))
static getInstance()
Returns a singleton instance of TeamSpeak3_Helper_Signal.
Definition: Signal.php:201
prepareCustomMessage(TeamSpeak3_Helper_String $mesg)
Prepares a custom error message by replacing pre-defined signs with given values. ...
Definition: Exception.php:63
◆ getSender()
Returns the class from which the exception was thrown.
- Returns
- string
122 $trace = $this->getTrace();
124 return (isset($trace[0][
"class"])) ? $trace[0][
"class"] :
"{main}";
◆ prepareCustomMessage()
Prepares a custom error message by replacing pre-defined signs with given values.
- Parameters
-
- Returns
- TeamSpeak3_Helper_String
66 "code" => $this->getCode(),
67 "mesg" => $this->getMessage(),
68 "line" => $this->getLine(),
69 "file" => $this->getFile(),
72 return $mesg->
arg($args)->toString();
arg(array $args, $char="%")
This function replaces indexed or associative signs with given values.
Definition: String.php:94
◆ registerCustomMessage()
static registerCustomMessage |
( |
|
$code, |
|
|
|
$mesg |
|
) |
| |
|
static |
Registers a custom error message to $code.
- Parameters
-
- Exceptions
-
- Returns
- void
85 if(array_key_exists((
int) $code, self::$messages))
87 throw new self(
"custom message for code 0x" . strtoupper(dechex($code)) .
" is already registered");
92 throw new self(
"custom message for code 0x" . strtoupper(dechex($code)) .
" must be a string");
Helper class for string handling.
Definition: String.php:29
◆ unregisterCustomMessage()
static unregisterCustomMessage |
( |
|
$code | ) |
|
|
static |
Unregisters a custom error message from $code.
- Parameters
-
- Exceptions
-
- Returns
- void
107 if(!array_key_exists((
int) $code, self::$messages))
109 throw new self(
"custom message for code 0x" . strtoupper(dechex($code)) .
" is not registered");
112 unset(self::$messages[(
int) $code]);
The documentation for this class was generated from the following file:
- /Volumes/home/Repositories/planetteamspeak/ts3phpframework/libraries/TeamSpeak3/Exception.php