]> git.mxchange.org Git - core.git/blobdiff - inc/classes/main/debug/class_DebugErrorLogOutput.php
Added stripTags (default: false) to allow stripping out HTML tags
[core.git] / inc / classes / main / debug / class_DebugErrorLogOutput.php
index fcc7f65952c95c6a062bd68c4751e8bd53956a3c..22fe5598f367ccf81e1f1bfd8f2b26d1c83f6670 100644 (file)
@@ -4,7 +4,7 @@
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core Developer Team
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.ship-simu.org
  *
@@ -37,7 +37,7 @@ class DebugErrorLogOutput extends BaseFrameworkSystem implements Debugger, Outpu
         *
         * @return      $debugInstance  The prepared debug instance
         */
-       public final static function createDebugErrorLogOutput () {
+       public static final function createDebugErrorLogOutput () {
                // Get a new instance
                $debugInstance = new DebugErrorLogOutput();
 
@@ -46,47 +46,54 @@ class DebugErrorLogOutput extends BaseFrameworkSystem implements Debugger, Outpu
        }
 
        /**
-        * Outputs the given data without HTML tags
+        * Outputs the given data without HTML tags, ignores $stripTags
         *
         * @param       $output         The HTML'ed output
+        * @param       $stripTags      Whether HTML tags shall be stripped out
         * @return      void
         */
-       public final function outputStream ($output) {
+       public final function outputStream ($output, $stripTags = false) {
                // Split multiple lines into and array to put them out line-by-line
-               $errorLines = explode("\n", $output);
+               $errorLines = explode(chr(10), $output);
+
+               // "Walk" through all lines
                foreach ($errorLines as $err) {
+                       // Trim any spaces, \n, \r etc. out
                        $err = trim($err);
+
                        // Log only none-empty lines
                        if (!empty($err)) {
                                // Log this line
                                error_log(html_entity_decode(strip_tags($err)), 0);
-                       }
-               }
-       }
-
-       /**
-        * Assigns a variable for output
-        *
-        * @param       $var    The variable we shall assign
-        * @param       $value  The value to store in the variable
-        * @return      void
-        */
-       public final function assignVariable ($var, $value) {
-               // Empty stub!
-               trigger_error(__METHOD__.": Stub!");
+                       } // END - if
+               } // END - foreach
        }
 
        /**
         * Output the code
         *
+        * @param       $outStream      Stream to output
+        * @param       $stripTags      Whether HTML tags shall be stripped out
         * @return      void
         */
-       public final function output ($outStream = false) {
+       public final function output ($outStream = false, $stripTags = false) {
                // Empty output will be silently ignored
                if ($outStream !== false) {
                        $this->outputStream($outStream);
                }
        }
+
+       /**
+        * Streams the data and maybe does something to it
+        *
+        * @param       $data   The data (string mostly) to "stream"
+        * @return      $data   The data (string mostly) to "stream"
+        * @throws      UnsupportedOperationException   If this method is called
+        */
+       public function streamData ($data) {
+               $this->debugOutput('Unhandled ' . strlen($data) . ' bytes in this stream.');
+               throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
+       }
 }
 
 // [EOF]