/**
  * work out who has called a piece of code
  *
  * @param  array $backtrace
  *         the debug_backtrace() return value
  * @param  array $filterList
  *         a list of namespaces and classes to skip over
  * @return StackFrame
  */
 public static function from($backtrace, $filterList = [])
 {
     // get the call stack frame that we want to return
     $frame = FilterBacktrace::from($backtrace, $filterList);
     // convert the stack frame into something that's easier to use
     $retval = new StackFrame($frame['class'], $frame['function'], $frame['type'], $frame['file'], $frame['line']);
     // all done
     return $retval;
 }
 /**
  * @covers ::from
  * @covers ::extractFrameDetails
  */
 public function testReturnsLastStackFrameWhenStartingSearchBeyondTheStack()
 {
     // ----------------------------------------------------------------
     // setup your test
     $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
     $partials = [];
     $expectedClass = "PHPUnit_TextUI_Command";
     $expectedMethod = "main";
     // ----------------------------------------------------------------
     // perform the change
     $actualFrame = FilterBacktrace::from($backtrace, $partials, 300);
     // ----------------------------------------------------------------
     // test the results
     $this->assertEquals($expectedClass, $actualFrame['class']);
     $this->assertEquals($expectedMethod, $actualFrame['function']);
 }