Commit 52123a61 authored by Freddy's avatar Freddy

Merge branch 'patch/autodetect' into 'master'

Debug: Automatically detect arrays

Closes #92 and #94

See merge request !99
parents e5396dbc 78524d48
Pipeline #1711 passed with stages
in 2 minutes and 42 seconds
...@@ -379,7 +379,7 @@ class Debug extends Core { ...@@ -379,7 +379,7 @@ class Debug extends Core {
try { try {
$ret = $this->getUserGroups($Param[0]); $ret = $this->getUserGroups($Param[0]);
$endtime = microtime(true); $endtime = microtime(true);
$this->processFunction($ret, $starttime, $endtime, true); $this->processFunction($ret, $starttime, $endtime);
} catch (Exception $e) { } catch (Exception $e) {
$endtime = microtime(true); $endtime = microtime(true);
$this->processError($e, $endtime); $this->processError($e, $endtime);
...@@ -758,16 +758,16 @@ class Debug extends Core { ...@@ -758,16 +758,16 @@ class Debug extends Core {
/** processFunction /** processFunction
* Internal, used for successful calls * Internal, used for successful calls
*/ */
private function processFunction($ret, $starttime, $endtime, $array = false) { private function processFunction($ret, $starttime, $endtime) {
$total = $endtime - $starttime; $total = $endtime - $starttime;
$this->echoSuccessful('Function call succeeded'); $this->echoSuccessful('Function call succeeded');
$this->echoNotice('Performance: ' . $total . ' seconds'); $this->echoNotice('Performance: ' . $total . ' seconds');
$answer = $this->askRequired('Display the result now? [y/N]'); $answer = $this->askRequired('Display the result now? [y/N]');
if (strtolower($answer) !== 'n') { if (strtolower($answer) !== 'n') {
if (!$array) { if (is_array($ret)) {
$this->echoOutput($ret);
} else {
var_dump($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