TeamSpeak 3 PHP Framework  1.1.12
TeamSpeak3_Helper_Exception Class Reference

Enhanced exception class for TeamSpeak3_Helper_* objects. More...

Inheritance diagram for TeamSpeak3_Helper_Exception:
TeamSpeak3_Exception TeamSpeak3_Helper_Profiler_Exception TeamSpeak3_Helper_Signal_Exception

List of all members.

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_Helper_* objects.

Definition at line 32 of file Exception.php.


Member Function Documentation

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 
) [static, inherited]

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) [static, inherited]

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)]);
  }

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:
 All Classes Files Functions Variables