New method replaceControlCharacters() introduced (very basic implementation), typo...
authorRoland Häder <roland@mxchange.org>
Tue, 22 Dec 2009 15:43:40 +0000 (15:43 +0000)
committerRoland Häder <roland@mxchange.org>
Tue, 22 Dec 2009 15:43:40 +0000 (15:43 +0000)
inc/classes/exceptions/stacker/class_NoStackerException.php
inc/classes/main/class_BaseFrameworkSystem.php

index f610d27..a8639bc 100644 (file)
@@ -31,7 +31,7 @@ class NoStackerException extends FrameworkException {
         */
        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]
index 10b6723..ecca050 100644 (file)
@@ -236,7 +236,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                        // 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);
@@ -731,6 +731,25 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                ));
        }
 
+       /**
+        * 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
         *