Dumps given variable in styled format

@param mixed $var
@param string $mode
@return mixed
544134
public function dump($var, $mode = null)
    {
        if (null === $mode && class_exists('Zicht\Util\Debug')) {
            return htmlspecialchars(Debug::dump($var));
        } else {
            switch ($mode) {
                case 'export':
                    VarDumper::dump($var);
                    break;
                default:
                    var_dump($var);
                    break;
            }
        }
        return null;
    }
324948
public static function dumpScalar($var, $maxValueLen)
    {
        switch (true) {
            case is_null($var):
                $val = 'null';
                break;
            case is_bool($var):
                $val = ($var ? 'true' : 'false');
                break;
            case is_integer($var):
                $val = sprintf('%d', $var);
                break;
            case is_float($var):
                $val = sprintf('%F', $var);
                break;
            case is_string($var):
                $val = self::formatString($var, $maxValueLen);
                break;
            case is_resource($var):
                $val = 'resource (' . get_resource_type($var) . ')';
                break;
            default:
                $val = gettype($var) . ' (unknown scalar type)';
                break;
        }
        return $val;
    }
113293
public static function dump( $var, $echo = true, $label = null, $flags = ENT_SUBSTITUTE )
	{
		$response = Response::getInstance()->getResponse();
		$response->write( '<pre>' );
		$response->write( var_export( $var, true ) );
		$response->write( '</pre>' );
	}
1244435
protected function varToString($var)
    {
        if (is_object($var)) {
            return sprintf('Object(%s)', get_class($var));
        }

        if (is_array($var)) {
            $a = array();
            foreach ($var as $k => $v) {
                $a[] = sprintf('%s => %s', $k, $this->varToString($v));
            }

            return sprintf("Array(%s)", implode(', ', $a));
        }

        if (is_resource($var)) {
            return sprintf('Resource(%s)', get_resource_type($var));
        }

        if (null === $var) {
            return 'null';
        }

        if (false === $var) {
            return 'false';
        }

        if (true === $var) {
            return 'true';
        }

        return (string) "'$var'";
    }
922511
public function dump($var, $options = array()) {
        $options += self::$defaults + array('split' => false, 'trace' => false);
        $this->options = $options;
        $this->current_depth = 0;
        $this->object_references = array();

        if (!$options['trace']) $options['trace'] = debug_backtrace();
        extract($options);
        $location = $this->location($trace);

        $dump = array();
        if ($options['split'] && is_array($var)) {
            $this->current_depth = 0;
            foreach ($var as $one) {
				$dump = array_merge($dump, array($this->dump_it($one), ' - '));
			}
			$dump = array_slice($dump, 0, -1);
        } else
            $dump[] = $this->dump_it($var);

        switch ($mode) {
			case 'FirePHP':
				$locString = \alkemann\hl\debug\util\adapters\FirePHP::locationString($location);
				require_once LITHIUM_LIBRARY_PATH . '/FirePHPCore/FirePHP.class.php';
				$firephp = \FirePHP::getInstance(true);
				if (!$firephp) throw new \Exception('FirePHP not installed');
				$firephp->group($locString, array('Collapsed' => false, 'Color' => '#AA0000'));

				$f = function($o) use ($firephp,&$f) {
					if (is_array($o)) {
						foreach ($o as $r)
							$f($r);
					} else {
						$firephp->log($o);
					}
				};
				$f($dump);
				$firephp->groupEnd();
				return;
				break;
			case 'Json':
				$locString = \alkemann\hl\debug\util\adapters\Json::locationString($location);
				$this->output[] = array('location' => $locString, 'dump' => $dump);
				break;
			case 'Log' :
				$locString = \alkemann\hl\debug\util\adapters\Log::locationString($location);
				\lithium\analysis\Logger::debug($locString . "\n" . implode("\n", $dump));
				return;
				break;
			case 'Html' :
			default :
				$locString = \alkemann\hl\debug\util\adapters\Html::locationString($location);
				$this->output[] = '<div class="debug-dump"><div class="debug-location">' . $locString . '</div>'.
					'<div class="debug-content"> ' . implode("<br>\n", $dump) . '</div></div>';
				break;
		}
		if ($options['echo']) {
			$this->__out();
		}
    }
382905
protected function html($val, $mode = 's')
    {
        switch ($mode) {
            case 'e':
                return $this->htmlE($val);
            case 's':
                return $this->htmlS($val);
        }

        Throw new ViewException(sprintf('Mode "%s" is a not supported View::html() output mode.', $mode));
    }
947956
public function toRows($var)
    {
        $results = PHP_EOL;

        foreach ($this->getParser()->toArray() as $name => $types) {
            if (in_array($name, $this->ignores)) {
                continue;
            }

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

        return $results.PHP_EOL;
    }
187500
public function dump(Twig_Environment $env, $context)
    {
        $output = '';

        $count = func_num_args();
        if (2 === $count) {
            $data = [];
            foreach ($context as $key => $value) {
                if (is_object($value)) {
                    if (method_exists($value, 'toArray')) {
                        $data[$key] = $value->toArray();
                    } else {
                        $data[$key] = 'Object (' . get_class($value) . ')';
                    }
                } else {
                    $data[$key] = $value;
                }
            }
            $output .= $this->formatter->formatVar($data);
        } else {
            for ($i = 2; $i < $count; $i++) {
                $output .= $this->formatter->formatVar(func_get_arg($i));
            }
        }

        return '<pre>' . $output . '</pre>';
    }
927983
public static function var_dump() {
        global $USER, $CONTEXT, $LINK, $RESULT;
        echo('$USER:'."\n");
        if ( ! isset($USER) ) {
            echo("Not set\n");
        } else {
            var_dump($USER);
        }
        echo('$CONTEXT:'."\n");
        if ( ! isset($CONTEXT) ) {
            echo("Not set\n");
        } else {
            var_dump($CONTEXT);
        }
        echo('$LINK:'."\n");
        if ( ! isset($LINK) ) {
            echo("Not set\n");
        } else {
            var_dump($LINK);
        }
        echo('$RESULT:'."\n");
        if ( ! isset($RESULT) ) {
            echo("Not set\n");
        } else {
            var_dump($RESULT);
        }
        echo("\n<hr/>\n");
    }
479813
private static function convertMode($mode)
    {
        if (is_string($mode)) {
            $mode = defined('\Tideways\Profiler::MODE_' . strtoupper($mode))
                ? constant('\Tideways\Profiler::MODE_' . strtoupper($mode))
                : self::MODE_DISABLED;
        } else if (!is_int($mode)) {
            $mode = self::MODE_DISABLED;
        } else if (($mode & (self::MODE_FULL|self::MODE_BASIC)) === 0) {
            $mode = self::MODE_DISABLED;
        }

        return $mode;
    }
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));
    }
1026637
public static function dump($var)
    {
        $flags = 0;

        if (Config::get('debug.dump_show_string_length')) {
            $flags = $flags | AbstractDumper::DUMP_STRING_LENGTH;
        }

        $cloner = new VarCloner();

        if (! \in_array(\PHP_SAPI, array('cli', 'phpdbg'), true)) {
            $dumper = new HtmlDumper(null, null, $flags);

            $dumper->setStyles(self::get_styles());

            if (Config::get('debug.dump_include_trace')) {
                $dumper->setDumpBoundaries(
                    '<pre class=sf-dump id=%s data-indent-pad="%s">' . self::additional_output(),
                    '</pre><script>Sfdump(%s)</script>'
                );
            }
        } else {
            $dumper = new CliDumper(null, null, $flags);
        }

        $dumper->dump($cloner->cloneVar($var));
    }
251638
public function dump($value)
    {
        if (class_exists('Symfony\Component\VarDumper\Cloner\VarCloner')) {
            static $dumper = null;

            // re-use the same var-dumper instance, so it won't re-render the global styles/scripts on each dump.
            if (!$dumper) {
                $dumper = new HtmlDumper();

                $styles = array(
                    'default' => '',
                    'num' => '',
                    'const' => '',
                    'str' => '',
                    'note' => '',
                    'ref' => '',
                    'public' => '',
                    'protected' => '',
                    'private' => '',
                    'meta' => '',
                    'key' => '',
                    'index' => '',
                );
                $dumper->setStyles($styles);
            }

            $cloner = new VarCloner();
            return $dumper->dump($cloner->cloneVar($value));
        }
        return print_r($value, true);
    }
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;
    }
1338340
public static function exportVar($var, $indent = null, $guessTypes = false)
    {
        switch (gettype($var)) {
            case 'string':
                // guess boolean type for "1" and "0"
                if (true === $guessTypes) {
                    if ($var === '0' || $var === '') {
                        return 'false';
                    } elseif ($var === '1') {
                        return 'true';
                    }
                }
                return '\'' . $var . '\'';
            case 'array':
                $indexed = array_keys($var) === range(0, count($var) - 1);
                $row = [];
                foreach ($var as $key => $value) {
                    $row[] = $indent . "\t"
                        . ($indexed ? null : self::exportVar($key, null, $guessTypes) . ' => ')
                        . self::exportVar($value, $indent . "\t", $guessTypes);
                }
                return "[\n" . implode(",\n", $row) . "\n" . $indent . ']';
            case 'boolean':
                return $var ? 'true' : 'false';
            default:
                return var_export($var, true);
        }
    }
89301
public static function data($Data, $mode = 2)
    {
        self::$Format = explode(' ', $Data);
        self::$Data = explode('-', self::$Format[0]);
        $a = array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12');
        $b = array("jan", "fev", "mar", "abr", "mai", "jun", "jul", "ago", "set", "out", "nov", "dez");

        if (!empty(self::$Format[1])):
            $d = explode(':', self::$Format[1]);
        else:
            $d[0] = 0;
        endif;

        if (isset(self::$Data[2])):
            if ($mode && $mode === 2):
                return self::$Data[2] . ' ' . str_replace($a, $b, self::$Data[1]);
            else:
                return self::$Data[2] . ' ' . str_replace($a, $b, self::$Data[1]) . ' ' . self::$Data[0];
            endif;
        endif;

        return "";
    }
1009271
def get_style_var(var_name)
      style_details = style_variables_for_theme["vic"] || Pwb::PresetStyle.default_values
      style_vars = style_details["variables"] || []
      style_vars[var_name] || ""
    end