Display a variable's contents using nice HTML formatting and will
properly display the value of booleans as true or false

@see recursiveVarDumpHelper()

@param  mixed $var The variable to dump
@return string
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;
    }
287990
public static function toHtml($var, array $options = null): string
    {
        $options += [
            self::DEPTH => 4,
            self::TRUNCATE => 150,
            self::COLLAPSE => 14,
            self::COLLAPSE_COUNT => 7,
            self::OBJECT_EXPORTERS => null,
            self::DEBUGINFO => false,
            self::KEYS_TO_HIDE => [],
        ];
        $loc = &$options[self::LOCATION];
        $loc = $loc === true ? ~0 : (int) $loc;

        $options[self::KEYS_TO_HIDE] = \array_flip(\array_map('\\strtolower', $options[self::KEYS_TO_HIDE]));
        $options[self::OBJECT_EXPORTERS] = (array) $options[self::OBJECT_EXPORTERS] + self::$objectExporters;
        \uksort($options[self::OBJECT_EXPORTERS], function ($a, $b): int {
            return $b === '' || (\class_exists($a, false) && \is_subclass_of($a, $b)) ? -1 : 1;
        });

        $live = !empty($options[self::LIVE]) && $var && (\is_array($var) || \is_object($var) || \is_resource($var));
        [$file, $line, $code] = $loc ? self::findLocation() : null;
        $locAttrs = $file && $loc & self::LOCATION_SOURCE ? Helpers::formatHtml(
            ' title="%in file % on line %" data-tracy-href="%"', "$code\n", $file, $line,
            Helpers::editorUri($file, $line)
        ) : null;

        return '<pre class="tracy-dump' . ($live && $options[self::COLLAPSE] === true ? ' tracy-collapsed' : '') . '"'
            . $locAttrs
            . ($live ? " data-tracy-dump='" . \json_encode(self::toJson($var, $options),
                    JSON_HEX_APOS | JSON_HEX_AMP) . "'>" : '>')
            . ($live ? '' : self::dumpVar($var, $options))
            . ($file && $loc & self::LOCATION_LINK ? '<small>in ' . Helpers::editorLink($file, $line) . '</small>' : '')
            . "</pre>\n";
    }
405497
public static function dump($var, $label = null)
    {
        $label = (null === $label) ? '' : rtrim($label) . ':';
        ob_start();
        var_dump($var);

        $output = ob_get_clean();
        $output = preg_replace('/\]\=\>\n(\s+)/m', '] => ', $output);

        if (IS_CLI) {
            $output = PHP_EOL . $label . $output . PHP_EOL;
        } else {
            if (!extension_loaded('xdebug')) {
                $output = htmlspecialchars($output, ENT_QUOTES);
            }
            $output = '<pre>' . $label . $output . '</pre>';
        }

        echo $output;
    }
163867
public function scrub($var)
	{
		if (is_string($var)) {
			// Sanitize strings
			return $this->escape($var);

		} elseif (is_array($var)) {
			// Sanitize arrays
                        foreach($var as $key => $value){
				// casting key to string for the case of numeric indexed arrays
				// i.e. 0, 1, etc. b/c 0 == any string in php
				if (!in_array((string)$key, $this->unguarded)) {
					$var[$key] = $this->scrub($value);
				}
			}

			return $var;
		} elseif (is_object($var)) {
			// Sanitize objects
			$values = get_object_vars($var);

			foreach ($values as $key => $value) {
				$var->$key = $this->scrub($value);
			}
			return $var;

		} else {
			// Not sure what this is. null or bool? Just return it.
			return $var;
		}
	}
882118
public static function dump( $var, $format = 'html', $back = 0, $options = NULL, $return = FALSE, $max_depth = 6 )
    {
        list( $file, $line ) = self::caller( $back );

        if ( !$options ){
            $options = array();
        }
        $default_options = array(
                'title' => 'system dump',
                'font_size' => 11,
                'max_string_length' => self::DUMP_MAX_LENGTH,
                'type' => 'textarea',
            );
        $options = array_merge( $default_options, $options );

        $title             = $options['title'];
        $font_size         = $options['font_size'];
        $max_string_length = $options['max_string_length'];
        $type              = $options['type'];

        $lines = array();
        $recursion = array();
        self::_dump( '-', $var, 0, $max_string_length, $lines, $max_depth, $recursion );

        switch( $format )
        {
        case "html":
            switch( $type ){
            case 'div':
                $output  = "<div style=\"font-size:12px; margin: 2px\"> $title:" . implode('',$lines) . " @$file($line)</div>";
                break;
            case 'textarea':
            default:
                $output  = "<h3 style=\"font-size:12px; margin: 0; color:black; background-color:white; text-align: left\"> $title @$file($line)</h3>";
                $output .= "<textarea rows=14 style=\"width:100%; font-size:{$font_size}px; margin: 0; color:black; background-color:white; border: 1px solid silver;\">";
                $output .= implode(PHP_EOL,$lines);
                $output .= "</textarea>";
                break;
            }
            break;
        case "shell":
        default:
            $output  = "$title @$file($line)" . PHP_EOL;
            $output .= implode(PHP_EOL,$lines) . PHP_EOL;
            break;
        }

        if ( $return ){
            return $output;
        }
        else{
            echo $output;
            return null;
        }
    }
1080023
public function dump(/*$var1 [, $var2...$varN]*/)
    {
        $this->initializeApplication();

        if ($this->application->container->getParameter('silenced', false)) {
            return null;
        }

        $this->initializeNodes();

        $args = func_get_args();
        $this->readVariables($args);
        $this->loadCallLocationInfo();

        $render = $this->getRender();
        $render->setGlobals(array(
            'id' => uniqid(),
            'expanded' => $this->application->container->getParameter('expanded'),
            'theme' => $render->getTheme()->getName()
        ));

        return $render->render($this->nodes, array(
            'callFile' => $this->callFile,
            'callLine' => $this->callLine,
            'xdebugLink' => $this->xdebugLink
        ));
    }
515956
public static function var_dump($var, $varname = '...', $params = array())
    {
        if (!self::isDebug()) {
            return false;
        }

        // var_dump the variable into a buffer and keep the output
        ob_start();
        var_dump($var);
        $output = ob_get_clean();
        $_this  = self::i();

        // neaten the newlines and indents
        $output = preg_replace("/\]\=\>\n(\s+)/m", "] => ", $output);
        //if (!extension_loaded('xdebug')) {
        $output = $_this->_htmlChars($output);
        //}

        $_this->_dumpRenderHtml($output, $varname . '::html', $params);

        return $_this;
    }
1038850
public function toUpperCaseFirst($var)
    {
        $v = '' . $var;
        $len = $this->strlen($var);
        if (!$len) {
            return '';
        }
        if (static::$nativeSupport['mbstring']) {
            if ($len > 1) {
                return mb_strtoupper(mb_substr($v, 0, 1)) . mb_substr($v, 1);
            }
            return mb_strtoupper($v);
        }
        return $v;
    }
1333095
public static function dumpAsString($variable, $indentLevel = 0) {
        if (is_bool($variable)) {
            $result = $variable ? "true" : "false";
        } elseif (is_null($variable)) {
            $result = "null";
        } elseif (is_array($variable)) {
            $result = 'array (';

            foreach($variable as $key=>$item) {
                $result .= "\n". str_repeat(" ", ($indentLevel+1)*4);
                $result .= self::dumpAsString($key, $indentLevel+1);
                $result .= ' => ';
                $result .= self::dumpAsString($item, $indentLevel+1).',';
            }

            $result .= "\n".str_repeat(" ", ($indentLevel)*4).')';
        } elseif(is_string($variable) && (isset($variable[0]) && $variable[0] != '$')) {
            $result = '"'. (strpos($variable, '$__lv') === false ? str_replace('"', '\"', $variable) : $variable) .'"';
        } else {
            $result = $variable;
        }

        return $result;
    }
1087472
public function dumpVar(&$var, BasicObject $base)
    {
        return $this->renderer->render(
            $this->parser->parse($var, $base)
        );
    }
116551
public function text($var)
	{
		global $txt;

		// This should be extended by somebody else...
		if (!$this->name || empty($var))
			return false;

		// Does nothing if the file is already loaded.
		loadLanguage($this->name);

		return !empty($txt[$this->name .'_'. $var]) ? $txt[$this->name .'_'. $var] : false;
	}
1072435
public static function dump($var, $echo = true)
    {
        ob_start();
        var_dump($var);

        $output = ob_get_clean();
        $output = preg_replace("/\]\=\>\n(\s+)/m", "] => ", $output);

        if (PHP_SAPI == "cli") {
            $output = PHP_EOL . PHP_EOL . $output . PHP_EOL;
        } else {
            $output = "<pre>" . htmlspecialchars($output, ENT_QUOTES) . "</pre>";
        }

        if ($echo) echo($output);

        return $output;
    }
186414
public function content($var = null)
    {
        if ($var !== null) {
            $this->content = $this->check($var);

            // Update RAW, too.
            $this->raw = $this->encode($this->content);

        } elseif ($this->content === null) {
            // Decode RAW file.
            try {
                $this->content = $this->decode($this->raw());
            } catch (\Exception $e) {
                throw new \RuntimeException(sprintf('Failed to read %s: %s', $this->filename, $e->getMessage()), 500, $e);
            }
        }

        return $this->content;
    }
1027841
public function toRows($var)
    {
        $results = PHP_EOL;

        foreach ($this->getColumns() as $column) {
            if (in_array($name = $column->getName(), $this->ignores)) {
                continue;
            }

            $results .= Stub::create('scaffold/row.stub', [
                'label' => ucwords($name),
                'column' => $name,
                'var' => $var,
            ])->render();
        }

        return $results.PHP_EOL;
    }
1069863
public static function dump($var, array $options = null)
    {
        if (Helpers::isHtmlMode()) {
            echo self::toHtml($var, $options);
        } elseif (self::detectColors()) {
            echo self::toTerminal($var, $options);
        } else {
            echo self::toText($var, $options);
        }

        return $var;
    }
274596
public static function toPhp($var)
    {
        switch (gettype($var)) {
            case 'array':
                $skipKeys = (range(0, count($var) - 1) === array_keys($var));
                $ret = 'array(';
                $i = 0;
                foreach ($var as $key => $value) {
                    if ($i++ > 0) {
                        $ret .= ', ';
                    }
                    if (!$skipKeys) {
                        $ret .= self::toPhp($key) . ' => ';
                    }
                    $ret .= self::toPhp($value);
                }
                $ret .= ')';
                break;
            default:
                $ret = var_export($var, true);
        }
        return $ret;
    }
861487
public function toUpperCaseLast($var)
    {
        $v = '' . $var;
        $len = $this->strlen($var);
        if (!$len) {
            return '';
        }
        if (static::$nativeSupport['mbstring']) {
            if ($len > 1) {
                return mb_substr($v, 0, $len - 2) . mb_strtoupper(mb_substr($v, $len - 2));
            }
            return mb_strtoupper($v);
        }
        return $v;
    }