Rename all the files to camelCase and update the class name in the files
This commit is contained in:
61
src/Backtrace.php
Normal file
61
src/Backtrace.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/** DomFramework
|
||||
* @package domframework
|
||||
* @author Dominique Fournier <dominique@fournier38.fr>
|
||||
* @license BSD
|
||||
*/
|
||||
|
||||
namespace Domframework;
|
||||
|
||||
/** Display the backtrace in HTML with clicks to display the content
|
||||
*/
|
||||
class Backtrace
|
||||
{
|
||||
/** Display the backtrace in the browser
|
||||
* use: \backtrace::show (debug_backtrace ());
|
||||
* @param array $backtrace The backtrace to display
|
||||
*/
|
||||
public static function show ($backtrace)
|
||||
{
|
||||
if (! is_array ($backtrace))
|
||||
throw new \Exception ("Backtrace invalid: not an array", 500);
|
||||
echo "<pre>Debug BackTrace:\n";
|
||||
foreach ($backtrace as $key=>$back)
|
||||
{
|
||||
echo "<span onclick=\"document.getElementById('backtrace_$key').".
|
||||
"classList.toggle('hidden');\" style='cursor: pointer;'>";
|
||||
echo "$key => ";
|
||||
if (array_key_exists ("file", $back))
|
||||
echo $back["file"]."[".$back["line"]."] : ";
|
||||
if (array_key_exists ("class", $back))
|
||||
echo $back["class"];
|
||||
echo "::".$back["function"]. "(";
|
||||
if (array_key_exists ("args", $back))
|
||||
{
|
||||
foreach ($back["args"] as $k=>$arg)
|
||||
{
|
||||
if ($k > 0)
|
||||
echo ", ";
|
||||
if (is_array ($arg))
|
||||
echo "ARRAY";
|
||||
elseif (is_object ($arg))
|
||||
echo "OBJECT ".get_class ($arg);
|
||||
elseif (is_bool ($arg))
|
||||
echo ($arg === true) ? "true" : "false";
|
||||
elseif (is_string ($arg))
|
||||
echo "\"$arg\"";
|
||||
elseif (is_int ($arg) || is_float ($arg))
|
||||
echo $arg;
|
||||
else
|
||||
var_dump ($arg);
|
||||
}
|
||||
}
|
||||
echo ")";
|
||||
echo "</span>";
|
||||
echo "<div id='backtrace_$key' class='hidden'>";
|
||||
print_r ($back);
|
||||
echo "</div>\n";
|
||||
}
|
||||
echo "</pre>\n";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user