$message = (string) $message;
$code = (int) $code;
- // make sure everything is assigned properly
+ // Make sure everything is assigned properly
parent::__construct($message, $code);
}
/**
* Getter for hex-decimal code
*
+ * @param $code Integer code to encode in hex
* @return $hexCode The exception code in hex-decimal format
*/
- public final function getHexCode () {
+ public final function getHexCode ($code = null) {
// Get the decimal code
- $code = $this->getCode();
+ if (is_null($code)) $code = $this->getCode();
// Format it to hex-decimal, 0x as prefix and 3 chars
$hexCode = sprintf("0x%03s", dechex($code));