/** * When silent mode is off this function will output debug message and break appliaction flow. * Otherwise message will be added to log * * @param string $message * @return void */ public static function debug($message) { $backtrace = debug_backtrace(); // Remove info about self from backtrace array_shift($backtrace); $msg = ' <p><strong>Requested URL</strong>: ' . Server::getAbsoluteURL() . '</p> <p><strong>Debug message</strong>: ' . $message . '</p> <p><strong>Backtrace:</strong><br> <pre>' . print_r($backtrace, true) . '</pre></p>'; if (self::$silentMode) { self::$log[] = $msg; } else { echo $msg; exit; } }