Beispiel #1
0
/**
 * Debug function
 * d($var);
 */
function d($var, $caller = null)
{
    if (!isset($caller)) {
        $caller = array_shift(debug_backtrace(1));
    }
    echo '<code>File: ' . $caller['file'] . ' / Line: ' . $caller['line'] . '</code>';
    echo '<pre>';
    yii\helpers\VarDumper::dump($var, 10, true);
    echo '</pre>';
}
Beispiel #2
0
function print_pre($var, $header = null, $debug = true, $return = false, $depth = 3, $highlight = null)
{
    if (!isset($highlight)) {
        $highlight = false;
    }
    if ($debug && YII_DEBUG) {
        \Yii::trace($header . ' ' . yii\helpers\VarDumper::dumpAsString($var, $depth, $highlight), 'firebug');
    } else {
        $html = '';
        if ($header) {
            $html = "<strong>" . $header . "</strong>\n";
        }
        $html .= "\n<pre class='debug'>";
        //$html .= print_r($var, true);
        $html .= yii\helpers\VarDumper::dumpAsString($var, $depth, $highlight);
        $html .= "</pre>\n";
        if ($return) {
            return $html;
        }
        echo $html;
    }
}
Beispiel #3
0
 public static function dump($var, $depth = 10, $highlight = true, $echo = true)
 {
     $vard = new \yii\helpers\VarDumper();
     if ($echo === true) {
         echo $vard->dumpAsString($var, $depth, $highlight);
     } else {
         return $vard->dumpAsString($var, $depth, $highlight);
     }
 }
Beispiel #4
0
function dump($model,$die=true){
yii\helpers\VarDumper::dump($model,10,true);

    if($die)
        exit;
}
Beispiel #5
0
function dump($target)
{
    return yii\helpers\VarDumper::dump($target, 10, true);
}