@@ -18,33 +18,33 @@ |
||
| 18 | 18 | { |
| 19 | 19 | parent::__construct(...func_get_args()); |
| 20 | 20 | |
| 21 | - $this->rewindStackWhile( function($backtrace, $level) { |
|
| 21 | + $this->rewindStackWhile(function($backtrace, $level) { |
|
| 22 | 22 | // Finds the closest caller |
| 23 | - return isset($backtrace[ $level ]['class']) |
|
| 24 | - && $backtrace[ $level ]['class'] == __CLASS__; |
|
| 25 | - }, 0 ); |
|
| 23 | + return isset($backtrace[$level]['class']) |
|
| 24 | + && $backtrace[$level]['class'] == __CLASS__; |
|
| 25 | + }, 0); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | 29 | */ |
| 30 | 30 | public function setStackLocationHere() |
| 31 | 31 | { |
| 32 | - $this->rewindStackWhile( function($backtrace, $level) { |
|
| 32 | + $this->rewindStackWhile(function($backtrace, $level) { |
|
| 33 | 33 | // Finds the closest caller |
| 34 | 34 | return $level < 2; |
| 35 | - }, 4 ); |
|
| 35 | + }, 4); |
|
| 36 | 36 | |
| 37 | 37 | return $this; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | 41 | */ |
| 42 | - protected function rewindStackWhile(callable $scope_checker, $stack_max_depth=20) |
|
| 42 | + protected function rewindStackWhile(callable $scope_checker, $stack_max_depth = 20) |
|
| 43 | 43 | { |
| 44 | - $backtrace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, $stack_max_depth); |
|
| 44 | + $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, $stack_max_depth); |
|
| 45 | 45 | $i = 1; |
| 46 | 46 | $caller = $backtrace[$i]; |
| 47 | - while ( $scope_checker( $backtrace, $i ) ) { |
|
| 47 | + while ($scope_checker($backtrace, $i)) { |
|
| 48 | 48 | $i++; |
| 49 | 49 | $caller = $backtrace[$i]; |
| 50 | 50 | // TODO remove the previous levels of the stack? |
@@ -54,11 +54,13 @@ |
||
| 54 | 54 | // var_export($caller); |
| 55 | 55 | |
| 56 | 56 | // TODO How to handle perfectly the missing fields of the backtrace? |
| 57 | - if (isset($caller['file'])) |
|
| 58 | - $this->file = $caller['file']; |
|
| 57 | + if (isset($caller['file'])) { |
|
| 58 | + $this->file = $caller['file']; |
|
| 59 | + } |
|
| 59 | 60 | |
| 60 | - if (isset($caller['line'])) |
|
| 61 | - $this->line = $caller['line']; |
|
| 61 | + if (isset($caller['line'])) { |
|
| 62 | + $this->line = $caller['line']; |
|
| 63 | + } |
|
| 62 | 64 | |
| 63 | 65 | // var_export($this->stack); |
| 64 | 66 | } |