*/
public function __construct(array $messageArray, $code) {
// Construct message
- $message = sprintf("[%s:%d] Stacker %s is not intialized.",
+ $message = sprintf("[%s:%d] Stacker %s is not initialized.",
$messageArray[0]->__toString(),
$this->getLine(),
$messageArray[1]
// Some arguments are there
foreach ($args as $arg) {
// Add the type
- $argsString .= $arg . ' (' . gettype($arg);
+ $argsString .= $this->replaceControlCharacters($arg) . ' (' . gettype($arg);
// Add length if type is string
if (gettype($arg) == 'string') $argsString .= ', '.strlen($arg);
));
}
+ /**
+ * Replaces control characters with printable output
+ *
+ * @param $str String with control characters
+ * @return $str Replaced string
+ */
+ protected function replaceControlCharacters ($str) {
+ // Replace them
+ $str = str_replace(
+ "\r", '[r]', str_replace(
+ "\n", '[n]', str_replace(
+ "\t", '[t]',
+ $str
+ )));
+
+ // Return it
+ return $str;
+ }
+
/**
* Output a partial stub message for the caller method
*