Show variable debug info.
@param mixed $var
@param bool $dump = true
@param bool $stop = true
@return void
325709
public static function vd($var, bool $dump = true, bool $stop = true, int $obLevel = 0): void
    {
        if ($stop) {
            while (ob_get_level() > $obLevel) {
                ob_end_clean();
            }
        }
        
        ob_start();
        if (empty($_SERVER['DOCUMENT_ROOT'])) {
            $dump ? var_dump($var) : print_r($var);
            echo PHP_EOL . str_replace("=>\n", '  =>', ob_get_clean());
        } else {
            echo '<pre>';
            $dump ? var_dump($var) : print_r($var);
            echo htmlspecialchars(str_replace("=>\n", '  =>', ob_get_clean()));
            echo '</pre>';
        }
        
        if ($stop) {
            throw new DebugStopExecutionException();
        }
    }
609377
protected function print_debug($sql, array $params=null, $obj=null) {
        if (!$this->get_debug()) {
            return;
        }
        if (CLI_SCRIPT) {
            $separator = "--------------------------------\n";
            echo $separator;
            echo "{$sql}\n";
            if (!is_null($params)) {
                echo "[" . var_export($params, true) . "]\n";
            }
            echo $separator;
        } else if (AJAX_SCRIPT) {
            $separator = "--------------------------------";
            error_log($separator);
            error_log($sql);
            if (!is_null($params)) {
                error_log("[" . var_export($params, true) . "]");
            }
            error_log($separator);
        } else {
            $separator = "<hr />\n";
            echo $separator;
            echo s($sql) . "\n";
            if (!is_null($params)) {
                echo "[" . s(var_export($params, true)) . "]\n";
            }
            echo $separator;
        }
    }
600498
public static function dump($var, $to=null)
	{
		$console = self::getInstance();
		$console->addVar($var);

		echo $console->render($to);
		$console->clear();
	}
1287335
public static function dump($val, HTTPRequest $request = null)
    {
        echo self::create_debug_view($request)
            ->renderVariable($val, self::caller());
    }
194025
public static function dump($data, bool $exit = false) : void
    {
        echo "<pre>dump \n---------------------- \n\n" . print_r($data, true) . "\n----------------------</pre>";
        if ($exit) exit;
    }
11100
public static function var_dump($var, $return = false, $expandLevel = 1)
    {
        self::$hasArray = false;
        $toggScript = 'var colToggle = function(toggID) {var img = document.getElementById(toggID);if (document.getElementById(toggID + "-collapsable").style.display == "none") {document.getElementById(toggID + "-collapsable").style.display = "inline";setImg(toggID, 0);var previousSibling = document.getElementById(toggID + "-collapsable").previousSibling;while (previousSibling != null && (previousSibling.nodeType != 1 || previousSibling.tagName.toLowerCase() != "br")) {previousSibling = previousSibling.previousSibling;}} else {document.getElementById(toggID + "-collapsable").style.display = "none";setImg(toggID, 1);var previousSibling = document.getElementById(toggID + "-collapsable").previousSibling; while (previousSibling != null && (previousSibling.nodeType != 1 || previousSibling.tagName.toLowerCase() != "br")) {previousSibling = previousSibling.previousSibling;}}};';
        $imgScript = 'var setImg = function(objID,imgID,addStyle) {var imgStore = ["data:image/png;base64,' . self::$icon_collapse . '", "data:image/png;base64,' . self::$icon_expand . '"];if (objID) {document.getElementById(objID).setAttribute("src", imgStore[imgID]);if (addStyle){document.getElementById(objID).setAttribute("style", "position:relative;left:-5px;top:-1px;cursor:pointer;");}}};';
        $jsCode = preg_replace('/ +/', ' ', '<script>' . $toggScript . $imgScript . '</script>');
        $html = '<pre style="margin-bottom: 18px;' .
            'background: #f7f7f9;' .
            'border: 1px solid #e1e1e8;' .
            'padding: 8px;' .
            'border-radius: 4px;' .
            '-moz-border-radius: 4px;' .
            '-webkit-border radius: 4px;' .
            'display: block;' .
            'font-size: 12.05px;' .
            'white-space: pre-wrap;' .
            'word-wrap: break-word;' .
            'color: #333;' .
            'font-family: Menlo,Monaco,Consolas,\'Courier New\',monospace;">';
        $done  = array();
        $html .= self::recursiveVarDumpHelper($var, intval($expandLevel), 0, $done);
        $html .= '</pre>';

        if (self::$hasArray) {
            $html = $jsCode . $html;
        }

        if (!$return) {
            echo $html;
        }

        return $html;
    }
1297869
public static function debug($frame, $binary_mode = false)
    {
        if ($binary_mode) {

                foreach ($frame as &$frameLine) {
                    $frameLine = join('<span class="m">&nbsp;&nbsp;</span>', explode('0', $frameLine));
                    $frameLine = join('&#9608;&#9608;', explode('1', $frameLine));
                }

                ?>
            <style>
                .m { background-color: white; }
            </style>
            <?php
                echo '<pre><tt><br/ ><br/ ><br/ >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
                echo join("<br/ >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", $frame);
                echo '</tt></pre><br/ ><br/ ><br/ ><br/ ><br/ ><br/ >';

        } else {

            foreach ($frame as &$frameLine) {
                $frameLine = join('<span class="m">&nbsp;</span>',  explode("\xc0", $frameLine));
                $frameLine = join('<span class="m">&#9618;</span>', explode("\xc1", $frameLine));
                $frameLine = join('<span class="p">&nbsp;</span>',  explode("\xa0", $frameLine));
                $frameLine = join('<span class="p">&#9618;</span>', explode("\xa1", $frameLine));
                $frameLine = join('<span class="s">&#9671;</span>', explode("\x84", $frameLine)); //format 0
                $frameLine = join('<span class="s">&#9670;</span>', explode("\x85", $frameLine)); //format 1
                $frameLine = join('<span class="x">&#9762;</span>', explode("\x81", $frameLine)); //special bit
                $frameLine = join('<span class="c">&nbsp;</span>',  explode("\x90", $frameLine)); //clock 0
                $frameLine = join('<span class="c">&#9719;</span>', explode("\x91", $frameLine)); //clock 1
                $frameLine = join('<span class="f">&nbsp;</span>',  explode("\x88", $frameLine)); //version
                $frameLine = join('<span class="f">&#9618;</span>', explode("\x89", $frameLine)); //version
                $frameLine = join('&#9830;', explode("\x01", $frameLine));
                $frameLine = join('&#8901;', explode("\0", $frameLine));
            }

            ?>
            <style>
                .p { background-color: yellow; }
                .m { background-color: #00FF00; }
                .s { background-color: #FF0000; }
                .c { background-color: aqua; }
                .x { background-color: pink; }
                .f { background-color: gold; }
            </style>
            <?php
            echo "<pre><tt>";
            echo join("<br/ >", $frame);
            echo "</tt></pre>";

        }
    }
881235
public static function dump(...$vars)
    {
        $line = str_repeat('-', 80);
        echo '<pre>' . PHP_EOL;
        echo $line . PHP_EOL;
        foreach ($vars as $var) {
            var_dump($var);
            echo PHP_EOL;
        }
        echo $line . PHP_EOL;
        echo '</pre>';
    }
259773
static function dumpVariable( $var )
    {
        // If we have var_export (PHP >= 4.2.0) we use the instead
        // provides better output, doesn't require output buffering
        // and doesn't get mangled by Xdebug

        // dl: we should always use 'var_dump' since 'var_export' is
        // unable to handle recursion properly.
        //if ( function_exists( 'var_export' ) )
        //    return var_export( $var, true );

        ob_start();
        var_dump( $var );
        $variableContents = '';
        if ( extension_loaded( 'xdebug' ) )
           $variableContents = self::XDEBUG_SIGNATURE;
        $variableContents .= ob_get_contents();
        ob_end_clean();
        return $variableContents;
    }
113694
public function debug($value, array $context = array())
	{
		// If we were given anything other than a string,
		// we'll get readable format of the value.
		if( ! is_string($value))
		{
			$value = print_r($value, true);
		}

		$this->log(LogLevel::DEBUG, $value, $context);
	}
1164599
public static function json($var, $continue = false, $hide = false, $return = false){
        $Stop = new \Stop\Dumper\Json($hide, $continue, $return, Dumper\AbstractDumper::FORMAT_JSON);
        $Stop->var_dump($var);
    }
146531
private function _printVar($var)
    {
        if (is_string($var)) {
            $search = array("\x00", "\x0a", "\x0d", "\x1a", "\x09");
            $replace = array('\0', '\n', '\r', '\Z', '\t');

            return ('"'.str_replace($search, $replace, $var).'"');
        } elseif (is_bool($var)) {
            if ($var) {
                return ('true');
            } else {
                return ('false');
            }
        } elseif (is_array($var)) {
            $strResult = 'array( ';
            $strComma = '';
            foreach ($var as $key=>$val) {
                $strResult .= $strComma.$this->_printVar($key).' => '.$this->_printVar($val);
                $strComma = ', ';
            }
            $strResult .= ' )';

            return ($strResult);
        }
        // anything else, just let php try to print it
        return (var_export($var, true));
    }
791968
public static function ex($var, $detailed = false) {//, $label = null, $flags = ENT_SUBSTITUTE
        //$label = (null === $label) ? '' : rtrim($label) . ':';

        if (is_object($var)) { //$var instanceof \nb\Collection
            $detailed = false;
        }
        echo PHP_EOL;
        //ob_start();
        $detailed?var_dump($var):print_r($var);
        //$output = ob_get_clean();
        //$output = preg_replace('/\]\=\>\n(\s+)/m', '] => ', $output);
        echo PHP_EOL;
        //echo PHP_EOL . $label . $output . PHP_EOL;
    }
814711
public function debugVariableText($val)
    {
        // Check debug
        if (is_object($val) && ClassInfo::hasMethod($val, 'debug')) {
            return $val->debug();
        }

        // Format as array
        if (is_array($val)) {
            $result = '';
            foreach ($val as $key => $valItem) {
                $valText = $this->debugVariableText($valItem);
                $result .= "$key = $valText\n";
            }
            return $result;
        }

        // Format object
        if (is_object($val)) {
            return print_r($val, true);
        }

        // Format bool
        if (is_bool($val)) {
            return '(bool) ' . ($val ? 'true' : 'false');
        }

        // Format text
        if (is_string($val)) {
            return wordwrap($val, self::config()->columns);
        }

        // Other
        return var_export($val, true);
    }
1147161
public static function show($val, $showHeader = true, HTTPRequest $request = null)
    {
        // Don't show on live
        if (Director::isLive()) {
            return;
        }

        echo static::create_debug_view($request)
            ->debugVariable($val, static::caller(), $showHeader);
    }
835019
public static function debugInPopUpWindow($debugVariable, $header = 'Debug', $group = 'Debug') {
		$debugString = self::prepareVariableForJavascript(
			self::convertVariableToString($debugVariable),
			is_object($debugVariable)
		);

		$script = '
			(function debug() {
				var debugMessage = "' . $debugString . '",
					header = "' . htmlspecialchars($header) . '",
					group = "' . htmlspecialchars($group) . '",

					browserWindow = function(debug, header, group) {
						var newWindow = window.open("", "TYPO3DebugWindow_" + group,
							"width=600,height=400,menubar=0,toolbar=1,status=0,scrollbars=1,resizable=1"
						);
						if (newWindow.document.body.innerHTML) {
							newWindow.document.body.innerHTML = newWindow.document.body.innerHTML +
								"<hr />" + debugMessage;
						} else {
							newWindow.document.writeln(
								"<html><head><title>Debug: " + header + "(" + group + ")</title></head>"
								+ "<body onload=\"self.focus()\">"
								+ debugMessage
								+ "</body></html>"
							);
						}
					}

				if (!top.Ext) {
					browserWindow(debugMessage, header, group);
				} else {
					top.Ext.onReady(function() {
						if (top && top.TYPO3 && top.TYPO3.Backend) {
							top.TYPO3.Backend.DebugConsole.openBrowserWindow(header, debugMessage, group);
						} else {
							browserWindow(debugMessage, header, group);
						}
					});
				}
			})();
		';
		echo t3lib_div::wrapJS($script);
	}
820365
function (vars, name, showTrace) {

            var console = window.parent && window.parent.console && window.parent.console;

            if (!JBZoo.DEBUG) {
                return false;
            }

            // Get type
            var type    = "",
                varType = $this.type(vars);

            if (varType === "string" || varType === "array") {
                type = " (" + varType + ", " + $this.count(vars) + ")";
            } else {
                type = " (" + varType + ")";
            }

            // Wrap in vars quote if string
            if (varType === "string") {
                vars = "\"" + vars + "\"";
            }

            // Get var name
            if (!name) {
                name = "..." + type + " = ";
            } else {
                name += type + " = ";
            }

            // Dump var
            if (console.log) {
                console.log(name, vars);
            }

            // Show backtrace
            if (showTrace && console.trace !== "undefined") {
                console.trace();
                return false;
            }

            return false;
        }