Skip to content

Commit

Permalink
replace loop
Browse files Browse the repository at this point in the history
  • Loading branch information
juliangut committed Oct 27, 2017
1 parent 0afb5a6 commit 3930c7c
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions src/HttpExceptionAwareTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,29 +161,31 @@ private function getBackTrace(): array
$trace = [];

if (function_exists('xdebug_get_function_stack')) {
$trace = xdebug_get_function_stack();

foreach ($trace as &$frame) {
if (!isset($frame['type'])) {
// http://bugs.xdebug.org/view.php?id=695
if (isset($frame['class'])) {
$trace = array_map(
function (array $frame): array {
if (!isset($frame['type'])) {
// http://bugs.xdebug.org/view.php?id=695
if (isset($frame['class'])) {
$frame['type'] = '::';
}
} elseif ('static' === $frame['type']) {
$frame['type'] = '::';
} elseif ('dynamic' === $frame['type']) {
$frame['type'] = '->';
}
} elseif ('static' === $frame['type']) {
$frame['type'] = '::';
} elseif ('dynamic' === $frame['type']) {
$frame['type'] = '->';
}

if (isset($frame['params'])) {
if (!isset($frame['args'])) {
$frame['args'] = $frame['params'];

if (isset($frame['params'])) {
if (!isset($frame['args'])) {
$frame['args'] = $frame['params'];
}

unset($frame['params']);
}

unset($frame['params']);
}
}
unset($frame);
return $frame;
},
xdebug_get_function_stack()
);

$trace = array_reverse(array_slice($trace, 0, -3));
}
Expand Down

0 comments on commit 3930c7c

Please sign in to comment.