Wrapper for PHP print_r function
@param mixed  $var     The variable to dump
@param string $varname Label to prepend to output
@param array  $params  Echo output if true
@return bool|JBDump
960139
public static function print_r($var, $varname = '...', $params = array())
    {
        if (!self::isDebug()) {
            return false;
        }

        $output = print_r($var, true);

        $_this = self::i();
        $_this->_dumpRenderHtml($output, $varname, $params);

        return $_this;
    }
113251
public static function printVars(...$args): string
    {
        $string = '';

        foreach ($args as $arg) {
            $string .= print_r($arg, 1) . PHP_EOL;
        }

        return preg_replace("/Array\n\s+\(/", 'Array (', $string);
    }
869716
def find_out_var(self, varnames=[]):
      
      if self.wdir != '':
         stdout = "%s/%s"%(self.wdir, self.stdout)
      else:
         stdout = self.stdout
      response = [None]*len(varnames)
      # First we check if the file we want to print does exists
      if os.path.exists(stdout):
         with open_(stdout, 'r') as f:
            for line in f:
               if '=' in line:
                  var = line.strip('#').split('=')
                  value = var[1].strip()
                  var = var[0].strip()
                  if var in varnames: response[varnames.index(var)] = value
      else: # FILE DOESN'T EXIST
         debug.log("Error: The stdout file %s does not exist!"%(stdout))
      return response
1050318
public function render($input, $filename = null, array $variables = [])
    {
        if (is_array($filename)) {
            $variables = $filename;
            $filename = null;
        }
        if (!in_array($this->stream, $this->streamsRegistered)) {
            $this->streamsRegistered[] = $this->stream;
            if (in_array($this->stream, stream_get_wrappers())) {
                stream_wrapper_unregister($this->stream);
            }
            $classParts = explode('\\', get_class($this));
            stream_wrapper_register($this->stream, $classParts[0] . '\Stream\ExpressionStream');
        }

        extract(array_merge($this->sharedVariables, $variables));

        try {
            $code = '<?php ' . $this->compile($input, $filename);
            if (strlen($code) < 4096) {
                return include $this->stream . '://data;' . $code;
            }
            $file = tempnam(sys_get_temp_dir(), 'jsph');
            file_put_contents($file, $code);
            $result = include $file;
            unlink($file);

            return $result;
        } catch (\JsPhpize\Compiler\Exception $exception) {
            throw $exception;
        } catch (\JsPhpize\Lexer\Exception $exception) {
            throw $exception;
        } catch (\JsPhpize\Parser\Exception $exception) {
            throw $exception;
        } catch (\Exception $exception) {
            $summary = $input;
            if (mb_strlen($summary) > 50) {
                $summary = mb_substr($summary, 0, 47) . '...';
            }

            throw new Exception(
                "An error occur in [$summary]:\n" . $exception->getMessage(),
                2,
                E_ERROR,
                __FILE__,
                __LINE__,
                $exception
            );
        }
    }
549665
function var_dump($message, $data) {
		try {
			$export = trim(str_replace("\n", "\n\t", var_export($data, true)), "\n\t ");
			$this->log("$message\n\n\t$export\n");
		}
		catch (Exception $e) {
			$this->failedLogging($e, $message);
		}
	}
85637
protected static function compileVar($param)
    {
        $result = '<<<<{var} error!!!>>>>';
        if (!empty($param)) {
            $parameters = self::parseParameters($param);
            if (isset($parameters['from'])) {
                $result = "<?php echo {$parameters['from']};?>";
                if (0 == strncasecmp('$this->widget[', $parameters['from'], 14)) {
                    $widget = substr($parameters['from'], 15, strpos($parameters['from'], ']') - 16);
                    unset($parameters['from']);
                    $result = self::initWidgetParameters($widget, $parameters) . $result;
                }
            }
        }

        return $result;
    }
181741
public static function it($var,
                              $method = AbstractDumper::PRINT_R,
                              $continue = false,
                              $hide = false,
                              $return = false)
    {

        if (self::$Enabled === false) {
            return null;
        }
        //detect console or ajax
        if (php_sapi_name() == 'cli') {
            //no custom dumper?
            if (self::$DumperClass == self::DEFAULT_DUMPER) {
                self::$DumperClass = self::CONSOLE_DUMPER;
            }
        } elseif (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
            if (self::$DumperClass == self::DEFAULT_DUMPER) {
                self::$DumperClass = self::AJAX_DUMPER;
            }
        }

        try {
            $Stop = new self::$DumperClass($hide, $continue, $return);
        } catch (\Exception $exc) {
            error_log($exc->getMessage());
            //fallback
            $default = self::DEFAULT_DUMPER;
            $Stop = new $default($hide, $continue, $return);
        }

        if ($method == AbstractDumper::PRINT_R) {
            return $Stop->print_r($var);
        }
        if ($method == AbstractDumper::GET_TYPE) {
            return $Stop->get_type($var);
        }
        return $Stop->var_dump($var);
    }
821102
public function renderString($input, array $vars = [], $filename = null)
    {
        $fallback = function () use ($input, $vars, $filename) {
            return $this->renderWithPhp($input, $vars, $filename);
        };

        if ($this->getDefaultOption('pugjs')) {
            return $this->renderWithJs($input, $filename, $vars, $fallback);
        }

        return call_user_func($fallback);
    }
117892
private static function getPhpVariableAsText($var)
    {
        if (is_string($var)) {
            return('"'.str_replace(array("\x00", "\x0a", "\x0d", "\x1a", "\x09"), array('\0', '\n', '\r', '\Z', '\t'), $var).'"');
        } elseif (is_int($var) || is_float($var)) {
            return($var);
        } elseif (is_bool($var)) {
            if ($var) {
                return('true');
            } else {
                return('false');
            }
        } elseif (is_array($var)) {
            $result = 'array( ';
            $comma = '';
            foreach ($var as $key => $val) {
                $result .= $comma.self::getPhpVariableAsText($key).' => '.self::getPhpVariableAsText($val);
                $comma = ', ';
            }
            $result .= ' )';

            return($result);
        } elseif (is_object($var)) {
            return 'Object '.get_class($var);
        } elseif (is_resource($var)) {
            return 'Resource '.get_resource_type($var);
        }

        return 'Unknown type variable';
    }
1042352
public function get_variable($varname, $default = null)
    {
        // There's a known case when max_allowed_packet is queried
        // PostgreSQL doesn't have such limit, return immediately
        if ($varname == 'max_allowed_packet') {
            return rcube::get_instance()->config->get('db_' . $varname, $default);
        }

        $this->variables[$varname] = rcube::get_instance()->config->get('db_' . $varname);

        if (!isset($this->variables)) {
            $this->variables = array();

            $result = $this->query('SHOW ALL');

            while ($row = $this->fetch_array($result)) {
                $this->variables[$row[0]] = $row[1];
            }
        }

        return isset($this->variables[$varname]) ? $this->variables[$varname] : $default;
    }
839380
private function renderValue($printFormat, array $variables)
    {
        return str_replace(
            array_map(
                function($variable) {
                    return '{{' . $variable . '}}';
                },
                array_keys($variables)
            ),
            array_values($variables),
            $printFormat
        );
    }
1132945
public static function barDump($var, string $title = null, array $options = null)
    {
        if (!self::isProductionMode()) {
            static $panel;
            if (!$panel) {
                self::getBar()->addPanel($panel = new Bar\DefaultPanel('dumps'), 'Tracy:dumps');
            }
            $panel->data[] = [
                'title' => $title,
                'dump' => Dumper::toHtml($var, $options + [
                        Dumper::DEPTH => self::$maxDepth,
                        Dumper::TRUNCATE => self::$maxLength,
                        Dumper::LOCATION => self::$showLocation ?: Dumper::LOCATION_CLASS | Dumper::LOCATION_SOURCE,
                    ]),
            ];
        }

        return $var;
    }
1273805
public function render(
        $name,
        $intervalVariable = null,
        $callbackVariable = null,
        $requirementVariable = null,
        $interval = 10,
        $newLine = true
    ) {
        $formatter = $this->getFormatter();

        $intervalVariable = $intervalVariable ?: 'i';
        $callbackVariable = $callbackVariable ?: 'c';
        $requirementVariable = $requirementVariable ?: 'r';

        return $formatter->renderClosure($this->renderRequirement(
            $intervalVariable,
            $callbackVariable,
            $requirementVariable,
            $formatter->renderStatement('else', $formatter->renderAssignment(
                'var '.$intervalVariable,
                $formatter->renderCall('setInterval', [
                    $formatter->renderClosure($this->renderRequirement(
                        $intervalVariable,
                        $callbackVariable,
                        $requirementVariable
                    )),
                    $interval,
                ], true)
            ), null, null, false)
        ), [$callbackVariable, $requirementVariable], $name, true, $newLine);
    }
998280
public static function wtf($var, $arrayOfObjectsToHide = array(), $fontSize = 12)
    {
        $text = print_r($var, true);
        $text = str_replace('<', '&lt;', $text);
        $text = str_replace('>', '&gt;', $text);

        if ($var instanceof \ErrorException || $var instanceof \Exception) {
            $text = $var->getMessage() . PHP_EOL;
            $text .= PHP_EOL . 'Code: ' . $var->getCode() . ' File: ' . $var->getFile() . ':' . $var->getLine() . PHP_EOL;

            $trace = $var->getTrace();
            $first = array_shift($trace);
            $text .= PHP_EOL . 'Vars:' . PHP_EOL . PHP_EOL;
            if (isset($first['args'][4])) {
                foreach ($first['args'][4] as $var => $value) {
                    if (is_object($value)) {

                        $value = 'Instance of ' . get_class($value);
                    } else {
                        $value = print_r($value, true);
                    }

                    $text .= " $$var = $value" . PHP_EOL;

                }
            }
            $text .= PHP_EOL . 'Trace:' . PHP_EOL;
            foreach ($trace as $step => $data) {
                $class = '';
                if (isset($data["class"])) {
                    $class = $data["class"] . '->';
                }
                $line = (isset($data["line"])) ? $data["line"] : '';
                $file = (isset($data["file"])) ? $data["file"] . ':' : '';
                $fn = (isset($data["function"])) ? $data["function"] . '() ' : '';

                $text .= PHP_EOL . $step . '. ' . $class . $fn . $file . $line . PHP_EOL;
                if (isset($data['args']) && count($data['args'])) {
                    $text .= PHP_EOL . '  Vars:' . PHP_EOL;
                    foreach ($data['args'] as $arg => $val) {
                        $text .= print_r($val, true) . PHP_EOL;
                    }
                }
                unset($class);
            }
            $text = preg_replace('#(Code|File|Trace|Vars):\s#', '<span style="color: #079700;font-weight:bold;">$1:</span>', $text);
            $text = preg_replace('#(Debug|Info|Notice):\s#', '<span style="color: #079700;">$1:</span>', $text);
            $text = preg_replace('#(Warning|Error|Critical|Alert|Emergency):\s#', '<span style="color: red;">$1:</span>', $text);
            // color code object properties
            $pattern = '#\$(\w+)\s=\s(\w+)#';
            $replace = '<span style="color: #000099;">$$1</span> = ';
            $replace .= '<span style="color: #009999;">$2</span>';
            $text = preg_replace($pattern, $replace, $text);

        } else {
            foreach ($arrayOfObjectsToHide as $objectName) {
                $searchPattern = '#(\W' . $objectName . ' Object\n(\s+)\().*?\n\2\)\n#s';
                $replace = "$1<span style=\"color: #FF9900;\">";
                $replace .= "--&gt; HIDDEN - courtesy of wtf() &lt;--</span>)";
                $text = preg_replace($searchPattern, $replace, $text);
            }
            // color code objects
            $text = preg_replace('#(\w+)(\s+Object\s+\()#s', '<span style="color: #079700;">$1</span>$2', $text);
            // color code object properties
            $pattern = '#\[(\w+)\:(public|private|protected)\]#';
            $replace = '[<span style="color: #000099;">$1</span>:';
            $replace .= '<span style="color: #009999;">$2</span>]';
            $text = preg_replace($pattern, $replace, $text);
        }
        echo '<pre style="font-size: ' . $fontSize . 'px;	line-height: ' . $fontSize . 'px;background-color: #fff; padding: 10px;">' . $text . '</pre>';
    }
229697
public function processString($string, array $vars = [])
    {
        // override the twig header vars for local resolution
        $this->grav->fireEvent('onTwigStringVariables');
        $vars += $this->twig_vars;

        $name = '@Var:' . $string;
        $this->setTemplate($name, $string);

        try {
            $output = $this->twig->render($name, $vars);
        } catch (\Twig_Error_Loader $e) {
            throw new \RuntimeException($e->getRawMessage(), 404, $e);
        }

        return $output;
    }
1035620
public function print_vars($vars)
    {
        $this->last_selector = null;

        $args = array();
        foreach (func_get_args() as $name => $arg) {
            if (is_object($arg)) {
                $arg = get_object_vars($arg);
            }
            $args[$name] = array(var_export($arg, true));
        }

        return $this->cmd(6, $args);
    }
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;
    }