DataCollector/TwigDataCollector.php
protected function getVarDump($var)
    {
        $varType = gettype($var);
        switch ($varType) {
            case 'boolean':
            case 'integer':
            case 'double':
            case 'NULL':
            case 'ressource':
                return print_r($var, 1);
            case 'string':
                return (250 < strlen($var)) ? substr($var, 0, 250).'...' : $var;
            case 'object':
                return 'Object instance of ' . get_class($var);
            case 'array':
                $formated_array = array();

                foreach ($var as $key => $value) {
                    $formated_array[$key] = $this->getVarDump($value);
                }

                return print_r($formated_array, 1);
        }
    }
protected function getVarDump($var)
    {
        $varType = gettype($var);
        switch ($varType) {
            case 'boolean':
            case 'integer':
            case 'double':
            case 'NULL':
            case 'ressource':
                return print_r($var, 1);
            case 'string':
                return (250 < strlen($var)) ? substr($var, 0, 250).'...' : $var;
            case 'object':
                return 'Object instance of ' . get_class($var);
            case 'array':
                $formated_array = array();

                foreach ($var as $key => $value) {
                    $formated_array[$key] = $this->getVarDump($value);
                }

                return print_r($formated_array, 1);
        }
    }
protected function getVarDump ( $ var ) { $ varType = gettype ( $ var ) ; switch ( $ varType ) { case 'boolean' : case 'integer' : case 'double' : case 'NULL' : case 'ressource' : return print_r ( $ var , 1 ) ; case 'string' : return ( 250 < strlen ( $ var ) ) ? substr ( $ var , 0 , 250 ) . '...' : $ var ; case 'object' : return 'Object instance of ' . get_class ( $ var ) ; case 'array' : $ formated_array = array ( ) ; foreach ( $ var as $ key => $ value ) { $ formated_array [ $ key ] = $ this -> getVarDump ( $ value ) ; } return print_r ( $ formated_array , 1 ) ; } }
Returns var_dump like of a variable but avoiding flood dumping

@return string Formated var_dump
Returns var_dump like of a variable but avoiding flood dumping