Dump it!

@param type $var
@param type $method
@param type $continue
@param type $hide
@param type $return
@return type
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);
    }
1340161
static function dump($var, $trace = true)
    {
        $d = Debug::getInstance();

        if ($d->level < 1) {
            return;
        }

        if ($d->terminal) {
            $c = $d->console;

            if (!is_array($var)) {
                $c->writeln(print_r($var, 1), 'blue');
            } else {
                $lines = explode("\n", print_r($var, 1));
                foreach ($lines as $line) {
                    preg_match_all('|(.*)\[(.*)\] \=\>(.*)|', $line, $m);
                    
                    if (!isset($m[0][0])) {
                        $c->writeln($line);
                    } else {
                        $c->write($m[1][0] . '[', 'blue');
                        $c->write($m[2][0], 'light_red');
                        $c->write('] =>', 'blue');
                        $c->writeln($m[3][0], 'blue');
                    }
                }
            }

        } else {
            $txt = preg_replace('/\[(.*)\]/u', '[<span style="color:#d00">$1</span>]', print_r($var, 1));
            echo '<pre style="color:blue">' . $txt . "</pre>";
        }

        if ($trace)
            $d->_trace();
    }
260411
public function last($return = false)
    {
        if (!empty($this->query)) {
            if ($return) {
                return $this->query;
            }
            var_dump($this->query);
            return null;
        }
        return false;
    }
1240133
public function invokeMethod($method, $vars = []) {
        if (is_array($method)) {
            $class = is_object($method[0]) ? $method[0] : $this->invokeClass($method[0]);
            $reflect = new \ReflectionMethod($class, $method[1]);
        } else {
            // 静态方法
            $reflect = new \ReflectionMethod($method);
        }
        $args = $this->bindParams($reflect, $vars);
        return $reflect->invokeArgs(isset($class) ? $class : null, $args);
    }
829968
static function exec( $method, &$result )
    {
        $ini = eZINI::instance( 'ezmultiupload.ini' );
        $handlers = $ini->variable( 'MultiUploadSettings', 'MultiuploadHandlers' );

        if ( !$handlers )
            return false;

        foreach ( $handlers as $hanlder )
        {
            if ( !call_user_func( array( $hanlder, $method ), $result ) )
                eZDebug::writeWarning( 'Multiupload handler implementation not found' );
        }

        return true;
    }
587958
public static function dumpClosure(Closure $c) {
        $res = 'function (';
        $fun = new ReflectionFunction($c);
        $args = [];
        foreach($fun->getParameters() as $arg) {
            $str = '';
            if($arg->isArray()) {
                $str .= 'array ';
            } else if($arg->getClass()) {
                $str .= $arg->getClass()->name . ' ';
            }
            if($arg->isPassedByReference()){
                $str .= '&';
            }
            $str .= '$' . $arg->name;
            if ($arg->isOptional()) {
                $str .= ' = ' . var_export($arg->getDefaultValue(), true);
            }
            $args[] = $str;
        }
        $res .= implode(', ', $args);
        $res .= ') {' . PHP_EOL;
        $lines = file($fun->getFileName());
        for ($i = $fun->getStartLine(); $i < $fun->getEndLine(); $i++) {
            $res .= $lines[$i];
        }

        return rtrim($res, "\n ,");
    }
925261
public static function dump($object, $method = null)
    {
        return App::getServiceDumper()->dump($object, static::getClassName(), $method);
    }
15735
private function write($data, $method = 'PUT')
    {
        $jsonData = json_encode($data);
        $header = array(
            'Content-Type: application/json',
            'Content-Length: ' . strlen($jsonData)
        );
        try
        {
            $ch = $this->curl($method);
            curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData);
            $return = curl_exec($ch);
            curl_close($ch);
            return json_decode($return, true);
        } catch (Exception $e)
        {
            //...
        }
        return null;
    }
42292
private void dump(MethodInvocation methodInvocation, Object result, long take) {
        // 取得日志打印对象
        Logger log = getLogger(methodInvocation.getMethod().getDeclaringClass());
        Object[] args = methodInvocation.getArguments();
        StringBuffer buffer = getArgsString(args);

        if (log.isInfoEnabled()) {
            String className = ClassUtils.getShortClassName(methodInvocation.getMethod().getDeclaringClass());
            String methodName = methodInvocation.getMethod().getName();
            String resultStr = getResultString(result);

            String now = new SimpleDateFormat(DATA_FORMAT).format(new Date());
            log.info(MessageFormat.format(MESSAGE, new Object[] { className, methodName, now, take, buffer.toString(),
                    resultStr }));
        }
    }
593454
public function load($view, $variables = [], $return = false)
    {
        $html = $this->getContents($view, $variables);

        if ($return === true) {
            return $html;
        }

        echo $html;

        return null;
    }
1265764
public static function dump($var, $maxdepth = 10, $maxValueLen = 255, $stack = [])
    {
        $children = $hierarchyNotation = null;

        if (is_object($var)) {
            $children = get_object_vars($var);
            $hierarchyNotation = '->%s';
        } elseif (is_array($var)) {
            $children = $var;
            $hierarchyNotation = '[%s]';
        }


        if (isset($children)) {
            $ret = self::formatDumpStack($stack, $var);

            if ($maxdepth >= 0 && count($stack) == $maxdepth) {
                $ret .= ' (...)' . "\n";
            } else {
                if (count($children) == 0) {
                    $ret .= "(empty)\n";
                } else {
                    $ret .= "\n";

                    $i = 0;
                    foreach ($children as $name => $value) {
                        array_push($stack, sprintf($hierarchyNotation, $name));
                        $ret .= self::dump($value, $maxdepth, $maxValueLen, $stack);
                        array_pop($stack);
                        $i++;
                    }
                }
            }
        } else {
            $val = self::dumpScalar($var, $maxValueLen);
            if ($stack) {
                $ret = join('', $stack) . ' = ' . $val;
            } else {
                $ret = $val;
            }
            $ret .= "\n";
        }
        return $ret;
    }
11878
public static function dump($var, $title = false, $return = false) {
        // capture on return
        if($return)
            ob_start();

        // start pre, got title?
        echo '<pre style="'. implode(';', self::$pre) .'">';
        if($title)
            echo '<span style="'. implode(';', self::$title) .'">'. $title .'</span>';

        // do the deed and end pre
        var_dump($var);
        echo "</pre>";

        // return output
        return $return ? ob_get_clean() : true;
    }
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;
        }
    }
1196761
public function call(string $method, ...$vars) : self
    {
        $clone = clone $this;
        $clone->elements = array_map(function ($element) use ($method, $vars) {
            return call_user_func_array([$element, $method], $vars);
        }, $this->elements);

        return $clone;
    }
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);
    }
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;
    }
156148
public function dump( $value )
	{
		if ( class_exists( CliDumper::class ) )
		{
			$dumper = 'cli' === PHP_SAPI ? new CliDumper : new HtmlDumper;

			$dumper->dump( ( new VarCloner )->cloneVar( $value ) );
		}
		else
			var_dump( $value );
	}