Commit 78524d48 authored by Luke081515's avatar Luke081515

Debug: Automatically detect arrays

* Debug checks if the result is an array
* If the result is an array, var_dump gets used as before, otherwise the normal echoOutput.
* Removed all calls using $array = true
* Ref #94
parent 1a38ed8e
Pipeline #1577 passed with stages
in 2 minutes and 42 seconds
......@@ -373,7 +373,7 @@ class Debug extends Core {
try {
$ret = $this->getUserGroups($Param[0]);
$endtime = microtime(true);
$this->processFunction($ret, $starttime, $endtime, true);
$this->processFunction($ret, $starttime, $endtime);
} catch (Exception $e) {
$endtime = microtime(true);
$this->processError($e, $endtime);
......@@ -752,16 +752,16 @@ class Debug extends Core {
/** processFunction
* Internal, used for successful calls
*/
private function processFunction($ret, $starttime, $endtime, $array = false) {
private function processFunction($ret, $starttime, $endtime) {
$total = $endtime - $starttime;
$this->echoSuccessful('Function call succeeded');
$this->echoNotice('Performance: ' . $total . ' seconds');
$answer = $this->askRequired('Display the result now? [y/N]');
if (strtolower($answer) !== 'n') {
if (!$array) {
$this->echoOutput($ret);
} else {
if (is_array($ret)) {
var_dump($ret);
} else {
$this->echoOutput($ret);
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment