- // Simply output it
- print($message . PHP_EOL);
- }
-
- /**
- * Outputs a debug message whether to debug instance (should be set!) or
- * dies with or ptints the message. Do NEVER EVER rewrite the exit() call to
- * ApplicationEntryPoint::app_exit(), this would cause an endless loop.
- *
- * @param $message Message we shall send out...
- * @param $doPrint Whether print or die here (default: print)
- * @paran $stripTags Whether to strip tags (default: false)
- * @return void
- */
- public function debugOutput (string $message, bool $doPrint = true, bool $stripTags = false) {
- // Set debug instance to NULL
- $debugInstance = NULL;
-
- // Get backtrace
- $backtrace = debug_backtrace(!DEBUG_BACKTRACE_PROVIDE_OBJECT);
-
- // Is function partialStub/__callStatic ?
- if (isset(self::$stubMethods[$backtrace[1]['function']])) {
- // Prepend class::function:line from 3rd element
- $message = sprintf('[%s::%s:%d]: %s',
- $backtrace[2]['class'],
- $backtrace[2]['function'],
- (isset($backtrace[2]['line']) ? $backtrace[2]['line'] : '0'),
- $message
- );
- } else {
- // Prepend class::function:line from 2nd element
- $message = sprintf('[%s::%s:%d]: %s',
- $backtrace[1]['class'],
- $backtrace[1]['function'],
- (isset($backtrace[1]['line']) ? $backtrace[1]['line'] : '0'),
- $message
- );
- }
-
- // Try it:
- try {
- // Get debug instance
- $debugInstance = $this->getDebugInstance();
- } catch (NullPointerException $e) {
- // The debug instance is not set (yet)