function baz($a, $b) { echo '<h2>Class inhertance</h2>'; $foo = new Foo(); dump($foo); echo '<h2>PHP Global variables</h2>'; dump(array('$_SERVER' => $_SERVER, '$_REQUEST' => $_REQUEST)); echo '<h2>Exception</h2>'; dump(new ErrorException('Dummy exception')); echo '<h2>Debug backtrace</h2>'; dump(debug_backtrace()); echo '<h2>Debug backtrace (processed)</h2>'; dump(Dump::backtrace(debug_backtrace())); echo '<h2>Recursion</h2>'; //array $a = array('a', 'b'); $a['c'] =& $a; //objects $b = new DummyClass(); $b->field = $b; $b->field->field =& $b; dump($a, $b); echo '<h2>Test source code</h2>'; echo Dump::source(file_get_contents(__FILE__)); }
function render_db(EurekaProfiler_Session $session) { $queries = $session->events_of_type('db'); $colors = get_theme_colors(); if (empty($queries)) { echo '<h2>This panel has no log items.</h2>'; return; } ?> <table class="summary"> <tr> <td style="background: #953FA1;"> <h3><?php echo EurekaProfiler_Tools::readable_interval($session->total_query_time()); ?> </h3> <h4>Total time</h4> </td> </tr> <tr> <td style="background: #7B3384;padding-top:0" class="border"> <?php $chart_rows = array(); $i = 0; foreach ($queries as $query) { $i++; $chart_rows[] = array($i . ': ' . (empty($query->text) ? $query->query : $query->text), $query->duration); } echo render_chart($chart_rows, 'Query'); ?> <h4>Time chart</h4> </td> </tr> </table> <!-- Query Data--> <div class="data-wrapper"> <table class="data data-db"> <?php $i = 0; foreach ($queries as $query) { /* @var $query ProfilerQuery */ //EXPLAIN info if (empty($query->explain)) { $explain_html = 'No EXPLAIN info'; } else { $explain_html = array(); foreach ($query->explain as $key => $value) { $name = ucwords(str_replace('_', ' ', $key)); $explain_html[] = "{$name}: <strong>{$value}</strong>"; } $explain_html = implode(' · ', $explain_html); } //Query Info if (empty($query->text)) { $query_html = htmlspecialchars($query->query); } else { $query_html = $query->text; $original_query = $query->query; if (class_exists('Dump') && method_exists('Dump', 'source')) { $original_query = Dump::source($original_query, 'mysql'); } $explain_html = '<a class="show-original-query" title="Show full original query" href="#" onclick="app_show_popup(' . htmlspecialchars(json_encode($original_query)) . ', \'Original query\');return false;">[SHOW]</a> ' . $explain_html; } $html = '<div class="query">' . $query_html . '</div>' . '<div class="query-explain">' . $explain_html . '</div>'; basic_row($i + 1, $html, EurekaProfiler_Tools::readable_interval($query->duration), $colors[$i % count($colors)]); $i++; } ?> </table> </div> <?php }